summaryrefslogtreecommitdiff
path: root/ldpd/interface.c
AgeCommit message (Collapse)Author
2023-05-08ldpd: changes for code maintainabilitysri-mohan1
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_timer_remain_XXX to event_timer_remain_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
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>
2022-07-21ldpd: Convert thread_cancel to THREAD_OFFDonald Sharp
Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-18bgpd, ldpd: No need for an explicit NULL check for thread_timer_remain_secondDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
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>
2021-10-04ldpd: Do not explicitly set the thread pointer to NULLDonatas Abraitis
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF semantics. This is espacially true for the functions we end up calling the thread for. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-23*: unify thread/event cancel macrosMark Stapp
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>
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-03-11ldpd: During code inspection we are mixing data sizesDonald Sharp
As I understand it ldpd was originally developed as a standalone daemon for *BSD land. Then ported to FRR. FRR uses ifindex_t as the base type for the ifindex. Mixing `unsigned short` and `int` and `unsigned int` is going to lead to fun somewhere along the way. Especially when we get to run on a system with ifindex churn( I'm looking at you docker ). Attempt to convert all of ldpd to think of the ifindex as a `ifindex_t`. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-17bgpd isisd ldpd lib: const drop fixes (SA)F. Aragon
Can be detected with e.g. ./configure CFLAGS=-Wcast-qual CC=clang 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-06ldpd: sprinkle in some asserts to make scan-build happyRenato Westphal
While here, fix the other SA warnings. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-28ldpd: improve ordering of interfaces on user outputRenato Westphal
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>
2017-06-16ldpd: fix fallouts from the rb-tree conversionRenato Westphal
Signed-off-by: Renato Westphal <renato@openbsd.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-05-09*: update thread_add_* callsQuentin Young
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>
2017-05-09*: remove THREAD_ON macros, add nullity checkQuentin Young
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>
2017-05-02Merge remote-tracking branch 'origin/stable/3.0'Donald Sharp
2017-05-01Merge pull request #431 from opensourcerouting/fix-iface-renamesDonald Sharp
Fix interface renames
2017-05-01ldpd: respect link-detect configurationRenato Westphal
We shouldn't check the operational status of an interface in ldpd if it's configured with "no link-detect" in zebra. That's what all the other routing daemons do. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-01ldpd: fixes to handle interface renames properlyRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26ldpd: fix bug when changing the transport addressRenato Westphal
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>
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-15ldpd: Move if_update to ldp_if_updateDonald Sharp
The if_update function should be owned by lib/if.h. Move the function out of the way so we can rename lib/if.h if_update_vrf -> if_update Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-03ldpd: use red-black trees to store 'adj' 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 'iface' 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>
2016-09-23ldpd: adapt the code for QuaggaRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23ldpd: copy original sources from OpenBSD (14/09/2016)Renato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>