summaryrefslogtreecommitdiffstats
path: root/ldpd/adjacency.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>