summaryrefslogtreecommitdiffstats
path: root/ldpd (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * *: Drop deprecated incorrect JSON fields with wrong namingDonatas Abraitis2023-01-311-4/+0
| | | | | | | | | | | | Deprecation cycle already passed. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | *: no-warn pragmas for non-const format stringsDavid Lamparter2023-01-271-0/+4
|/ | | | | | | | We do use non-constant/literal format strings in a few places for more or less valid reasons; put `ignored "-Wformat-nonliteral"` around those so we can have the warning enabled for everywhere else. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ldpd: fix time truncationRafael Zalamena2023-01-201-4/+10
| | | | | | | | Use bigger storage for handling time variables so we don't truncate. Found by Coverity Scan (CID 1519735) Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* ldpd: Clean up use after free in shutdownDonald Sharp2022-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Config data was being freed just prior to it being used for cleanup in shutdown. Prevent this from happening. ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-================================================================= ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142:==2274142==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d00000c880 at pc 0x0000004d94d1 bp 0x7ffd46637810 sp 0 x7ffd46637808 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-READ of size 4 at 0x61d00000c880 thread T0 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #0 0x4d94d0 in ldp_rtr_id_get /home/sharpd/frr8/ldpd/ldpd.c:983:20 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #1 0x56ff92 in gen_ldp_hdr /home/sharpd/frr8/ldpd/packet.c:47:19 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #2 0x56a4b0 in send_notification_full /home/sharpd/frr8/ldpd/notification.c:49:9 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #3 0x56c4b3 in send_notification /home/sharpd/frr8/ldpd/notification.c:117:2 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #4 0x573fb7 in session_shutdown /home/sharpd/frr8/ldpd/packet.c:666:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #5 0x4e2ef1 in adj_del /home/sharpd/frr8/ldpd/adjacency.c:145:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #6 0x55d425 in ldpe_shutdown /home/sharpd/frr8/ldpd/ldpe.c:231:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #7 0x55a9a0 in ldpe_dispatch_main /home/sharpd/frr8/ldpd/ldpe.c:631:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #8 0x7f0c00c035e6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #9 0x5586f2 in ldpe /home/sharpd/frr8/ldpd/ldpe.c:138:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #10 0x4d46d2 in main /home/sharpd/frr8/ldpd/ldpd.c:339:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #11 0x7f0c00476d09 in __libc_start_main csu/../csu/libc-start.c:308:16 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #12 0x429cb9 in _start (/usr/lib/frr/ldpd+0x429cb9) ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-0x61d00000c880 is located 0 bytes inside of 2008-byte region [0x61d00000c880,0x61d00000d058) ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-freed by thread T0 here: ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #0 0x4a3aad in free (/usr/lib/frr/ldpd+0x4a3aad) ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #1 0x4de6c8 in config_clear /home/sharpd/frr8/ldpd/ldpd.c:2001:2 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #2 0x55d12d in ldpe_shutdown /home/sharpd/frr8/ldpd/ldpe.c:211:2 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #3 0x55a9a0 in ldpe_dispatch_main /home/sharpd/frr8/ldpd/ldpe.c:631:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #4 0x7f0c00c035e6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #5 0x5586f2 in ldpe /home/sharpd/frr8/ldpd/ldpe.c:138:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #6 0x4d46d2 in main /home/sharpd/frr8/ldpd/ldpd.c:339:3 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #7 0x7f0c00476d09 in __libc_start_main csu/../csu/libc-start.c:308:16 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-previously allocated by thread T0 here: ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #0 0x4a3ea2 in calloc (/usr/lib/frr/ldpd+0x4a3ea2) ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #1 0x4d6146 in config_new_empty /home/sharpd/frr8/ldpd/ldpd.c:1967:10 ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #2 0x558678 in ldpe /home/sharpd/frr8/ldpd/ldpe.c:134:11 -- ./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142- #4 0x7f0c00476d09 in __libc_start_main csu/../csu/libc-start.c:308:16 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #12196 from opensourcerouting/xref-vtyshDonald Sharp2022-11-032-3/+0
|\ | | | | *: rewrite `extract.pl` using `xref` infra
| * build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-262-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | ldpd: Make ldpd happy with clang-16Donald Sharp2022-10-261-2/+1
|/ | | | Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
* Merge pull request #12066 from opensourcerouting/cleanup-cli-xrefDonald Sharp2022-10-131-1/+1
|\ | | | | *: clean up various CLI-related bits
| * *: fix some malformed CLI docstringsDavid Lamparter2022-10-061-1/+1
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: Create and use infrastructure to show debugs in libDonald Sharp2022-10-071-1/+5
|/ | | | | | | | | There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ldpd: changes for code maintainabilitysri-mohan12022-08-301-6/+6
| | | | | | these changes are for improving the code maintainability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* ldpd: Convert thread_cancel to THREAD_OFFDonald Sharp2022-07-2110-43/+43
| | | | | | 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-183-12/+4
| | | | 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>
* *: use FRR interface name definition everywhereRafael Zalamena2022-05-021-11/+11
| | | | | | | Don't rely on the OS interface name length definition and use the FRR definition instead. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* *: Fix spelling of intefaceDonald Sharp2022-04-191-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #10447 from ton31337/fix/json_with_whitespacesDonald Sharp2022-03-131-0/+4
|\ | | | | *: Fix JSON keys with whitespaces and PascalCase
| * *: Add camelCase JSON keys in addition to PascalCaseDonatas Abraitis2022-02-031-0/+4
| | | | | | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* | *: Change thread->func to return void instead of intDonald Sharp2022-02-2413-185/+98
|/ | | | | | | 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>
* ldpd: Convert vty_out to vty_json for JSONDonatas Abraitis2021-11-251-6/+2
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Remove unused variablesDonatas Abraitis2021-11-181-8/+0
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* ldpd: Replace inet_ntop to %pI4/6 for JSON outputsDonatas Abraitis2021-11-181-29/+16
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* Merge pull request #10036 from donaldsharp/finally_frrJafar Al-Gharaibeh2021-11-133-3/+3
|\ | | | | Finally frr
| * *: Convert quagga_signal_X to frr_signal_XDonald Sharp2021-11-113-3/+3
| | | | | | | | | | | | | | Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | *: use compiler.h MIN/MAX macros instead of everyone having oneDonald Sharp2021-11-113-7/+4
|/ | | | | | | | We had various forms of min/max macros across multiple daemons all of which duplicated what we have in compiler.h. Convert everyone to use the `correct` ones Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: Add autocomplete for access-listsDonatas Abraitis2021-10-311-5/+5
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: convert zclient callbacks to tableDavid Lamparter2021-10-202-9/+13
| | | | | | | | | | | | | 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>
* Merge pull request #9715 from idryzhov/cleanup-number-named-aclDonatas Abraitis2021-10-131-19/+5
|\ | | | | *: cleanup number-named access-lists in CLI
| * *: cleanup number-named access-lists in CLIIgor Ryzhov2021-10-081-19/+5
| | | | | | | | | | | | | | There's no more difference between number-named and word-named access-lists. This commit removes separate arguments for number-named ACLs from CLI. Signed-off-by: Igor Ryzhov <iryzhov@nfware.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-047-21/+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>
* Merge pull request #9560 from LabNConsulting/ziemba/frrmod_load-error-messagesDavid Lamparter2021-09-291-2/+1
|\ | | | | frrmod_load(): fix error messages
| * 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>
* | *: fix for -Wstrict-prototypesDavid Lamparter2021-09-021-1/+1
|/ | | | | | Just some "void" missing between empty braces. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps2021-08-261-0/+6
|\ | | | | *: explicitly print "exit" at the end of every node config
| * *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | *: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis2021-08-251-1/+0
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* build: fix `AM_LDFLAGS` usage (and gcov)David Lamparter2021-07-211-1/+1
| | | | | | | | | | | | | | | | like the other automake variables, setting `xyz_LDFLAGS` causes `AM_LDFLAGS` to be ignored for `xyz`. For some reason I had in my mind that automake doesn't do this for LDFLAGS, but... it does. (Which is consistent with `_CFLAGS` and co.) So, all the libraries and modules have been ignoring `AM_LDFLAGS` (which includes `SAN_FLAGS` too). Set up new `LIB_LDFLAGS` and `MODULE_LDFLAGS` to handle all of this correctly (and move these bits to a central location.) Fixes: #9034 Fixes: 0c4285d77eb ("build: properly split CFLAGS from AC_CFLAGS") Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-012-3/+3
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-012-3/+3
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLENDonatas Abraitis2021-07-011-1/+1
| | | | | | Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Replace IPV6_MAX_PREFIXLEN to IPV6_MAX_BITLENDonatas Abraitis2021-07-011-1/+1
| | | | | | Just drop IPV6_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* ldpd: make allowing broken-lsps to be installed with pop operation configurablelynne2021-05-038-3/+71
| | | | | | | | | | | 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>
* Merge pull request #8471 from idryzhov/cleanup-num-named-listsDonatas Abraitis2021-04-282-4/+2
|\ | | | | *: cleanup number-named access-lists and prefix-lists
| * *: cleanup number-named access-lists and prefix-listsIgor Ryzhov2021-04-142-4/+2
| | | | | | | | | | | | | | | | A long time ago there was a difference between number-named and string-named access/prefix-lists. Currently we always treat the name as a string and there is no need for a separate list for number-named lists. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #8517 from volta-networks/ldp_defer_zebra_updatesRenato Westphal2021-04-273-5/+39
|\ \ | | | | | | ldpd: defer register for info until configured
| * | ldpd: defer register for info until configuredFredi Raspall2021-04-263-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of registering to receive default-VRF information and routes when first connected to zebra, defer the registration until some ldp configuration is entered. This avoids redistributing IPv4/IPv6 routes to ldpd when not needed. Signed-off-by: Fredi Raspall <fredi@voltanet.io> Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
* | | ldpd: set `frr_is_after_fork` in lde/ldpeDavid Lamparter2021-04-232-0/+4
|/ / | | | | | | | | | | | | | | 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>
* | build: properly split CFLAGS from AC_CFLAGSDavid Lamparter2021-04-211-1/+1
| | | | | | | | | | | | | | | | `CFLAGS` is a "user variable", not intended to be controlled by configure itself. Let's put all the "important" stuff in AC_CFLAGS and only leave debug/optimization controls in CFLAGS. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>