summaryrefslogtreecommitdiffstats
path: root/ldpd/ldpd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-2/+2
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-10/+10
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-2/+2
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-15/+15
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-7/+7
| | | | | | | | | 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>
* Merge pull request #12851 from sri-mohan1/sri-mohan-ldpRuss White2023-02-211-53/+97
|\ | | | | ldpd: changes for code maintainability
| * ldpd: changes for code maintainabilitysri-mohan12023-02-201-53/+97
| | | | | | | | | | | | these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* | *: 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-7/+7
| | | | | | Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of intefaceDonald Sharp2022-04-191-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-21/+9
| | | | | | | 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>
* *: rework renaming the default VRFIgor Ryzhov2021-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: Convert quagga_signal_X to frr_signal_XDonald Sharp2021-11-111-1/+1
| | | | | | | Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: don't pass pointers to a local variables to thread_add_*Igor Ryzhov2021-10-071-2/+1
| | | | | | | | We should never pass pointers to local variables to thread_add_* family. When an event is executed, the library writes into this pointer, which means it writes into some random memory on a stack. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* ldpd: Do not explicitly set the thread pointer to NULLDonatas Abraitis2021-10-041-4/+0
| | | | | | | | 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>
* lib/module.c and callers of frrmod_load(): fix error messagesG. Paul Ziemba2021-09-141-2/+1
| | | | | | | | | | | | | | | | | frrmod_load() attempts to dlopen() several possible paths (constructed from its basename argument) until one succeeds. Each dlopen() attempt may fail for a different reason, and the important one might not be the last one. Example: dlopen(a/foo): file not found dlopen(b/foo): symbol "bar" missing dlopen(c/foo): file not found Previous code reported only the most recent error. Now frrmod_load() describes each dlopen() failure. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
* *: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis2021-08-251-1/+0
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* ldpd: make allowing broken-lsps to be installed with pop operation configurablelynne2021-05-031-0/+10
| | | | | | | | | | | 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>
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+1
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_QOBJ & co.David Lamparter2021-03-171-7/+7
| | | | | | Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_HOOK & co.David Lamparter2021-03-171-1/+1
| | | | | | See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
* ldpd: Add support for read-only snmp mib objects (excluding statistics)Karen Schoener2021-02-241-2/+27
| | | | | | | | Add support for read-only snmp mib objects as described in RFC 3815, excluding statistics. Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
* ldpd: add support for RLFA clientsRenato Westphal2021-01-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+7
| | | | | | | | | 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>
* Merge pull request #6789 from volta-networks/feat_ldp_igp_syncRenato Westphal2020-09-111-0/+17
|\ | | | | ldpd: Add support for LDP-IGP Synchronization
| * ldpd: Adding support for LDP IGP SynchronizationKaren Schoener2020-09-091-0/+17
| | | | | | | | | | Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
* | ldpd: Fix issue when starting up LDP with no configuration.lynne2020-09-041-1/+42
|/ | | | | | | | LDP would mark all routes as learned on a non-ldp interface. Then when LDP was configured the labels were not updated correctly. This commit fixes issues 6841 and 6842. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
* *: un-split strings across linesDavid Lamparter2020-07-141-10/+5
| | | | | | | | | | | | | | | | | 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>
* ldpd: clean up temp zlog filesMark Stapp2020-06-221-1/+2
| | | | | | | | | Clean up the temp zlog dirs in /var/tmp/frr/ that the ldpd child processes were leaving. The child processes do a non- standard lib init/deinit, so they need to explicitly deinit the zlog module. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: integrate remaining daemons with filterRafael Zalamena2020-06-051-0/+1
| | | | | | | Don't crash when trying to `show running-config` because of missing filter northbound integration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* Merge pull request #6241 from volta-networks/fix_ldp_aclRenato Westphal2020-04-301-3/+2
|\ | | | | ldpd: fix ACL rule modification
| * ldpd: fix ACL rule modificationlynne2020-04-291-3/+2
| | | | | | | | | | | | | | | | | | | | | | 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: use a timer instead of sleeping in LM initMark Stapp2020-04-231-3/+0
| | | | | | | | | | | | | | | | | | | | | | Stop sleeping if synchronous label-manager zapi session has trouble during init: retry using a timer instead. Move initial label-block request to a point where the LM zapi session is known to be running. Remove the use of the daemon 'instance' - we're using the session_id to distinguish the LM zapi session. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | Merge pull request #6247 from FRRouting/nb_conversionsDonald Sharp2020-04-171-0/+1
|\ \ | | | | | | Merge nb_converions branch to master
| * | *: include vrf northbound module in initChirag Shah2020-04-161-0/+1
| |/ | | | | | | Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
* | Merge pull request #5451 from opensourcerouting/rcu-logSantosh P K2020-04-161-4/+15
|\ \ | |/ |/| logging subsystem rewrite
| * lib: rewrite zlog lock-free & TLS-bufferedDavid Lamparter2020-04-011-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a full rewrite of the "back end" logging code. It now uses a lock-free list to iterate over logging targets, and the targets themselves are as lock-free as possible. (syslog() may have a hidden internal mutex in the C library; the file/fd targets use a single write() call which should ensure atomicity kernel-side.) Note that some functionality is lost in this patch: - Solaris printstack() backtraces are ditched (unlikely to come back) - the `log-filter` machinery is gone (re-added in followup commit) - `terminal monitor` is temporarily stubbed out. The old code had a race condition with VTYs going away. It'll likely come back rewritten and with vtysh support. - The `zebra_ext_log` hook is gone. Instead, it's now much easier to add a "proper" logging target. v2: TLS buffer to get some actual performance Signed-off-by: David Lamparter <equinox@diac24.net>
* | ldpd: fixing host-only configuration filter.lynne2020-04-011-0/+13
|/ | | | | | | | | | | There is configuration in LDP to only create labels for host-routes. If the user remove this configuration the code was not readvertising non-host routes to it's LDP neighbors. The issue is the same in reverse also. If the user adds this configuration on an active LDP session the non-host routes were not withdrawn. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
* Merge pull request #5851 from volta-networks/feat_ldp_oc_reviewRenato Westphal2020-03-231-0/+8
|\ | | | | ldpd: adding support for LDP ordered label distribution control
| * ldpd: adding support for LDP ordered label distribution controlKaren Schoener2020-03-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ldpd: fix another linking issue with GCC-10Ruben Kerkhof2020-03-081-0/+2
| | | | | | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* | ldpd: Remove double set of lifDonald Sharp2020-03-031-1/+1
| | | | | | | | | | | | | | | | The lif variable was being set in the if statement and immediately copied into from xf. No need to do this twice. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | ldpd: Cleanup indentation in merge_nbrpsDonald Sharp2020-02-271-21/+23
| | | | | | | | | | | | | | We had a very deeply nested function, reduce the indentation for easier reading. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | ldpd: Cleanup set but unused variablesDonald Sharp2020-02-271-9/+8
|/ | | | | | There existed some variables set but never used. Clean this up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: generously apply constDavid Lamparter2019-12-021-1/+1
| | | | | | const const const your boat, merrily down the stream... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: make frr_yang_module_info constDavid Lamparter2019-11-301-1/+1
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* ldpd: set default instance to 1Emanuele Di Pascale2019-07-101-0/+3
| | | | | | | | | | | | | LDP opens two sockets to zebra, one through ldpd (always using instance 0) and another through lde (using whatever instance was set through the -n command line parameter). If no instance was set, both connections would use the same protocol and instance, making it impossible to distinguish them through zserv_find_client. This meant that a response to a lm connect would erroneously go to the wrong process. Fix this by having a default instance value of 1, in case the user does not specify a different one. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
* ldpd: Fix shutdowndturlupov2019-06-111-1/+1
| | | | | | | When we stopped ldpd, we get fatal error message from wait(). This commit fix it. Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
* ldpd: Allow for -N <namespace> to influence location of LDPD_SOCKETDonald Sharp2019-06-041-1/+10
| | | | | | | | | | | | If --ctl_socket is used this will override any other option and will be used If -N <namespace> is used, then we will setup the LDPD_SOCKET in $frr_statedir/<namespace>/ldpd.sock If neither option is used, then we will use $frr_statedir/ldpd.sock Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: remove the configuration lock from all daemonsRenato Westphal2018-11-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | A while ago all FRR configuration commands were converted to use the QOBJ infrastructure to keep track of configuration objects. This means the configuration lock isn't necessary anymore because the QOBJ code detects when someones tries to edit a configuration object that was deleted and react accordingly (log an error and abort the command). The possibility of accessing dangling pointers doesn't exist anymore since vty->index was removed. Summary of the changes: * remove the configuration lock and the vty_config_lockless() function. * rename vty_config_unlock() to vty_config_exit() since we need to clean up a few things when exiting from the configuration mode. * rename vty_config_lock() to vty_config_enter() to remove code duplication that existed between the three different "configuration" commands (terminal, private and exclusive). Configuration commands converted to the new northbound model don't need the configuration lock either since the northbound API also detects when someone tries to edit a configuration object that doesn't exist anymore. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>