summaryrefslogtreecommitdiff
path: root/lib/command.h
AgeCommit message (Collapse)Author
2021-09-21vtysh: Add error code if daemon is not runningYaroslav Fedoriachenko
After `<daemon_name> is not running` message vtysh does not return error. For example if you disable ospf in `/etc/frr/daemons` and run `vtysh -c configure -c "router ospf"` it prints the message to stderr, but returns 0. This commit will make vtysh return error when not in interractive mode. But if you run commands from vtysh, you will still be able to enter views and exit them if daemon is not running. Signed-off-by: Yaroslav Fedoriachenko <yar.fed99@gmail.com>
2021-08-18pimd: change ranges to 1..max, type align with IETF YANG.Christian Hopps
While defaults are good picks for "reasonable" guesses, min and max range values really aren't. Operators and experimenters often like to configure "unreasonable" values to stress test, tests boundary conditions and explore innovations. With that in mind, change all ranges to 1..max (of type). While we're here add optional ignored values in the "no" CLI forms. Signed-off-by: Christian Hopps <chopps@labn.net>
2021-07-05ospfd: introduce support for Graceful Restart (restarting mode)Renato Westphal
RFC 3623 specifies the Graceful Restart enhancement to the OSPF routing protocol. This PR implements support for the restarting mode, whereas the helper mode was implemented by #6811. This work is based on #6782, which implemented the pre-restart part and settled the foundations for the post-restart part (behavioral changes, GR exit conditions, and on-exit actions). Here's a quick summary of how the GR restarting mode works: * GR can be enabled on a per-instance basis using the `graceful-restart [grace-period (1-1800)]` command; * To perform a graceful shutdown, the `graceful-restart prepare ospf` EXEC-level command needs to be issued before restarting the ospfd daemon (there's no specific requirement on how the daemon should be restarted); * `graceful-restart prepare ospf` will initiate the graceful restart for all GR-enabled instances by taking the following actions: o Flooding Grace-LSAs over all interfaces o Freezing the OSPF routes in the RIB o Saving the end of the grace period in non-volatile memory (a JSON file stored in `$frr_statedir`) * Once ospfd is started again, it will follow the procedures described in RFC 3623 until it detects it's time to exit the graceful restart (either successfully or unsuccessfully). Testing done: * New topotest featuring a multi-area OSPF topology (including stub and NSSA areas); * Successful interop tests against IOS-XR routers acting as helpers. Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-06-07Merge pull request #8781 from idryzhov/fix-list-findRafael Zalamena
lib: fix output of "list" and "find" commands
2021-06-03lib, vtysh: reduce code duplicationIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-02*: new cli-nodes for BGP SRv6 VPNv4 (step4)Hiroki Shirokura
This commit add just CLI-nodes for MP-BGP VPN configuration with SRv6 backend rather than MPLS. Actual configuration cli will be implemented after this commit. Example Configuration follow. This cli design is based on Cisco IOS-XR but actual cli tree design is defferent between FRR and Cisco. It's just based on cisco. ref: https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/asr9k-r6-6/segment-routing/configuration/guide/b-segment-routing-cg-asr9000-66x/b-segment-routing-cg-asr9000-66x_chapter_011.html#concept_hwj_trf_dlb router bgp 1 bgp router-id 1.1.1.1 ! segment-routing srv6 ! new cli-node locator LOC1 ! this cli will be added after this commit. ! ! Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02*: new cli-nodes for SRv6 manager (step2)Hiroki Shirokura
This commit is a part of #5853 that add new cmd-node for SRv6 configuration. This commit just add cmd-node and moving node cli only, acutual SRv6 config command isn't added. (that is added later commit. of this branch) new cli nodes: * SRv6 * SRv6-locators * SRv6-locator Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-05-05bgpd: Create BGP alias names for community/large-communityDonatas Abraitis
Show alias name instead of numerical value in `show bgp <prefix>. E.g.: ``` root@exit1-debian-9:~/frr# vtysh -c 'sh run' | grep 'bgp community alias' bgp community alias 65001:123 community-1 bgp community alias 65001:123:1 lcommunity-1 root@exit1-debian-9:~/frr# ``` ``` exit1-debian-9# sh ip bgp 172.16.16.1/32 BGP routing table entry for 172.16.16.1/32, version 21 Paths: (2 available, best #2, table default) Advertised to non peer-group peers: 65030 192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (172.16.16.1) Origin incomplete, metric 0, valid, external, best (Neighbor IP) Community: 65001:12 65001:13 community-1 65001:65534 Large Community: lcommunity-1 65001:123:2 Last update: Fri Apr 16 12:51:27 2021 exit1-debian-9# ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-04-21lib: correctly exit CLI nodes on file config loadDavid Lamparter
The (legacy) code for reading split configs tries to execute config commands in parent nodes, but doesn't call the node_exit function when it goes up to a parent node. This breaks BGP RPKI setup (and extended syslog, which is in the next commit.) Doing this correctly is a slight bit involved since the node_exit callbacks should only be called if the command is actually executed on a parent node. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01lib/xref: add xrefs for install_element()David Lamparter
Combined with the DEFUN xrefs, this means we can extract the full CLI tree from a binary file. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01lib/xref: add xrefs for DEFUNsDavid Lamparter
This allows grabbing a list of all DEFUNs and their help texts through the xref extraction mechanics. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-01-21lib: List all possible well-known communities in CLI (COMMUNITY_VAL_STR)Donatas Abraitis
``` exit1-debian-9(config-route-map)# set community AA:NN Community number in AA:NN format (where AA and NN are (0-65535)) or local-AS|no-advertise|no-export|internet|graceful-shutdown|accept-own-nexthop|accept-own|route-filter-translated-v4|route-filter-v4|route-filter-translated-v6|route-filter-v6|llgr-stale|no-llgr|blackhole|no-peer or additive none No community attribute ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-12-18pathd: Add optional support for PCEP to pathdSebastien Merle
This new dynamic module makes pathd behave as a PCC for dynamic candidate path using the external library pcpelib https://github.com/volta-networks/pceplib . The candidate paths defined as dynamic will trigger computation requests to the configured PCE, and the PCE response will be used to update the policy. It supports multiple PCE. The one with smaller precedence will be elected as the master PCE, and only if the connection repeatedly fails, the PCC will switch to another PCE. Example of configuration: segment-routing traffic-eng pcep pce-config CONF source-address ip 10.10.10.10 sr-draft07 ! pce PCE1 config CONF address ip 1.1.1.1 ! pce PCE2 config CONF address ip 2.2.2.2 ! pcc peer PCE1 precedence 10 peer PCE2 precedence 20 ! ! ! ! Co-authored-by: Brady Johnson <brady@voltanet.io> Co-authored-by: Emanuele Di Pascale <emanuele@voltanet.io> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Co-authored-by: Javier Garcia <javier.garcia@voltanet.io> Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: Sebastien Merle <sebastien@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-12-18pathd: New SR-TE policy management daemonSebastien Merle
This new daemon manages Segment-Routing Traffic-Engineering (SR-TE) Policies and installs them into zebra. It provides the usual yang support and vtysh commands to define or change SR-TE Policies. In a nutshell SR-TE Policies provide the possibility to steer traffic through a (possibly dynamic) list of Segment Routing segments to the endpoint of the policy. This list of segments is part of a Candidate Path which again belongs to the SR-TE Policy. SR-TE Policies are uniquely identified by their color and endpoint. The color can be used to e.g. match BGP communities on incoming traffic. There can be multiple Candidate Paths for a single policy, the active Candidate Path is chosen according to certain conditions of which the most important is its preference. Candidate Paths can be explicit (fixed list of segments) or dynamic (list of segment comes from e.g. PCEP, see below). Configuration example: segment-routing traffic-eng segment-list SL index 10 mpls label 1111 index 20 mpls label 2222 ! policy color 4 endpoint 10.10.10.4 name POL4 binding-sid 104 candidate-path preference 100 name exp explicit segment-list SL candidate-path preference 200 name dyn dynamic ! ! ! There is an important connection between dynamic Candidate Paths and the overall topic of Path Computation. Later on for pathd a dynamic module will be introduced that is capable of communicating via the PCEP protocol with a PCE (Path Computation Element) which again is capable of calculating paths according to its local TED (Traffic Engineering Database). This dynamic module will be able to inject the mentioned dynamic Candidate Paths into pathd based on calculated paths from a PCE. https://tools.ietf.org/html/draft-ietf-spring-segment-routing-policy-06 Co-authored-by: Sebastien Merle <sebastien@netdef.org> Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Co-authored-by: Emanuele Di Pascale <emanuele@voltanet.io> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-11-20lib: fix local variable shadowing global oneIgor Ryzhov
start_config and end_config are already used as function names in DEFUN, so the current naming is a little bit confusing. Let's use different names for arguments. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-11-19lib, sharpd, vtysh: When reading a file in for config send start/end indicatorsDonald Sharp
When reading a file in for configuration, send start and end indicators to interested parties. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-13lib: consolidate evpn type help strings into macroStephen Worley
Consolidate evpn type help strings into one single macro for use on commands that need to support all the types. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-08lib: add some EVPN help string constantsStephen Worley
Add some EVPN help string constants to make use of in later commits. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-02vtysh: dynamically generate the list of daemons for commandsIgor Ryzhov
Some daemons were actually missing from the static definitions: nhrpd, babeld, eigrpd and bfdd. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-09-09lib: adding support for LDP IGP Sync featureKaren Schoener
Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-08-07lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle
For the sake of Segment Routing (SR) and Traffic Engineering (TE) Policies there's a need for additional infrastructure within zebra. The infrastructure in this PR is supposed to manage such policies in terms of installing binding SIDs and LSPs. Also it is capable of managing MPLS labels using the label manager, keeping track of nexthops (for resolving labels) and notifying interested parties about changes of a policy/LSP state. Further it enables a route map mechanism for BGP and SR-TE colors such that learned BGP routes can be mapped onto SR-TE Policies. This PR does not introduce any usable features by now, it is just infrastructure for other upcoming PRs which will introduce 'pathd', a new SR-TE daemon. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-08-03*: introduce DEFPY_YANG & friendsRenato Westphal
DEFPY_YANG will allow the CLI to identify which commands are YANG-modeled or not before executing them. This is going to be useful for the upcoming configuration back-off timer work that needs to commit pending configuration changes before executing a command that isn't YANG-modeled. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-07-20vtysh: rework DEFPY processing in extract.plIgor Ryzhov
Currently, all DEFPY commands are translated into one-liners in vtysh_cmd.c. After the patch, DEFPY commands are correctly indented just like DEFUN/ALIAS commands. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-07-14Revert "Rpki Encapsulation"revert-5015-rpki_vrf_encapsulationQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-07-02bgpd: duplicate config commands into rpki-vrf subnodePhilippe Guibert
rpki vrf subnode is instantiated under the vrf subnode. It it to be noted that this commit contains a change in vtysh. Actually, the output of bgp daemon from show running-config is extracted in vtysh, and reengineered ( hence the vtysh_config.c change done). This permits having a subnode under vrf sub node. Also, add vrf node support to bgpd, as rpki command can not be found under vrf node. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-06-10lib,sharpd: add a SHARP_STR aliasMark Stapp
Add a vty-friendly protocol name alias for sharpd. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-05-20bfdd,lib,vtysh: new command node for BFD profilesRafael Zalamena
Add the necessary code to implement the BFD profile command node. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-16Merge pull request #6135 from opensourcerouting/cli-node-cleanupDonald Sharp
*: clean up the mess that is CLI command nodes
2020-04-16lib: #define FRR_CMD_NODE_20200416David Lamparter
... requested by Lou. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-16*: add ->node_exit to struct cmd_nodeDavid Lamparter
Rather than doing a f*gly hack for the RPKI code, let's do an on-exit hook in cmd_node. Also allows replacing some special-casing in the vty code. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16zebra: fix FPM node reusing VTY_NODEDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-16*: move CLI node names to cmd_node->nameDavid Lamparter
And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: move CLI parent data to cmd_node->parent_nodeDavid Lamparter
Same as before, instead of shoving this into a big central list we can just put the parent node in cmd_node. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove second parameter on install_node()David Lamparter
There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove cmd_node->vtyshDavid Lamparter
The only nodes that have this as 0 don't have a "->func" anyway, so the entire thing is really just pointless. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-01lib: rewrite zlog lock-free & TLS-bufferedDavid Lamparter
This is a full rewrite of the "back end" logging code. It now uses a lock-free list to iterate over logging targets, and the targets themselves are as lock-free as possible. (syslog() may have a hidden internal mutex in the C library; the file/fd targets use a single write() call which should ensure atomicity kernel-side.) Note that some functionality is lost in this patch: - Solaris printstack() backtraces are ditched (unlikely to come back) - the `log-filter` machinery is gone (re-added in followup commit) - `terminal monitor` is temporarily stubbed out. The old code had a race condition with VTYs going away. It'll likely come back rewritten and with vtysh support. - The `zebra_ext_log` hook is gone. Instead, it's now much easier to add a "proper" logging target. v2: TLS buffer to get some actual performance Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-23bgpd: Adding BGP GR Global & Per Neighbour FSM changesbisdhdh
* Added FSM for peer and global configuration for graceful restart * Added debug option BGP_GRACEFUL_RESTART for logs specific to graceful restart processing Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23bgpd: BGP Graceful Restart Per Neighbor(BGPN), DS & header files.bisdhdh
This pr contains all the header files changes for BGP GR per Neighbour(BGPN) feature. Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2019-11-30lib: make cmd_element & qobj_type constDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-19Merge pull request #5224 from manuhalo/fix_frr_reload_pathsQuentin Young
Fixes and extensions to frr_reload.py
2019-10-31vtysh: Add an option to set banner motd from an inputDonatas Abraitis
This allows to set motd from an input instead of creating a file. Example: root@exit2-debian-9:~/frr# telnet 127.0.0.1 2605 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Hello, this is bgpd User Access Verification Password: exit2-debian-9> enable exit2-debian-9# sh run Current configuration: ! frr version 7.3-dev-MyOwnFRRVersion frr defaults traditional ! hostname exit2-debian-9 password belekas log file /var/log/frr/labas.log log syslog informational banner motd line Hello, this is bgpd ! ! ! line vty ! end exit2-debian-9# Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-29lib: include ldpd to the list of daemonsEmanuele Di Pascale
... for commands such as 'show running-config X'. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-10-08lib: fix typoIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-08-30bgpd/bmp: BMP implementationDavid Lamparter
This implements BMP. There's no fine-grained history here, the non-BMP preparations are already split out from here so all that remains is BMP proper. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-02all: remove logical-router functionalityIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-07-03lib: split off c-ares code from nhrpdDavid Lamparter
This is useful in other places too, e.g. for BMP outbound connections. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03Run-time log filtering via vtysh commands (#4524)David Lamparter
Run-time log filtering via vtysh commands
2019-06-21lib: use MTYPE_STATICDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-19lib: Add vrrpd,sharpd to DAEMONS_* stringsStephen Worley
Add vrrpd and sharpd to the DAEMONS_* list so they can be dispatched daemons independent commands such as `show work-queues` and `log-filter`. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>