summaryrefslogtreecommitdiffstats
path: root/ldpd/ldp_zebra.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: convert `struct interface->connected` to DLISTDavid Lamparter2023-11-221-5/+3
| | | | | | | | | | | | | | | | | Replace `struct list *` with `DLIST(if_connected, ...)`. NB: while converting this, I found multiple places using connected prefixes assuming they were IPv4 without checking: - vrrpd/vrrp.c: vrrp_socket() - zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(), irdp_advert_off() (these fixes are really hard to split off into separate commits as that would require going back and reapplying the change but with the old list handling) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: convert if_zapi_callbacks into actual hooksDavid Lamparter2023-11-031-1/+4
| | | | | | | | | ...so that multiple functions can be subscribed. The create/destroy hooks are renamed to real/unreal because that's what they *actually* signal. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ldpd: Stop and free synchronous Zebra client on destroyDonatas Abraitis2023-06-271-0/+7
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* ldpd: changes for code maintainabilitysri-mohan12023-06-051-10/+5
| | | | | | these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* Merge pull request #13113 from sri-mohan1/sri-mohan-ldpDonatas Abraitis2023-03-281-22/+15
|\ | | | | ldpd: changes for code maintainability
| * ldpd: changes for code maintainabilitysri-mohan12023-03-271-22/+15
| | | | | | | | | | | | these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* | *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-1/+1
| | | | | | | | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-2/+1
| | | | | | | | | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-15/+1
| | | | | | | | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | ldpd: Add missing enum's to switch statementDonald Sharp2023-01-311-1/+1
|/ | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: convert zclient callbacks to tableDavid Lamparter2021-10-201-8/+12
| | | | | | | | | | | | | This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ldpd: make allowing broken-lsps to be installed with pop operation configurablelynne2021-05-031-2/+7
| | | | | | | | | | | 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>
* Merge pull request #8471 from idryzhov/cleanup-num-named-listsDonatas Abraitis2021-04-281-3/+2
|\ | | | | *: cleanup number-named access-lists and prefix-lists
| * *: cleanup number-named access-lists and prefix-listsIgor Ryzhov2021-04-141-3/+2
| | | | | | | | | | | | | | | | A long time ago there was a difference between number-named and string-named access/prefix-lists. Currently we always treat the name as a string and there is no need for a separate list for number-named lists. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | ldpd: defer register for info until configuredFredi Raspall2021-04-261-5/+34
|/ | | | | | | | | | | 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>
* ldpd: add support for RLFA clientsRenato Westphal2021-01-091-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an API that allows IGP client daemons to register/unregister RLFAs with ldpd. IGP daemons need to be able to query the LDP labels needed by RLFAs and monitor label updates that might affect those RLFAs. This is similar to the NHT mechanism used by bgpd to resolve and monitor recursive nexthops. This API is based on the following ZAPI opaque messages: * LDP_RLFA_REGISTER: used by IGP daemons to register an RLFA with ldpd. * LDP_RLFA_UNREGISTER_ALL: used by IGP daemons to unregister all of their RLFAs with ldpd. * LDP_RLFA_LABELS: used by ldpd to send RLFA labels to the registered clients. For each RLFA, ldpd needs to return the following labels: * Outer label(s): the labels advertised by the adjacent routers to reach the PQ node; * Inner label: the label advertised by the PQ node to reach the RLFA destination. For the inner label, ldpd automatically establishes a targeted neighborship with the PQ node if one doesn't already exist. For that to work, the PQ node needs to be configured to accept targeted hello messages. If that doesn't happen, ldpd doesn't send a response to the IGP client daemon which in turn won't be able to activate the previously computed RLFA. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd, isisd, ospfd: Remove periodic ldp-sync hello messageKaren Schoener2020-12-091-30/+0
| | | | | | | | | | | Removing the obsolete ldp-sync periodic 'hello' message. When ldp-sync is configured, IGPs take action if the LDP process goes down. The IGPs have been updated to use the zapi client close callback to detect the LDP process going down. Signed-off-by: Karen Schoener <karen@voltanet.io>
* *: Convert all usage of zclient_send_message to new enumDonald Sharp2020-11-151-9/+24
| | | | | | | | | The `enum zclient_send_status` enum needs to be extended throughout the code base to use the new states and to fix up places where we tested against the return value being non zero. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ldpd: replace inet_ntoaMark Stapp2020-10-221-1/+1
| | | | | | Replace all use of inet_ntoa; use pI4 or inet_ntop instead. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* ldpd: Adding support for LDP IGP SynchronizationKaren Schoener2020-09-091-3/+107
| | | | | Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
* ldpd: Relay data plane pseudowire status in LDP notificationKaren Schoener2020-06-011-2/+3
| | | | | | | | | | | | | Provide a way for the data plane to indicate pseudowire status (such as: not forwarding, AC failure). On a data plane pseudowire install failure, data plane sets the pseudowire status. Zebra relays the pseudowire status to LDP. LDP includes the pseudowire status in the LDP notification to the LDP peer. Signed-off-by: Karen Schoener <karen@voltanet.io>
* Merge pull request #6241 from volta-networks/fix_ldp_aclRenato Westphal2020-04-301-0/+21
|\ | | | | ldpd: fix ACL rule modification
| * ldpd: fix ACL rule modificationlynne2020-04-291-0/+21
| | | | | | | | | | | | | | | | | | | | | | Changes to ACL rules were not applied to LDP. This fix allows LDP to be notified when a rule in an ACL filter is modified by the user. The filter is properly applied to the LDP session. The filter may cause a LDP session to go down/up or to remove/add labels being advertised/received from a neighbor. Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
* | ldpd: don't drop packets coming through a broken LSPRenato Westphal2020-04-081-16/+26
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | When the Independent Control mode is in use (the default one), each LDP speaker allocates labels independently, which can lead to broken LSPs when the LDP and IGP domains are not congruent. What we were doing in this case was to drop all packets coming through a broken LSP, which causes drastic side effects in the network like loss of IP connectivity between routers. We can however do a best-effort attempt to avoid packet loss by popping the top-level label of the incoming packets and forwarding them normally to their nexthops. This will be enough to guarantee that labeled IP packets will reach their final destination. The broken LSPs will still be unsuitable to tunnel labeled traffic, like VPN packets, but in this case there's nothing we can do about it. Cisco's IOS does something similar, called the "Untagged/No Label" operation, which removes the entire label stack and forward the packet unlabeled. We don't have such functionality available in the Linux kernel, but this shouldn't make any difference for practical purposes. Fixes #6127. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: encode zapi labels message using nexthopsMark Stapp2020-02-141-6/+5
| | | | | | | | Use the zapi_nexthop struct with the mpls_labels zapi messages instead of the special-purpose (and more limited) nexthop struct that was being used. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: Convert connected_free to a double pointerDonald Sharp2019-11-021-1/+1
| | | | | | Set the connected pointer to set the pointer to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert zapi->interface_delete to ifp callbackDonald Sharp2019-09-191-18/+1
| | | | | | | Convert the callback of the interface_delete to the new ifp callback. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert interface_down to interface down callbackDonald Sharp2019-09-191-23/+6
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert from ->interface_up to the interface callbackDonald Sharp2019-09-191-12/+17
| | | | | | | For all the places we have a zclient->interface_up convert them to use the interface ifp_up callback instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Switch all zclient->interface_add to interface create callbackDonald Sharp2019-09-191-11/+2
| | | | | | | Switch the zclient->interface_add functionality to have everyone use the interface create callback in lib/if.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Add infrastructure to support zapi interface callbacksDonald Sharp2019-09-191-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Start the conversion to allow zapi interface callbacks to be controlled like vrf creation/destruction/change callbacks. This will allow us to consolidate control into the interface.c instead of having each daemon read the stream and react accordingly. This will hopefully reduce a bunch of cut-n-paste stuff Create 4 new callback functions that will be controlled by lib/if.c create -> A upper level protocol receives an interface creation event The ifp is brand spanking newly created in the system. up -> A upper level protocol receives a interface up event This means the interface is up and ready to go. down -> A upper level protocol receives a interface down destroy -> A upper level protocol receives a destroy event This means to delete the pointers associated with it. At this point this is just boilerplate setup for future commits. There is no new functionality. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: add new MPLS zapi message with route replace semanticsRenato Westphal2019-09-101-10/+13
| | | | | | | This new message makes it possible to install/reinstall LSPs with multiple nexthops using a single ZAPI message. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib, zebra: enhance the MPLS zapi messagesRenato Westphal2019-09-071-12/+35
| | | | | | | | | | * Add ability to specify the nexthop type; * Add ability to install or not a FTN (in addition to an LSP). These two additions will be useful to install local SR Prefix-SIDs configured with the no-PHP option. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: identify MPLS FTNs by route type and instanceRenato Westphal2019-09-071-2/+4
| | | | | | | | | Use the route type and instance instead of the route distance to identify MPLS FTNs. This is a more robust approach since the routing daemons can modify the distance of their announced routes via configuration, which can cause inconsistencies. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: introduce encode/decode functions for the MPLS zapi messagesRenato Westphal2019-09-071-26/+17
| | | | | | | | | Do this for the following reasons: * Improve modularity of the code by separating the decoding of the ZAPI messages from their processing; * Create an API that is easier to use by the client daemons. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: use ZAPI_CALLBACK_ARGS macro for zapi handlersQuentin Young2019-05-031-36/+20
| | | | | | | | | | | | This macro: - Marks ZAPI callbacks for readability - Standardizes argument names - Makes it simple to add ZAPI arguments in the future - Ensures proper types - Looks better - Shortens function declarations Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Replace zclient_new with zclient_new_notifyDonald Sharp2018-11-121-1/+1
| | | | | | | It's been a year since we added the new optional parameters to instantiation. Let's switch over to the new name. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ldpd: improve processing of redistributed routesRenato Westphal2017-11-291-6/+26
| | | | | | | ldpd should ignore blackhole routes and any other route that doesn't have a nexthop address (connected routes being an exception). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: Make zapi route install Notifications optionalDonald Sharp2017-11-271-1/+1
| | | | | | | | | | | Allow the higher level protocol to specify if it would like to receive notifications about it's routes that it has installed. I've purposely made it part of zclient_new_notify because we need to track the routes on a per daemon basis only. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Modify zclient_init to require privs dataDonald Sharp2017-10-241-1/+3
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use the FOR_ALL_INTERFACES abstraction from babeldRenato Westphal2017-10-101-1/+1
| | | | | | | | | | This improves code readability and also future-proofs our codebase against new changes in the data structure used to store interfaces. The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but for now only babeld is using it. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: introduce new rb-tree to optimize interface lookup by ifindexRenato Westphal2017-10-101-1/+1
| | | | | | | | | | | | | | | | Performance tests showed that, when running on a system with a large number of interfaces, some daemons would spend a considerable amount of time in the if_lookup_by_index() function. Introduce a new rb-tree to solve this problem. With this change, we need to use the if_set_index() function whenever we want to change the ifindex of an interface. This is necessary to ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The return value of all insert/remove operations in the interface rb-trees is checked to ensure that an error is logged if a corruption is detected. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: eliminate IFINDEX_DELETED in favor of IFINDEX_INTERNALRenato Westphal2017-10-101-1/+1
| | | | | | | | | IFINDEX_DELETED is not necessary anymore as we moved from a global list of interfaces to a list of interfaces per VRF. This reverts commit 84361d615. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: use rb-trees to store interfaces instead of sorted linked-listsRenato Westphal2017-10-101-2/+3
| | | | | | | | | | | This is an important optimization for users running FRR on systems with a large number of interfaces (e.g. thousands of tunnels). Red-black trees scale much better than sorted linked-lists and also store the elements in an ordered way (contrary to hash tables). This is a big patch but the interesting bits are all in lib/if.[ch]. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: use zapi_route to send/receive redistributed routes as wellRenato Westphal2017-08-241-70/+36
| | | | | | | | | | | | | | | | | | Some differences compared to the old API: * Now the redistributed routes are sent using address-family independent messages (ZEBRA_REDISTRIBUTE_ROUTE_ADD and ZEBRA_REDISTRIBUTE_ROUTE_DEL). This allows us to unify the ipv4/ipv6 zclient callbacks in the client daemons and thus remove a lot of duplicate code; * Now zebra sends all nexthops of the redistributed routes to the client daemons, not only the first one. This shouldn't have any noticeable performance implications and will allow us to remove an ugly exception we had for ldpd (which needs to know all nexthops of the redistributed routes). The other client daemons can simply ignore the nexthops if they want or consult just the first one (e.g. ospfd/ospf6d/ripd/ripngd). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* babeld/eigrpd/ldpd/nhrpd: add prefix length sanity checksRenato Westphal2017-08-231-1/+2
| | | | | | Pulled from d917882. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: integrate with the pseudowire manager in zebraRenato Westphal2017-08-091-6/+70
| | | | | | | | | If we receive a notification from zebra indicating that the installation of a pseudowire has failed (e.g. no reachability), send a PW Status notification to the remote peer (or a Label Withdraw if the remote peer doesn't support the PW Status TLV). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: Switch to using ETH_ALENDonald Sharp2017-08-041-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ldpd: update copyright informationRenato Westphal2017-06-161-10/+9
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>