summaryrefslogtreecommitdiffstats
path: root/ldpd/adjacency.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-12/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ldpd: Convert thread_cancel to THREAD_OFFDonald Sharp2022-07-211-4/+4
| | | | | | Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd, ldpd: No need for an explicit NULL check for thread_timer_remain_secondDonatas Abraitis2022-07-181-3/+1
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* ldpd: Check if the thread is scheduled before calling for remained timeDonatas Abraitis2022-07-181-1/+3
| | | | | | | | | | | | | | | | | | | LDPD crashes when hold time is configured to 65535: (gdb) bt 0 0x00007f8c3fc224bb in raise () from /lib64/libpthread.so.0 1 0x00007f8c4138a3dd in core_handler () from /lib64/libfrr.so.0 2 <signal handler called> 3 0x00007f8c3fc1ccc0 in pthread_mutex_lock () from /lib64/libpthread.so.0 4 0x00007f8c4139914b in thread_timer_remain_msec () from /lib64/libfrr.so.0 5 0x00007f8c41399209 in thread_timer_remain_second () from /lib64/libfrr.so.0 6 0x000000000040eb19 in adj_to_ctl () 7 0x0000000000427b38 in ldpe_nbr_ctl () 8 0x000000000042fd68 in control_dispatch_imsg () 9 0x00007f8c4139a628 in thread_call () from /lib64/libfrr.so.0 10 0x00000000004265fc in ldpe () 11 0x000000000040a68f in main () Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-11/+5
| | | | | | | The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ldpd: add support for RLFA clientsRenato Westphal2021-01-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: unify thread/event cancel macrosMark Stapp2020-10-231-4/+4
| | | | | | | | | Replace all lib/thread cancel macros, use thread_cancel() everywhere. Only the THREAD_OFF macro and thread_cancel() api are supported. Also adjust thread_cancel_async() to NULL caller's pointer (if present). Signed-off-by: Mark Stapp <mjs@voltanet.io>
* ldpd: replace inet_ntoaMark Stapp2020-10-221-3/+3
| | | | | | 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-0/+3
| | | | | Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
* bgpd isisd ldpd lib: const drop fixes (SA)F. Aragon2018-09-171-4/+4
| | | | | | Can be detected with e.g. ./configure CFLAGS=-Wcast-qual CC=clang Signed-off-by: F. Aragon <paco@voltanet.io>
* ldpd: improve ordering of interfaces on user outputRenato Westphal2017-09-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: debian# show mpls ldp interface AF Interface State Uptime Hello Timers ac ipv4 rt0-eth0 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth1 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth10 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth11 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth2 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth3 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth4 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth5 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth6 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth7 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth8 ACTIVE 00:00:05 5/15 1 ipv4 rt0-eth9 ACTIVE 00:00:05 5/15 1 After: debian# show mpls ldp interface AF Interface State Uptime Hello Timers ac ipv4 rt0-eth0 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth1 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth2 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth3 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth4 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth5 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth6 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth7 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth8 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth9 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth10 ACTIVE 00:00:14 5/15 1 ipv4 rt0-eth11 ACTIVE 00:00:14 5/15 1 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge remote-tracking branch 'origin/stable/3.0'Donald Sharp2017-06-291-16/+6
|\
| * ldpd: fix issues with dual-stack adjacenciesRenato Westphal2017-06-131-16/+6
| | | | | | | | | | | | | | | | Handling configuration changes from single-stack mode to dual-stack mode (and vice-versa) is tricky. This patch attempts to solve all issues that might happen on such circumstances. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ldpd: fix bug when changing the transport addressRenato Westphal2017-06-051-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | When the transport address is changed, all interfaces and targeted neighbors are temporary disabled in the ldpe process until new sockets bound to the new transport address are received from the parent. This patch fixes a problem in which adjacencies weren't being removed after the associated targeted neighbors were disabled. This was causing ldpd not to set some MD5 sockoptions for new neighbors are thus preventing MD5-protected sessions to come up after a change in the transport-address. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | ldpd: fix fallouts from the rb-tree conversionRenato Westphal2017-06-161-1/+1
| | | | | | | | Signed-off-by: Renato Westphal <renato@openbsd.org>
* | lib: improve the RB implementationRafael Zalamena2017-06-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | *: update thread_add_* callsQuentin Young2017-05-091-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | Pass pointer to pointer instead of assigning by return value. See previous commit message. To ensure that the behavior stays functionally correct, any assignments with the result of a thread_add* function have been transformed to set the pointer to null before passing it. These can be removed wherever the pointer is known to already be null. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | *: remove THREAD_ON macros, add nullity checkQuentin Young2017-05-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ldpd: fix bug when changing the transport addressRenato Westphal2017-04-261-9/+22
|/ | | | | | | | | | | | | When the transport address is changed, all interfaces and targeted neighbors are temporary disabled in the ldpe process until new sockets bound to the new transport address are received from the parent. This patch fixes a problem in which adjacencies weren't being removed after the associated targeted neighbors were disabled. This was causing ldpd not to set some MD5 sockoptions for new neighbors are thus preventing MD5-protected sessions to come up after a change in the transport-address. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: provide more detailed information in some show commandsRenato Westphal2017-03-211-0/+4
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: change the sorting algorithm of adjacenciesRenato Westphal2017-03-211-10/+13
| | | | | | | | | | | | | | | | | | | Now the "show mpls ldp discovery" command will display all LDP adjancencies sorted by address family, neighbor ID and then type (link or targeted). Example: vtysh# show mpls ldp discovery AF ID Type Source Holdtime ipv4 3.3.3.3 Link rt2-eth1 15 ipv4 3.3.3.3 Link rt2-eth2 15 ipv4 4.4.4.4 Link rt2-eth1 15 ipv6 1.1.1.1 Link rt2-eth0 15 ipv6 3.3.3.3 Link rt2-eth1 15 ipv6 3.3.3.3 Link rt2-eth2 15 ipv6 4.4.4.4 Link rt2-eth1 15 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: use red-black trees to store 'adj' elementsRenato Westphal2017-01-041-31/+49
| | | | | | | | | | | | | 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>
* ldpd: use red-black trees to store 'tnbr' elementsRenato Westphal2017-01-041-15/+25
| | | | | | | | | | | | | 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>
* ldpd: allow multiple link adjacencies with unnumbered interfacesRenato Westphal2016-12-211-0/+4
| | | | | | | | Now we can have two different adjacencies coming from the same source address. Check for the adjacency's interface on adj_find() to disambiguate them. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: adapt the code for QuaggaRenato Westphal2016-09-231-39/+45
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ldpd: copy original sources from OpenBSD (14/09/2016)Renato Westphal2016-09-231-0/+346
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>