summaryrefslogtreecommitdiffstats
path: root/vtysh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* vtysh: Add SRv6 static SIDs CLI to vtyshYuqing Zhao12 days1-5/+33
| | | | Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
* lib,vtysh: Use backoff setsockopt option for freebsdDonald Sharp2024-12-041-3/+3
| | | | | | | | | | | | | | | Commit: 9112fb367b1ae0168b4e7a81f41c2ca621979199 Introduced the idea of setting the socket buffer send/receive sizes. BSD's in general have the fun issue of not allowing nearly as large as a size as linux. Since the above commit was developed on linux and not run on bsd it was never tested. Modify the codebase to use the backoff setsockopt that we have in the code base and use the returned values to allow us to notice what was set and respond appropriately. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* vtysh: make clang-SA happy about reusing stdinDavid Lamparter2024-10-161-5/+4
| | | | | | | | While the logic here is perfectly fine, clang-SA doesn't understand that the fopen() and fclose() match up with each other. Just use a separate variable to make clang-SA happy. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* vtysh: remove duplicate nonblocking handlingDavid Lamparter2024-10-161-3/+0
| | | | | | | | non-blocking retries are already handled in `vtysh_client_receive()`. And by the point we're back in `vtysh_client_run()`, errno may have been overwritten by the close() call in vtysh_client_receive(). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* vtysh: fix SA warning, no need to call getenv() twiceJafar Al-Gharaibeh2024-10-151-3/+2
| | | | Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
* Merge pull request #16664 from mjstapp/igor_debug_simplifyJafar Al-Gharaibeh2024-08-291-13/+2
|\ | | | | *: simplify frrlib debug
| * lib: common debug config outputIgor Ryzhov2024-08-271-13/+2
| | | | | | | | | | | | | | Implement common code for debug config output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | lib: Memory spike reduction for sh cmds at scaleSrujana2024-08-272-0/+19
|/ | | | | | | | | | | | | | | | | | | | | | | | | | The output buffer vty->obuf is a linked list where each element is of 4KB. Currently, when a huge sh command like <show ip route json> is executed on a large scale, all the vty_outs are processed and the entire data is accumulated. After the entire vty execution, vtysh_flush proceeses and puts this data in the socket (131KB at a time). Problem here is the memory spike for such heavy duty show commands. The fix here is to chunkify the output on VTY shell by flushing it intermediately for every 128 KB of output accumulated and free the memory allocated for the buffer data. This way, we achieve ~25-30% reduction in the memory spike. Fixes: #16498 Note: This is a continuation of MR #16498 Signed-off-by: Srujana <skanchisamud@nvidia.com> Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
* vtysh, lib: preprocess CLI graphsDavid Lamparter2024-07-312-3/+1
| | | | | | | | | | | | | | | | | Store a parsed and built graph of the CLI nodes in vtysh, rather than parsing and building that graph every time vtysh starts up. This provides a 3x to 5x reduction in vtysh startup overhead: `vtysh -c 'configure' -c 'interface lo' -c 'do show version'` - before: 92.9M cycles, 1114 samples - after: 16.5M cycles, 330 samples This improvement is particularly visible for users scripting `vtysh -c` calls, which notably includes topotests. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* vtysh: de-conditionalize and reorder install_nodeDavid Lamparter2024-07-312-109/+74
| | | | | | | There is entirely no point to these being conditional. And pull them up so the upcoming pre-parse code can work on a clean slate. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #16406 from ↵Jafar Al-Gharaibeh2024-07-191-3/+0
|\ | | | | | | | | opensourcerouting/fix/remove_deprecation_for_show_threads Drop deprecation for `show thread ...`
| * lib, vtysh: Removed deprecated aliases for `show thread ...`Donatas Abraitis2024-07-171-3/+0
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | pimd, lib, vtysh: Added new 'router pim[6] [vrf NAME]' config nodeNathan Bahr2024-07-162-0/+94
|/ | | | | | | | Moved all existing global/vrf PIM config to the new subnode. Existing configuration updated to be hidden and deprecated. Both versions of configuration still work together. Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
* vtysh: CLI to override default SID format configCarmine Scarpitta2024-06-131-0/+82
| | | | | | | Add CLI commands to support overriding default configuration of the SID format. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
* lib, vtysh, topotests: fix 'show ip[v6] access-list ... json' formattingPiotr Suchy2024-05-142-0/+106
| | | | | | | | | | | Similarly to recently fixed 'show ip[v6] prefix-list ...' - PR#15750, json output is not valid for 'show ip[v6] access-list ... json' commands, as it goes through all the running daemons and for each one it calls 'filter_show' creating a new json object. To aggreagate the output and create a valid json that can later be parsed, the commands were moved to vtysh and formatted accordingly Signed-off-by: Piotr Suchy <piotrsuchy@proton.me>
* lib,bgpd,vtysh: move bgp vty defines to libMark Stapp2024-04-241-1/+0
| | | | | | | Stop including a bgp header file from vtysh; move a couple of cli string defines to a library header. Signed-off-by: Mark Stapp <mjs@cisco.com>
* vtysh, lib: fix 'show ip[v6] prefix-list ... json' formatting by moving it ↵Piotr Suchy2024-04-212-1/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to vtysh Json output is not valid for 'show ip[v6] prefix-list ... json' commands, as it goes through all the running daemons and for each one it calls 'vty_show_prefix_list' creating a new json object. To aggreagate the output and create a valid json that can be parsed, the commands were moved to vtysh. Before: { "ZEBRA":{ "DEFAULT":{ "addressFamily":"IPv4", "entries":[ { "sequenceNumber":10, "type":"permit", "prefix":"0.0.0.0/0" } ] } } } { "OSPF":{ "DEFAULT":{ "addressFamily":"IPv4", "entries":[ { "sequenceNumber":10, "type":"permit", "prefix":"0.0.0.0/0" } ] } } } { "BGP":{ "DEFAULT":{ "addressFamily":"IPv4", "entries":[ { "sequenceNumber":10, "type":"permit", "prefix":"0.0.0.0/0" } ] } } } After: {"zebra":{ "DEFAULT":{ "addressFamily":"IPv4", "entries":[ { "sequenceNumber":10, "type":"permit", "prefix":"0.0.0.0/0" } ] } } ,"ospfd":{ "DEFAULT":{ "addressFamily":"IPv4", "entries":[ { "sequenceNumber":10, "type":"permit", "prefix":"0.0.0.0/0" } ] } } ,"bgpd":{ "DEFAULT":{ "addressFamily":"IPv4", "entries":[ { "sequenceNumber":10, "type":"permit", "prefix":"0.0.0.0/0" } ] } } } Signed-off-by: Piotr Suchy <piotrsuchy@proton.me>
* vtysh: Fix `show route-map` command when calling via `do`Donatas Abraitis2024-04-191-1/+1
| | | | | | | | | | | | | | | Before: ``` ton(config)# do sh route-map % [ZEBRA] Unknown command: show route-map % [BGP] Unknown command: show route-map % [ISIS] Unknown command: show route-map ``` Fixes: 570fdc55fd65899cd4376193e833594af6bca093 ("lib,vtysh: fix show route map JSON output") Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* vtysh: Check if bgpd is enabled before installing vtysh commands for RPKIDonatas Abraitis2024-04-161-0/+2
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* vtysh: Include fnctl.h for vtysh_mainDonatas Abraitis2024-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixing compilation for Alpine Linux: ``` 25 91.59 vtysh/vtysh_main.c: In function 'vtysh_flock_config': 25 91.59 vtysh/vtysh_main.c:276:20: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration] 25 91.59 276 | flock_fd = open(flock_file, O_RDONLY, 0644); 25 91.59 | ^~~~ 25 91.59 | popen 25 91.60 vtysh/vtysh_main.c:276:37: error: 'O_RDONLY' undeclared (first use in this function) 25 91.60 276 | flock_fd = open(flock_file, O_RDONLY, 0644); 25 91.60 | ^~~~~~~~ 25 91.60 vtysh/vtysh_main.c:276:37: note: each undeclared identifier is reported only once for each function it appears in 25 91.60 CC zebra/if_netlink.o 25 91.61 vtysh/vtysh_main.c: In function 'main': 25 91.61 vtysh/vtysh_main.c:637:49: error: 'O_CREAT' undeclared (first use in this function) 25 91.61 637 | fp = open(history_file, O_CREAT | O_EXCL, 25 91.61 | ^~~~~~~ 25 91.62 vtysh/vtysh_main.c:637:59: error: 'O_EXCL' undeclared (first use in this function) 25 91.62 637 | fp = open(history_file, O_CREAT | O_EXCL, 25 91.62 | ^~~~~~ ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* lib: add keychain northbound supportChristian Hopps2024-03-051-1/+1
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* Merge pull request #15288 from donaldsharp/shell_access_removalDonatas Abraitis2024-02-141-75/+0
|\ | | | | vtysh: Remove deprecated shell_access code
| * vtysh: Remove deprecated shell_access codeDonald Sharp2024-02-051-75/+0
| | | | | | | | | | | | | | This code has been deprecated for over a year and frankly needs to be removed from the system. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | lib, mgmtd: rework processing of yang notificationsIgor Ryzhov2024-02-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, YANG notification processing is done using a special type of callbacks registered in backend clients. In this commit, we start using regular northbound infrastructure instead, because it already has a convenient way of registering xpath-specific callbacks without the need for creating additional structures for each necessary notification. We also now pass a notification data to the callback, instead of a plain JSON. This allows to use regular YANG library functions for inspecting notification fields, instead of manually parsing the JSON. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | vtysh: remove resync workaround when exiting to config nodeIgor Ryzhov2024-02-072-31/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When exiting from a level below the config node, like `router rip`, vtysh executes a resync by sending "end" and "conf term [file-lock]" commands to all the daemons. As statet in the description comment, it's done "in case one of the daemons is somewhere else". I don't think this actually ever happens, but even if it is, it is a bug in a daemon that needs to be fixed. This resync was okay before the introduction of mgmtd, but now it unlocks and locks back the datastores during the configuration reading process, which can lead to a failure which is explained in the previous commit. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | mgmtd, vtysh: fix possible conflict when reading the configIgor Ryzhov2024-02-071-1/+7
|/ | | | | | | | | | | | | | | | | | | | | | | When FRR starts, after mgmtd is initialized, backend clients connect to it and request their config. To supply the config, mgmtd creates a configuration transaction. At the same time, `vtysh -b` tries to read the startup config and configure mgmtd, which also creates a configuration transaction. If these two actions happen at the exact same time, there's a conflict between them, because only a single configuration translaction is allowed. Because of that, vtysh fails and the config is completely ignored. When starting the config reading, vtysh locks candidate and running datastores in mgmtd. This commit adds locking of running datastore when initializing the backend client. It allows to retry locking on the vtysh side and read the config only when the lock is aquired instead of failing. This change also prevents running datastore from being changed during initialization of backend clients. This could lead to a desynchronized state between mgmtd and backends. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* vtysh: un-hide the show configuration nb cliMark Stapp2024-01-301-1/+1
| | | | | | | The "show configuration running" cli is pretty useful when doing NB work; unhide it so it's easier to use. Signed-off-by: Mark Stapp <mjs@labn.net>
* zebra: convert to mgmtdIgor Ryzhov2024-01-282-10/+10
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: convert affinity-map to mgmtdIgor Ryzhov2024-01-281-1/+1
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* zebra: convert interface link-params command to NBIgor Ryzhov2024-01-281-1/+9
| | | | | | | | Make link-params a presence container and activate it when entering the node. The "enable" command is not necessary anymore but kept hidden for backwards compatibility. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: rename `frr_vtydir` to `frr_runstatedir`David Lamparter2024-01-271-2/+1
| | | | | | Also remove frr_init_vtydir(), just initialize to default. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ripngd: convert ripngd to mgmtdChristian Hopps2024-01-262-9/+9
| | | | | | - a couple small fixes for ripd conversion as well. Signed-off-by: Christian Hopps <chopps@labn.net>
* ripd: ripd convert to mgmtdChristian Hopps2024-01-261-3/+3
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* lib: convert filters to mgmtdChristian Hopps2024-01-261-1/+11
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* lib: convert route-map to mgmtdChristian Hopps2024-01-262-5/+14
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* vtysh: fix VTYSH_VRF definitionIgor Ryzhov2024-01-221-1/+1
| | | | | | | | VTYSH_VRF is a collection of daemon flags, not node flags. The current code works only because RPKI_VRF_NODE is 1100101 in binary, which accidentally includes VTYSH_BGPD which is actually needed. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #15052 from louis-6wind/rpki-vrf-92Donatas Abraitis2024-01-223-3/+29
|\ | | | | bgpd: add VRF support to RPKI
| * bgpd: add support of rpki in vrf configure contextPhilippe Guibert2024-01-183-3/+29
| | | | | | | | | | | | | | Add support of RPKI commands in the VRF configure context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | Merge pull request #15168 from mjstapp/daemon_logsDonatas Abraitis2024-01-193-12/+1
|\ \ | |/ |/| lib,vtysh: add per-daemon log file config
| * lib,vtysh: add per-daemon log file configMark Stapp2024-01-173-12/+1
| | | | | | | | | | | | | | | | Add a config that specifies per-deamon log file names. Move the handy generated list of daemon names from vtysh to lib; edit the gitignore files to match. Signed-off-by: Mark Stapp <mjs@labn.net>
* | vtysh, mgmtd: send interface commands to mgmtdIgor Ryzhov2024-01-141-2/+2
|/ | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: zebra.h is not using signal.hDonald Sharp2024-01-091-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: zebra.h uses pwd.h when it should notDonald Sharp2024-01-091-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: remove sys/stat.h from zebra.hDonald Sharp2024-01-091-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* vtysh: Rename `show thread ...` to `show event ...`Donatas Abraitis2024-01-071-20/+23
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* lib, vtysh: Remove inclusion of grp.h for everyoneDonald Sharp2024-01-041-0/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* zebra, lib, vtysh: Add CLI cmd to set/unset SRv6 encap source addressCarmine Scarpitta2023-12-141-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a new node `SRV6_ENCAP_NODE` to the CLI graph. This node allows users to configure encapsulation parameters for SRv6, including the source address of the outer encapsulating IPv6 header. - Install a new CLI command `source-address` under the `SRV6_ENCAP_NODE` node. This command is used to configure the source address of the outer encapsulating IPv6 header. - Install a new CLI command `no source-address` under the `SRV6_ENCAP_NODE` node. This command is used to unset the source address of the outer encapsulating IPv6 header and restore the default source address. Examples: ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# source-address fc00:0:1::1 ``` ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# no source-address ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
* lib,vtysh: fix show route map JSON outputRafael Zalamena2023-11-241-0/+59
| | | | | | | Move the command from 'lib' to 'vtysh' so we can properly format the JSON output in a correct manner. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* vtysh: clean vtysh_file_locked when exiting config nodeIgor Ryzhov2023-11-171-1/+6
| | | | | | | The flag should be cleared to make sure it's not reused the next time we enter the config node. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: mgmtd: fix debug cli commands and memleaksChristian Hopps2023-11-111-0/+6
| | | | | | | | | | | - Cannot have 2 cmd_node's with same .node number. Install the mgmtd client library debug nodes (client frontend and client backend) using new unique node numbers. Fixes memleaks. - Fix "debug mgmt client backend" to generate correct config (and not for frontend). Signed-off-by: Christian Hopps <chopps@labn.net>