summaryrefslogtreecommitdiff
path: root/lib/command.h
AgeCommit message (Collapse)Author
2024-01-28zebra: convert to mgmtdIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-18bgpd: add support of rpki in vrf configure contextPhilippe Guibert
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>
2023-12-14zebra, lib, vtysh: Add CLI cmd to set/unset SRv6 encap source addressCarmine Scarpitta
- 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>
2023-11-29Merge pull request #14838 from idryzhov/mgmtd-cli-outChristian Hopps
Output configuration of mgmtd-converted daemons from mgmtd
2023-11-22lib: Print debug config in files after we have prefix-listsDonatas Abraitis
Without this if we enter something like `debug bgp updates in x.x.x.x prefix-list y`, prefix-list can't be lookup up, because when we read the config, debug does not know anything about this prefix-list. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-11-21mgmtd: add node for writing configurationIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-11lib: mgmtd: fix debug cli commands and memleaksChristian Hopps
- 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>
2023-10-10Revert "bgpd: add bgp link-state address-family configuration context"Donald Sharp
This reverts commit ae2f3bb5b4eed01df1f7a69c7710c9be519390f6.
2023-09-18bgpd: add bgp link-state address-family configuration contextLouis Scalbert
Add the bgp link-state configuration context cli: > router bgp 65001 > address-family link-state link-state > neighbor 192.0.2.2 activate > exit-address-family Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-11lib: Add CLI node for SRv6 Node MSDCarmine Scarpitta
Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-08-04isisd: Add CLI command to enable SRv6Carmine Scarpitta
r1# conf r1(config)# router isis <area-tag> r1(config-router)# segment-routing srv6 Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-07-31bgpd: add set extended-comm-list <> delete commandFarid Mihoub
Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-04-18lib,vtysh,isisd,yang: algo cli/yang/callbacksHiroki Shirokura
Define the IS-IS flex-algo structure in yang, the CLI configuration commands and the skeletons of frontend and backend functions that are called by the CLI code. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-03-21mgmtd: Bringup MGMTD daemon and datastore module supportChristian Hopps
Features added in this commit: 1. Bringup/shutdown new management daemon 'mgmtd' along with FRR. 2. Support for Startup, Candidate and Running DBs. 3. Lock/Unlock DS feature using pthread lock. 4. Load config from a JSON file onto candidate DS. 5. Save config to a JSON file from running/candidate DS. 6. Dump candidate or running DS contents on the terminal or a file in JSON/XML format. 7. Maintaining commit history (Full rollback support to be added in future commits). 8. Addition of debug commands. Co-authored-by: Yash Ranjan <ranjany@vmware.com> Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com> Co-authored-by: Ujwal P <ujwalp@vmware.com> Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
2023-02-21Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White
lib, bgp: add initial support for asdot format
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-15bgpd: Add BGP Software Version CapabilityDonatas Abraitis
Implement: https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability Tested with GoBGP: ``` % ./gobgp neighbor 192.168.10.124 BGP neighbor is 192.168.10.124, remote AS 65001 BGP version 4, remote router ID 200.200.200.202 BGP state = ESTABLISHED, up for 00:01:49 BGP OutQ = 0, Flops = 0 Hold time is 3, keepalive interval is 1 seconds Configured hold time is 90, keepalive interval is 30 seconds Neighbor capabilities: multiprotocol: ipv4-unicast: advertised and received ipv6-unicast: advertised route-refresh: advertised and received extended-nexthop: advertised Local: nlri: ipv4-unicast, nexthop: ipv6 UnknownCapability(6): received UnknownCapability(9): received graceful-restart: advertised and received Local: restart time 10 sec ipv6-unicast ipv4-unicast Remote: restart time 120 sec, notification flag set ipv4-unicast, forward flag set 4-octet-as: advertised and received add-path: received Remote: ipv4-unicast: receive enhanced-route-refresh: received long-lived-graceful-restart: advertised and received Local: ipv6-unicast, restart time 10 sec ipv4-unicast, restart time 20 sec Remote: ipv4-unicast, restart time 0 sec, forward flag set fqdn: advertised and received Local: name: donatas-pc, domain: Remote: name: spine1-debian-11, domain: software-version: advertised and received Local: GoBGP/3.10.0 Remote: FRRouting/8.5-dev-MyOwnFRRVersion-gdc92f44a45-dirt cisco-route-refresh: received Message statistics: ``` FRR side: ``` root@spine1-debian-11:~# vtysh -c 'show bgp neighbor 192.168.10.17 json' | \ > jq '."192.168.10.17".neighborCapabilities.softwareVersion.receivedSoftwareVersion' "GoBGP/3.10.0" root@spine1-debian-11:~# ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-10lib, bgp: add initial support for asdot formatPhilippe Guibert
AS number can be defined as an unsigned long number, or two uint16 values separated by a period (.). The possible valus are: - usual 32 bit values : [1;2^32 -1] - <1.65535>.<0.65535> for dot notation - <0.65535>.<0.65535> for dot+ notation. The 0.0 value is forbidden when configuring BGP instances or peer configurations. A new ASN type is added for parsing in the vty. The following commands use that new identifier: - router bgp .. - bgp confederation .. - neighbor <> remote-as <> - neighbor <> local-as <> - clear ip bgp <> - route-map / set as-path <> An asn library is available in lib/ and provides some services: - convert an as string into an as number. - parse an as path list string and extract a number. - convert an as number into a string. Also, the bgp tests forge an as_zero_path, and to do that, an API to relax the possibility to have a 0 as value is specifically called from the tests. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-09lib,yang,zebra: add affinity-map supportLouis Scalbert
Add the affinity-map global command to zebra. The syntax is: > affinity-map NAME bit-position (0-1023) Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-26lib: Remove global variable exposure `struct host host`Donald Sharp
This was only used in one place and we have accessor functions now. So let's use them. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-17Revert "lib: BGP registration with IGP for BGP ORR rSPF calc"Donatas Abraitis
This reverts commit a5dd4bf47d1d24cfc5e916ff29f5124792e85a53.
2023-01-13lib,staticd: BFD integration CLI commandsRafael Zalamena
Implement the static route monitoring feature with BFD integration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-11-17Merge pull request #12081 from sworleys/EMM-upstreamDonatas Abraitis
Rework of Various Handling in EVPN for Extended Mac Mobility
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-13Merge pull request #12066 from opensourcerouting/cleanup-cli-xrefDonald Sharp
*: clean up various CLI-related bits
2022-10-12lib: BGP registration with IGP for BGP ORR rSPF calcMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-11bgpd,zebra,lib: bgp evpn vni macip into two tablesStephen Worley
Re-work the bgp vni table to use separately keyed tables for type2 routes. So, with type2 routes, we have the main table keyed off of the IP and a new MAC table keyed off of MACs. By separating out the two, we are able to run path selection separately for the neigh and mac. Keeping the two separate is also more in-line with what happens in zebra (they are managed comptletely seperate). With this change type2 routes go into each table like so: ``` Remote MAC-IP -> IP Table & MAC Table Remote MAC -> MAC Table Local MAC-IP -> IP Table Local MAC -> MAC Table ``` The difference for local is necessary because we should not ever allow multiple paths for a local MAC. Also cleaned up the commands for querying the vni tables: ``` show bgp vni all type ... show bgp vni VNI type ... ``` Old commands will be deprecated in a separate commit. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-10-07*: Create and use infrastructure to show debugs in libDonald Sharp
There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-06lib: add CMD_ATTR_NOSHDavid Lamparter
To propagate into .xref so extract.pl can be handled there. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-06lib: detangle DEFUN macrosDavid Lamparter
Make the variants go into an _ATTR macro each. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-06lib: make cmd_element->attr a bitmask & clarifyDavid Lamparter
It already "looks" like a bitmask, but we currently can't flag a command both YANG and HIDDEN at the same time. It really should be a bitmask. Also clarify DEPRECATED behaviour (or the absence thereof.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-06lib: remove unused CLI macrosDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-07-01lib, vtysh: Add `allow-reserved-ranges` global commandDonatas Abraitis
It will be used to allow/deny using IPv4 reserved ranges (Class E) for Zebra (configuring interface address) or BGP (allow next-hop to be from this range). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-17bgpd: Add RFC9234 implementationEugene Bogomazov
RFC9234 is a way to establish correct connection roles (Customer/ Provider, Peer or with RS) between bgp speakers. This patch: - Add a new configuration/terminal option to set the appropriate local role; - Add a mechanism for checking used roles, implemented by exchanging the corresponding capabilities in OPEN messages; - Add strict mode to force other party to use this feature; - Add basic support for a new transitive optional bgp attribute - OTC (Only to Customer); - Add logic for default setting OTC attribute and filtering routes with this attribute by the edge speakers, if the appropriate conditions are met; - Add two test stands to check role negotiation and route filtering during role usage. Signed-off-by: Eugene Bogomazov <eb@qrator.net>
2022-02-08Merge pull request #8458 from opensourcerouting/xref-5424Donald Sharp
lib: RFC5424 syslog support
2022-02-04lib: Add more information to `show version`Donald Sharp
Add to lib/command.c the ability to remember the release/version/system information and to allow `show version` to dump some of it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-17lib: RFC5424 & journald extended syslog targetDavid Lamparter
Not much to say here, user docs are coming up in a separate commit. RFC5424 and (systemd's) journald allow passing structured key-value data. This stuffs the metadata we have available into there. The "does the system syslogd support RFC5424" question is unfortunately not easily answered, so we can only give an affirmative answer on NetBSD 5.0+ or FreeBSD 12+. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16lib: rework vty_check_node_for_xpath_decrementDavid Lamparter
...by having a flag in struct cmd_node rather than hardcoding it in `lib/command.c`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-18vtysh: defer CLI tree buildingDavid Lamparter
We don't need the CLI tree until we actually enter the node. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-05lib: fix spelling nits in more lib filesewlumpkin
Signed-off-by: ewlumpkin <ewlumpkin@gmail.com>
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>