summaryrefslogtreecommitdiff
path: root/bfdd/bfdd_cli.c
AgeCommit message (Collapse)Author
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-01bfdd: forbid setting interface for multihop sessionsIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-12bfdd: fix nb cli show with defaultsIgor Ryzhov
The idea of the "with-defaults" flag is to show the default values for parameters that were not configured by the user. But bfdd incorrectly shows the default values for all parameters, including the user-configured ones. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-01bfdd: fix profiles autocompletionIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-17Merge pull request #8225 from idryzhov/bfd-echo-modeRafael Zalamena
bfdd: fix echo receive timer and disable echo mode
2021-03-16bfdd: separate echo rx/tx timersIgor Ryzhov
Currently there is a single interval for both RX and TX echo functions. This commit introduces separate RX and TX timers for echo packets. The main advantage is to be able to set the receive interval to zero when we don't want to receive echo packets from the remote system. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-16bfdd: warn users about echo-mode restrictionsIgor Ryzhov
Echo-mode implementation is currently broken. Instead of sending packets to it's own address, bfdd is sending echo packets to the peer's address. It may seem to work when testing between two FRR instances, because FRR loops back such packets, but no other implementation is supposed to do that. Let's warn users that the current implementation works only between two FRR instances. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-15bfdd: make sessions administratively up by defaultIgor Ryzhov
Current behavior is inconsistent. When the session is created by another daemon, it is up by default. When we later configure peer in bfdd, the session is still up, but the NB layer thinks that it is down. More than that, even when the session is created in bfdd using peer command, it is created in DOWN state, not ADM_DOWN. And it actually starts sending and receiving packets. The sessions is marked with SHUTDOWN flag only when we try to reconfigure some parameter. This behavior is also very unexpected. Fixes #7780. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-04bfdd: fix echo configuration in profileIgor Ryzhov
It's not currently possible to configure echo mode in profile node: ``` (config)# bfd (config-bfd)# profile test (config-bfd-profile)# echo-mode % Echo mode is only available for single hop sessions. (config-bfd-profile)# echo-interval 20 % Echo mode is only available for single hop sessions. ``` Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-03bfdd: require local-address when using multihopIgor Ryzhov
If local-address is not supplied, then an incorrect xpath is generated which is not expected by NB CLI. Fixes #7465. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-12-01bfdd: session specific command type checksRafael Zalamena
Replace the unclear error message: ``` % Failed to edit configuration. YANG error(s): Schema node not found. YANG path: /frr-bfdd:bfdd/bfd/sessions/single-hop[dest-addr='192.168.253.6'][interface=''][vrf='default']/minimum-ttl ``` With: ``` frr(config-bfd-peer)# minimum-ttl 250 % Minimum TTL is only available for multi hop sessions. ! or frr(config-bfd-peer)# echo % Echo mode is only available for single hop sessions. frr(config-bfd-peer)# echo-interval 300 % Echo mode is only available for single hop sessions. ``` Reported-by: Trae Santiago Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-09-24bfdd: use * as a placeholder for an empty interface name in northboundIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-08-24bfdd: fix parameter lengthIgor Ryzhov
There is no space reserved for "[source-addr='']". Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-08-11bfdd: implement minimum TTLRafael Zalamena
Initial BFD protocol implementation had a hard coded value of maximum 5 hops, now we have a configurable hop amount with a safe default of 1 hop. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-11bfdd: implement passive modeRafael Zalamena
The passive mode is briefly described in the RFC 5880 Bidirectional Forwarding Detection (BFD), Section 6.1. Overview: > A system may take either an Active role or a Passive role in session > initialization. A system taking the Active role MUST send BFD > Control packets for a particular session, regardless of whether it > has received any BFD packets for that session. A system taking the > Passive role MUST NOT begin sending BFD packets for a particular > session until it has received a BFD packet for that session, and thus > has learned the remote system's discriminator value. At least one > system MUST take the Active role (possibly both). The role that a > system takes is specific to the application of BFD, and is outside > the scope of this specification. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.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-14*: remove PRI[udx](8|16|32)David Lamparter
These are completely pointless and break coccinelle string replacements. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --pri8-16-32 `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2020-05-20bfdd: implement BFD session configuration profilesRafael Zalamena
Allow user to pre-configure peers with a profile. If a peer is using a profile any configuration made to the peer will take precedence over the profile configuration. In order to track the peer configuration we have now an extra copy of the peer configuration in `peer_profile` inside `struct bfd_session`. This information will help the profile functions to detect user configurations and avoid overriding what the user configured. This is especially important for peers created via other protocols where the default `shutdown` state is disabled (peers created manually are `shutdown` by default). Profiles can be used before they exist: if no profile exists then it will use the default configuration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
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>
2019-10-30bfdd: split northbound callbacks into multiple filesRenato Westphal
Rearrange the bfdd northbound callbacks as following: * bfd_nb.h: prototypes of all northbound callbacks. * bfd_nb.c: definition of all northbound callbacks and their associated YANG data paths. * bfd_nb_config.c: implementation of YANG configuration nodes. * bfd_nb_state.c: implementation of YANG state nodes. This should help to keep to code more organized and easier to maintain. No behavior changes intended. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-07-09bfdd: keep source information for single hopRafael Zalamena
Add source address to northbound when creating sessions with this information. It is not possible to change source address after the session was created, but we should be able to set it to make IPv6 work. Spotted by Philippe Guibert. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-25bfdd: convert `bfd` command to northboundRafael Zalamena
This helps northbound to create the `bfd` node on the configuration output sooner than adding a peer. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-24bfdd: fix compilation warnings on OmniOSRafael Zalamena
Build will fail with `Werror` enabled with: ``` CC bfdd/bfdd_cli.o In file included from ./lib/frratomic.h:21:0, from ./lib/memory.h:22, from ./lib/vector.h:25, from ./lib/command.h:25, from bfdd/bfdd_cli.c:23: ./config.h:665:0: error: "_FILE_OFFSET_BITS" redefined [-Werror] #define _FILE_OFFSET_BITS 64 ^ In file included from /usr/include/iso/stdlib_iso.h:49:0, from /usr/include/stdlib.h:37, from ./lib/memory.h:20, from ./lib/vector.h:25, from ./lib/command.h:25, from bfdd/bfdd_cli.c:23: /opt/gcc-5.1.0/lib/gcc/i386-pc-solaris2.11/5.1.0/include-fixed/sys/feature_tests.h:231:0: note: this is the location of the previous definition #define _FILE_OFFSET_BITS 32 ^ In file included from ./lib/thread.h:24:0, from ./lib/vty.h:27, from ./lib/command.h:26, from bfdd/bfdd_cli.c:23: ./lib/zebra.h:271:2: error: #warning "assuming 4-byte alignment for CMSG_SPACE" [-Werror=cpp] #warning "assuming 4-byte alignment for CMSG_SPACE" ^ ./lib/zebra.h:277:2: error: #warning "assuming 4-byte alignment for CMSG_LEN" [-Werror=cpp] #warning "assuming 4-byte alignment for CMSG_LEN" ^ cc1: all warnings being treated as errors Makefile:6876: recipe for target 'bfdd/bfdd_cli.o' failed gmake[1]: *** [bfdd/bfdd_cli.o] Error 1 ``` Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22bfdd: add not '\n' to shutdown help stringPhilippe Guibert
help string had not a '\n' at the end of the line for bfd shutdown help command. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-22bfdd: use microseconds timers in YANGRafael Zalamena
Lets allow specification to accept microseconds, but limit the timers configuration in FRR to milliseconds (minimum is 10 ms and maximum is 60 seconds). This matches the RFC 5880 and the IETF BFD YANG draft model. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22bfdd: support global BFD resetRafael Zalamena
Add command 'no bfd' to remove all BFD sessions configuration and fix other daemon integration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22bfdd: implement write_config using northboundRafael Zalamena
Move all the `show running-config` logic to the new northbound implementation. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22bfdd: migrate session commands to northboundRafael Zalamena
Lets start using the new BFD yang model and translate the BFD session configuration commands to use the northbound. One important change: all sessions will default to use `VRF_DEFAULT_NAME` (usually "default") when no VRF is configured. All places which search for BFD sessions must now take this into account. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>