summaryrefslogtreecommitdiff
path: root/ldpd/ldp_vty_conf.c
AgeCommit message (Collapse)Author
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>
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-05-03ldpd: make allowing broken-lsps to be installed with pop operation configurablelynne
If LDP is miss configured in a setup and the router has LSPs with no remote label, this code installs the LSP with a pop instruction of the top-level label so the packet can be forwarded using IP. This is a best-effort attempt to deliver labeled IP packets to their final destination instead of dropping them. If this config is turned off the code will only install LSPs that have a valid remote label. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-04-26ldpd: defer register for info until configuredFredi Raspall
Instead of registering to receive default-VRF information and routes when first connected to zebra, defer the registration until some ldp configuration is entered. This avoids redistributing IPv4/IPv6 routes to ldpd when not needed. Signed-off-by: Fredi Raspall <fredi@voltanet.io> Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-10-22ldpd: replace inet_ntoaMark Stapp
Replace all use of inet_ntoa; use pI4 or inet_ntop instead. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-09-09ldpd: Adding support for LDP IGP SynchronizationKaren Schoener
Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
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-16*: clean up cmd_node initializersDavid Lamparter
... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-14ldpd: ldp_vty_neighbor_password(): fix auth.md5key_len calculationG. Paul Ziemba
Per issue #6202 Very long passwords (>79 chars) get truncated: save truncated length in nbrp->auth.md5key_len instead of original length. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2020-03-20ldpd: adding support for LDP ordered label distribution controlKaren Schoener
LDP ordered label distribution control only binds a label to a FEC if it is the egress LSR, or the router received a label binding for a FEC from the next hop router. In this mode, an MPLS router will create a label binding for each FEC and distribute it to its neighbors so long as he has a entry in the RIB for the destination. Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-02-06*: Replace s_addr 0 => INADDR_ANYDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2018-06-25ldpd: null check (Coverity 1452317)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-21ldpd lib: null check (Coverity 1452287 + 20 alike)paco
Coverity issues fixed with this commit: 1452287 1452291 1452307 1452310 1452317 1452321 1452327 1452330 1452331 1452336 1452337 1452340 1452352 1452354 1452358 (originated at ldpd/ldpd_vty_cmds_clippy.c) 1448388 1448390 1448392 1448397 1448404 1448408 (originated at lib/plist_clippy.c) Signed-off-by: F. Aragon <paco@voltanet.io>
2018-02-23*: Make assignment from RB_ROOT in while loop work betterDonald Sharp
Fix up the assignment of the variable = RB_ROOT inside of while loop patter we were using. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-03ldpd: fix issue when displaying the running configurationRenato Westphal
More than a cosmetic fix, this should prevent issues with frr-reload.py. Before: mpls ldp router-id 1.1.1.1 ! address-family ipv4 discovery transport-address 1.1.1.1 ! interface rt1-eth0 discovery hello holdtime 10 discovery hello interval 3 exit-address-family ! ! After: mpls ldp router-id 1.1.1.1 ! address-family ipv4 discovery transport-address 1.1.1.1 ! interface rt1-eth0 discovery hello holdtime 10 discovery hello interval 3 ! exit-address-family ! ! Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-03ldpd: remove the "discovery targeted-hello" commands from the interface nodeRenato Westphal
These commands belong only in the global LDP node and in the LDP address-family nodes. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31ldpd: convert CLI code to use DEFPYRenato Westphal
Yay :) Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31ldpd: restore correct defaults on "no discovery ... interval"Renato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-26ldpd: add the exit-address-family commandRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-14Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter
Lots of conflicts from CMD_WARNING_CONFIG_FAILED... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 1 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: ditch vty_outln(), part 2 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13vtysh: return non-zero for configuration failuresDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This allows frr-reload.py (or anything else that scripts via vtysh) to know if the vtysh command worked or hit an error.
2017-07-13*: ditch vty_outln(), part 1 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-29*: vty_outln (vty, "") --> vty_out (vty, VTYNL)Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: use vty_outlnQuentin Young
Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-19Merge pull request #730 from opensourcerouting/rbtree-improvementDonald Sharp
RB tree improvement
2017-06-16ldpd: update copyright informationRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-16ldpd: convert cli and get rid of the xml interfaceRenato Westphal
The xml2cli.pl script was useful years ago when the vty code was very rudimentary. This is not the case anymore, so convert all ldpd CLI commands to use DEFUNs directly and get rid of the XML interface. The benefits are: * Consistency with the other daemons; * One less build dependency (the LibXML perl module); * Easier to add new commands. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-16lib: improve the RB implementationRafael Zalamena
Switch the RB tree implementation completely to the new dlg@'s version that uses pre-declared functions instead of macros for tree functions. Original e-mail/diff: https://marc.info/?l=openbsd-tech&m=147087487111068&w=2 Pros: * Reduces the amount of code that the usage of those macros generate * Allows the compiler to do a better compile-time check job * Might have better i-cache utilization since the tree code is shared Con: * dlg@ benchmarks shows it has 'very slightly slower' insertions * imported RB_* code must adapt the following calls: RB_INIT(), RB_GENERATE(), RB_ROOT(), RB_EMPTY(), make compare functions use 'const' (if not already) and maybe others.
2017-06-02ldpd: further improvements in the configuration handlingRenato Westphal
This patch attempts to make the code easier to read by removing a global variable and changing a few other things. Also, ldpd now calls merge_config() only after reading the whole initial configuration at startup, instead of doing that for every command in the configuration file. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-26ldpd: fix small style issuesRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31ldpd: do not consume vty_conf when updating the configurationRenato Westphal
David Lamparter gave the idea of keeping vty_conf as a permanent copy of ldpd_conf in order to simplify the CLI code and facilitate the integration with his cap'n proto framework in the future. Doing this demanded quite some effort but it was worth it as the code looks much better now. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31ldpd: fix configuration of non-existing VPLS interfaces and pseudowiresRenato Westphal
If we don't know the ifindex, flags, etc of an interface at the time it's configured, we should make sure that once this information is available the appropriate structures are updated. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31ldpd: remove the interface vty nodeRenato Westphal
ldpd uses a hierarchical configuration model where all commands are defined inside the "mpls ldp" node and its subnodes. The idea is to keep all LDP configuration in a single place to keep things simple. With that said, we can remove the "config-if" node from ldpd because we already have a separate node ("config-ldp-af-if") for LDP-related interface specific commands. Example: vtysh(config)# mpls ldp vtysh(config-ldp)# address-family ipv4 vtysh(config-ldp-af)# interface eth1 vtysh(config-ldp-af-if)# discovery hello ? holdtime Hello holdtime interval Hello interval Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-27ldpd: remove a few unnecessary functionsRenato Westphal
The original ldpd(8) daemon in OpenBSD doesn't allow the user to put non-existing interfaces in the configuration file. For this reason, the l2vpn_if_find() and l2vpn_pw_find() functions take an ifindex as an argument. In FRR's ldpd we can put non-existing interfaces in the configuration, and they are activated as soon as they are available. For this reason, we can't lookup interfaces by their ifindex in this port. The l2vpn_if_find_name() and l2vpn_pw_find_name() functions were introduced to address this issue. However, since the "find-by-ifindex" functions are not being used anymore, we can just remove them and rename the *_find_name() functions removing the "_name" suffix. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-27ldpd: do a full configuration reload upon receiving a SIGHUPRenato Westphal
The rationale here is to do something very similar to what the original OpenBSD's ldpd(8) does to reload configuration files: * create a new empty base configuration (vty_conf); * parse the configuration file and store the result in vty_conf; * merge the new configuration into the current configuration. To do this, introduce a new global variable called "sighup" so that ldpd doesn't attempt to merge vty_conf into ldpd_conf for each command in the configuration file, which would be very disruptive. vty_conf should be merged only after the whole configuration file is parsed in order to avoid taking actions like shutting down neighbors when not necessary. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-27ldpd: simplify handling of configuration commandsRenato Westphal
The logic to make configuration changes in ldpd is as follows: 1 - duplicate the current configuration; 2 - modify the duplicated configuration (delta); 3 - merge the duplicated configuration into the current configuration. We can however change things a little bit in order to simplify the code. If we provide a global vty_conf variable and make sure that it's always an up-to-date duplicate of ldpd_conf, then we don't need to call ldp_dup_config() in the callback of each configuration command. Instead of that, we just need to duplicate ldpd_conf in the startup of the daemon and in the end of the ldp_reload() function. Doing this is safe because, due to the single-threaded nature of the parent process, it's impossible to have multiple requests to change the configuration at the same time. Also, we can remove the *_ref() functions and do something much simpler instead. The problem we have to deal with here is that VTY_GET_CONTEXT() returns a pointer to an element of ldpd_conf, and what we want is a pointer to an element of vty_conf (e.g. an l2vpn). To solve this, we just need to look for the equivalent element inside vty_conf using standard functions from ldpd like l2vpn_find() and others. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-15*: Refactor if_lookup_by_name to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-08ldpd: fix issues reported by coverity scanRenato Westphal
Fix two small memleaks in the CLI code and check the return values of getsockname() and getpeername(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-02-01ldpd: introduce advanced filtering capabilitiesRenato Westphal
This patch introduces several new configuration commands to ldpd. These commands should allow the operator to define advanced filtering policies for things like label advertisement, label allocation, etc. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03ldpd: use red-black trees to store 'l2vpn_pw' elementsRenato Westphal
Using red-black trees instead of linked lists brings the following benefits: 1 - Elements are naturally ordered (no need to reorder anything before outputting data to the user); 2 - Faster lookups/deletes: O(log n) time complexity against O(n). The insert operation with red-black trees is more expensive though, but that's not a big issue since lookups are much more frequent. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03ldpd: use red-black trees to store 'l2vpn_if' elementsRenato Westphal
Using red-black trees instead of linked lists brings the following benefits: 1 - Elements are naturally ordered (no need to reorder anything before outputting data to the user); 2 - Faster lookups/deletes: O(log n) time complexity against O(n). The insert operation with red-black trees is more expensive though, but that's not a big issue since lookups are much more frequent. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03ldpd: use red-black trees to store 'l2vpn' elementsRenato Westphal
Using red-black trees instead of linked lists brings the following benefits: 1 - Elements are naturally ordered (no need to reorder anything before outputting data to the user); 2 - Faster lookups/deletes: O(log n) time complexity against O(n). The insert operation with red-black trees is more expensive though, but that's not a big issue since lookups are much more frequent. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03ldpd: use red-black trees to store 'nbr_params' elementsRenato Westphal
Using red-black trees instead of linked lists brings the following benefits: 1 - Elements are naturally ordered (no need to reorder anything before outputting data to the user); 2 - Faster lookups/deletes: O(log n) time complexity against O(n). The insert operation with red-black trees is more expensive though, but that's not a big issue since lookups are much more frequent. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>