summaryrefslogtreecommitdiffstats
path: root/ldpd/lde.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: add `zclient_options_sync`David Lamparter2023-11-231-5/+1
| | | | | | | | ... and use it instead of fiddling with the `.synchronous` field. (Make it const while at it.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ldpd: Stop and free synchronous Zebra client on destroyDonatas Abraitis2023-06-271-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-6/+6
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_fetch and thread_call to event_fetch and event_callDonald Sharp2023-03-241-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-5/+5
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-6/+6
| | | | | | | | | 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 #12863 from sri-mohan1/sri-mohan-ldpDonald Sharp2023-02-221-127/+103
|\ | | | | ldpd: changes for code maintainability
| * ldpd: changes for code maintainabilitysri-mohan12023-02-221-127/+103
| | | | | | | | | | | | 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: Add missing enum's to switch statementDonald Sharp2023-01-311-5/+5
|/ | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* 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>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-13/+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>
* *: 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>
* *: convert zclient callbacks to tableDavid Lamparter2021-10-201-1/+1
| | | | | | | | | | | | | 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: Do not explicitly set the thread pointer to NULLDonatas Abraitis2021-10-041-2/+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>
* *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-2/+2
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-2/+2
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* ldpd: make allowing broken-lsps to be installed with pop operation configurablelynne2021-05-031-0/+24
| | | | | | | | | | | 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>
* ldpd: set `frr_is_after_fork` in lde/ldpeDavid Lamparter2021-04-231-0/+2
| | | | | | | | These subprocesses don't use frr_config_fork(), so frr_is_after_fork is never set. While the frr_pthread stuff isn't currently used there, set the flag anyway to avoid future headaches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ldpd: Add support for read-only snmp mib objects (excluding statistics)Karen Schoener2021-02-241-4/+8
| | | | | | | | 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/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Prevent usage after freeDonald Sharp2020-11-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are using data after it has been freed and handed back to the OS. Address Sanitizer output: error 23-Nov-2020 18:53:57 ERROR: AddressSanitizer: heap-use-after-free on address 0x631000024838 at pc 0x55f825998f58 bp 0x7fffa5b0f5b0 sp 0x7fffa5b0f5a0 error 23-Nov-2020 18:53:57 READ of size 4 at 0x631000024838 thread T0 error 23-Nov-2020 18:53:57 #0 0x55f825998f57 in lde_imsg_compose_parent_sync ldpd/lde.c:226 error 23-Nov-2020 18:53:57 #1 0x55f8259ca9ed in vlog ldpd/log.c:48 error 23-Nov-2020 18:53:57 #2 0x55f8259cb1c8 in log_info ldpd/log.c:102 error 23-Nov-2020 18:53:57 #3 0x55f82599e841 in lde_shutdown ldpd/lde.c:208 error 23-Nov-2020 18:53:57 #4 0x55f8259a2703 in lde_dispatch_parent ldpd/lde.c:666 error 23-Nov-2020 18:53:57 #5 0x55f825ac3815 in thread_call lib/thread.c:1681 error 23-Nov-2020 18:53:57 #6 0x55f825998d5e in lde ldpd/lde.c:160 error 23-Nov-2020 18:53:57 #7 0x55f82598a289 in main ldpd/ldpd.c:320 error 23-Nov-2020 18:53:57 #8 0x7fe3f749db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) error 23-Nov-2020 18:53:57 #9 0x55f825982579 in _start (/usr/lib/frr/ldpd+0xb3579) error 23-Nov-2020 18:53:57 error 23-Nov-2020 18:53:57 0x631000024838 is located 65592 bytes inside of 65632-byte region [0x631000014800,0x631000024860) error 23-Nov-2020 18:53:57 freed by thread T0 here: error 23-Nov-2020 18:53:57 #0 0x7fe3f8a4d7a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8) error 23-Nov-2020 18:53:57 #1 0x55f82599e830 in lde_shutdown ldpd/lde.c:206 error 23-Nov-2020 18:53:57 #2 0x55f8259a2703 in lde_dispatch_parent ldpd/lde.c:666 error 23-Nov-2020 18:53:57 #3 0x55f825ac3815 in thread_call lib/thread.c:1681 error 23-Nov-2020 18:53:57 #4 0x55f825998d5e in lde ldpd/lde.c:160 error 23-Nov-2020 18:53:57 #5 0x55f82598a289 in main ldpd/ldpd.c:320 error 23-Nov-2020 18:53:57 #6 0x7fe3f749db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) error 23-Nov-2020 18:53:57 error 23-Nov-2020 18:53:57 previously allocated by thread T0 here: error 23-Nov-2020 18:53:57 #0 0x7fe3f8a4dd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) error 23-Nov-2020 18:53:57 #1 0x55f825998cb7 in lde ldpd/lde.c:151 error 23-Nov-2020 18:53:57 #2 0x55f82598a289 in main ldpd/ldpd.c:320 error 23-Nov-2020 18:53:57 #3 0x7fe3f749db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) error 23-Nov-2020 18:53:57 The fix is to put this in global space. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert all usage of zclient_send_message to new enumDonald Sharp2020-11-151-1/+1
| | | | | | | | | 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>
* *: 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: Fix issue when starting up LDP with no configuration.lynne2020-09-041-1/+157
| | | | | | | | 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>
* ldpd: process pw-status in received orderKaren Schoener2020-07-201-1/+1
| | | | | | | | Update LDP to process received pw-status in received order. Update LDP to save pw-status regardless of whether the PW is configured. When the PW is configured, LDP checks for any saved PW pw-status. Signed-off-by: Karen Schoener <karen@voltanet.io>
* *: un-split strings across linesDavid Lamparter2020-07-141-12/+6
| | | | | | | | | | | | | | | | | 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-0/+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>
* ldpd and Zebra: Expand existing debug commands.lynne2020-05-111-2/+3
| | | | | | | | | | | | L2VPN PW are very hard to determine why they do not come up. The following fixes expand the existing show commands in ldp and zebra to display a reason why the PW is in the DOWN state and also display the labeled nexthop route selected to reach the PW peer. By adding this information it will provide the user some guidance on how to debug the PW issue. Also fixed an assert if labels were changed for a PW that is between directly connected peers. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
* Merge pull request #6241 from volta-networks/fix_ldp_aclRenato Westphal2020-04-301-2/+329
|\ | | | | ldpd: fix ACL rule modification
| * ldpd: fix ACL rule modificationlynne2020-04-291-2/+329
| | | | | | | | | | | | | | | | | | | | | | 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-11/+40
| | | | | | | | | | | | | | | | | | | | | | 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>
* | zebra,ldpd: use zapi client session id in LM apisMark Stapp2020-04-161-0/+1
|/ | | | | | | | Use the zapi client session id in the label manager apis; use the client struct directly in some code. Assign a session id to ldpd's sync LM zapi session. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* Merge pull request #6109 from volta-networks/feat_ldp_host_onlyRenato Westphal2020-04-021-0/+50
|\ | | | | ldpd: host only filter
| * ldpd: fixing host-only configuration filter.lynne2020-04-011-0/+50
| | | | | | | | | | | | | | | | | | | | | | 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 #5925 from volta-networks/synchronous_clientRenato Westphal2020-03-261-1/+10
|\ \ | |/ |/| zebra: synchronous client queues accumulate messages from zebra
| * zebra: Synchronous client queues accumulate messages from zebra.Karen Schoener2020-03-231-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zebra is currently sending messages on interface add/delete/update, VRF add/delete, and interface address change - regardless of whether its clients had requested them. This is problematic for lde and isis, which only listens to label chunk messages, and only when it is waiting for one (synchronous client). The effect is the that messages accumulate on the lde synchronous message queue. With this change: - Zebra does not send unsolicited messages to synchronous clients. - Synchronous clients send a ZEBRA_HELLO to zebra. The ZEBRA_HELLO contains a new boolean field: sychronous. - LDP and PIM have been updated to send a ZEBRA_HELLO for their synchronous clients. Signed-off-by: Karen Schoener <karen@voltanet.io>
* | Merge pull request #5851 from volta-networks/feat_ldp_oc_reviewRenato Westphal2020-03-231-10/+80
|\ \ | | | | | | ldpd: adding support for LDP ordered label distribution control
| * | ldpd: adding support for LDP ordered label distribution controlKaren Schoener2020-03-201-10/+80
| |/ | | | | | | | | | | | | | | | | | | | | | | 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: remove multiple definitions of thread_masterRuben Kerkhof2020-03-081-3/+0
|/ | | | | | This fixes the last issue compiling FRR with GCC 10 on Fedora Rawhide. Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* zebra: identify MPLS FTNs by route type and instanceRenato Westphal2019-09-071-5/+10
| | | | | | | | | 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>
* ldpd: Fix to release MPLS label if its not used anymoreBinu Abraham2019-07-151-0/+39
| | | | | | LDP should release labels allocated from zebra if its not getting used. Signed-off-by: Binu <binu_abraham@looptelecom.com>
* lib, zebra: support label chunk requests for SRGBEmanuele Di Pascale2019-07-101-1/+2
| | | | | | | | | | | | | | | | For SRGB, we need to support chunk requests starting at a specific point in the label space, rather than just asking for any sufficiently large chunk. To this purpose, we extend the label manager api to request a chunk with a base value; if the base is set to 0, the label manager will behave as it currently does, i.e. fetching the first free chunk big enough to satisfy the request. update all the existing calls to get chunks from the label manager so that they use MPLS_LABEL_BASE_ANY as the base for the requested chunk Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
* *: 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>
* bgpd, doc, ldpd, lib, tests, zebra: LM fixespaco2018-09-181-1/+1
| | | | | | | | | | | | | Corrections so that the BGP daemon can work with the label manager properly through a label-manager proxy. Details: - Correction so the BGP daemon behind a proxy label manager gets the range correctly (-I added to the BGP daemon, to set the daemon instance id) - For the BGP case, added an asynchronous label manager connect command so the labels get recycled in case of a BGP daemon reconnection. With this, BGPd and LDPd would behave similarly. Signed-off-by: F. Aragon <paco@voltanet.io>
* lib, ldpd: fix SA warnings from TAILQ oddnessDavid Lamparter2018-09-081-3/+1
| | | | | | | Add a TAILQ_POP_FIRST so Clang understands it's the same item that is getting removed from the list. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-3/+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>
* *: Make assignment from RB_ROOT in while loop work betterDonald Sharp2018-02-231-1/+4
| | | | | | | 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>
* *: Make code use a consisten definition of labelsDonald Sharp2018-02-091-9/+13
| | | | | | | | | | Turns out we had 3 different ways to define labels all of them overlapping with the same meanings. Consolidate to 1. This one choosen is consistent naming wise with what the *bsd and linux kernels use. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra, ldpd: fix display of pseudowire statusRenato Westphal2017-11-291-2/+7
| | | | | | | | | In some circumstances zebra and ldpd would display a pseudowire as UP when in reality it's not (example: MTU mismatch between the two ends). Fix this to avoid confusion. Reported-by: ßingen <bingen@voltanet.io> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>