summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2025-02-14lib: fix false context information for SRv6 routePhilippe Guibert
The seg6local route dumped by 'show ipv6 route' makes think that the USP flavor is supported, whereas it is not the case. This information is a context information, and for End, the context information should be empty. > # show ipv6 route > [..] > I>* fc00:0:4::/128 [115/0] is directly connected, sr0, seg6local End USP, weight 1, 00:49:01 Fix this by suppressing the USP information from the output. Fixes: e496b4203055 ("bgpd: prefix-sid srv6 l3vpn service tlv") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-11Merge pull request #18103 from FRRouting/mergify/bp/stable/10.1/pr-18060Jafar Al-Gharaibeh
lib: crash handlers must be allowed on threads (backport #18060)
2025-02-11lib: crash handlers must be allowed on threadsDavid Lamparter
Blocking all signals on non-main threads is not the way to go, at least the handlers for SIGSEGV, SIGBUS, SIGILL, SIGABRT and SIGFPE need to run so we get backtraces. Otherwise the process just exits. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 13a6ac5b4ca8fc08b348f64de64a787982f24250)
2025-02-11lib: clean up nexthop hashing messDavid Lamparter
We were hashing 4 bytes of the address. Even for IPv6 addresses. Oops. The reason this was done was to try to make it faster, but made a complex maze out of everything. Time for a refactor. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 001fcfa1dd9f7dc2639b4f5c7a52ab59cc425452)
2025-02-11lib: guard against padding garbage in ZAPI readDavid Lamparter
When reading in a nexthop from ZAPI, only set the fields that actually have meaning. While it shouldn't happen to begin with, we can otherwise carry padding garbage into the unused leftover union bytes. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 4a0e1419a69d07496c7adfb744beecd00e1efef2)
2025-01-09bgpd: fix crash in displaying json orf prefix-listLouis Scalbert
bgpd crashes when there is several entries in the prefix-list. No backtrace is provided because the issue was catched from a code review. Fixes: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> (cherry picked from commit 8ccf60921b85893d301186a0f8156fb702da379f)
2025-01-09bgpd: fix bgp orf prefix-list json prefixLouis Scalbert
0x<address>FX was displayed instead of the prefix. Fixes: b219dda129 ("lib: Convert usage of strings to %pFX and %pRN") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> (cherry picked from commit b7e843d7e8afe57d3815dbb44e30307654e73711)
2024-12-17lib: Take ge/le into consideration when checking the prefix with the prefix-listDonatas Abraitis
Without the fix: ``` show ip prefix-list test_1 10.20.30.96/27 first-match <no result> show ip prefix-list test_2 192.168.1.2/32 first-match <no result> ``` With the fix: ``` ip prefix-list test_1 seq 10 permit 10.20.30.64/26 le 27 ! end donatas# show ip prefix-list test_1 10.20.30.96/27 seq 10 permit 10.20.30.64/26 le 27 (hit count: 1, refcount: 0) donatas# show ip prefix-list test_1 10.20.30.64/27 seq 10 permit 10.20.30.64/26 le 27 (hit count: 2, refcount: 0) donatas# show ip prefix-list test_1 10.20.30.64/28 donatas# show ip prefix-list test_1 10.20.30.126/26 seq 10 permit 10.20.30.64/26 le 27 (hit count: 3, refcount: 0) donatas# show ip prefix-list test_1 10.20.30.126/30 donatas# ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit dd4c2acc2e871283256f6cea16ede6d2d7f72dfe)
2024-10-27lib, zebra: Keep `zebra on-rib-process script` in frr.confDonatas Abraitis
After the change: ``` $ grep on-rib-process /etc/frr/frr.conf zebra on-rib-process script script4 $ systemctl restart frr $ vtysh -c 'show run' | grep on-rib-process zebra on-rib-process script script4 ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 1fe1f8d87c4ab46ae18536a2418c05ae5fd95185)
2024-10-23lib: Include SID structure in seg6local nexthopCarmine Scarpitta
Include SID structure information in seg6local nexthop data structure. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-10-22Revert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty"Donald Sharp
This reverts commit 0e3c5e8e5907321b35201f0985c1d3f4a1b0e639. (cherry picked from commit 6a36b9ef49bfce59a7e674df233265da6d275257)
2024-10-11bgpd: Move some non BGP-specific route-map functions to libDonatas Abraitis
They are managed under `frr-route-map`, not under `frr-bgp-route-map`. Fixes: https://github.com/FRRouting/frr/issues/17055 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit b9a9be492e8dde39a0040bd1140893ccab83c2be)
2024-10-01lib: Attach stdout to child only if --log=stdout and stdout FD is a ttyVladislav Odintsov
Prior to this commit stdout of a process started in a daemon mode was attached to a calling process. As a result a calling process hung for infinity. Signed-off-by: Vladislav Odintsov <vlodintsov@k2.cloud> (cherry picked from commit 0e3c5e8e5907321b35201f0985c1d3f4a1b0e639)
2024-09-09lib: Fix LYD_NEW_PATH_OUTPUT issue to support libyang v3.xLu.Mao
Fix the LYD_NEW_PATH_OUTPUT undeclared error to support the latest libyang v3.x version, and also compatible with old version. Signed-off-by: Lu Mao <lu.mao@molex.com> (cherry picked from commit 87c9060f90b6b9b5a69ad1e6ba6e8ebc58d94374)
2024-08-12lib: fix distribute-list deletionIgor Ryzhov
When a whole distribute-list is deleted (can be done only using API), all its children must be cleaned up manually. Fixes #16538 Signed-off-by: Igor Ryzhov <idryzhov@gmail.com> (cherry picked from commit 8fad4f317ebd3de7677d7600e7a024f713b20d70)
2024-08-08lib: fix crash on distribute-list deleteIgor Ryzhov
The destroy callback must be executed only once on APPLY stage. Fixes #16528 Signed-off-by: Igor Ryzhov <idryzhov@gmail.com> (cherry picked from commit 2b12d62e38bf41648b2703b5a5c48e47eb01edc7)
2024-07-24lib: mgmtd: fix too early daemon detach of mgmtdChristian Hopps
Correct FRR startup counts on a daemon's vty socket to be open when the parent process exits. The parent process waits for `frr_check_detach()` to be called by the child before exiting. The problem is when the `FRR_MANUAL_VTY_START` flag is set the vty socket was not opened but `frr_check_detach()` was called anyway. Instead add a bool option for `frr_check_detach()` to be called when the socket is opened with `frr_vty_serv_start()`, and do so when "manually" calling said function (i.e., when FRR_MANUAL_VTY_START is set). The `FRR_MANUAL_VTY_START` flag is only set by mgmtd. The reason we wait to open the vty socket is so that mgmtd can parse the various daemon specific config files it has taken over, after the event loop has started, but before we receive any possible new config from `vtysh`. fixes #16362 Signed-off-by: Christian Hopps <chopps@labn.net> (cherry picked from commit be9a6fc0ea8180a4aaa558c5402ea543427e2e7e)
2024-07-22lib: move non-error from __log_err to __dbgChristian Hopps
Additionally, print `errmsg_if_any` in successful debug messages if non-NULL. fixes #16386 #16043 Signed-off-by: Christian Hopps <chopps@labn.net> (cherry picked from commit 7afd7d99f2fa39be073625c630d46f96e5dd66a5)
2024-06-12lib: fix incorrect use of error checking macroChristian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-06-12Merge pull request #16191 from pguibert6WIND/srte_color_not_copiedbase_10.1Donatas Abraitis
lib: fix copy srte_color from zapi_nexthop structure
2024-06-10lib: fix copy srte_color from zapi_nexthop structurePhilippe Guibert
When switching from nexthop to zapi_nexthop, the srte color is copied. Do the same in reverse. Fixes: 31f937fb43f4 ("lib, zebra: Add SR-TE policy infrastructure to zebra") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-10Merge pull request #16093 from louis-6wind/fix-show-route-memoryDonatas Abraitis
zebra: fix Out Of Memory issue when displaying large route tables in JSON
2024-06-07Merge pull request #15900 from mikemallin/v6-vtep-lib-upstreamDonald Sharp
lib, bgpd, tests, zebra: prefix_sg changes for V6 VTEP
2024-06-07lib: add helpers to print json keysLouis Scalbert
Add helpers to print json keys in order to prepare the next commits. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-04lib: comments about public vs private message apisChristian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-05-31bgpd, lib, zebra: Extend ES_VTEP_LIST_STR_SZ to support IPv6 addressesMike RE Mallin
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31lib, zebra: Update prefix_sg structure for IPv6 group supportMike RE Mallin
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31lib: Make the ip arg const in stream_put_ipaddrMike RE Mallin
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31lib: Add clang-format wrapper around printfrr_extMike RE Mallin
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31lib: Add ipaddr_is_same to compare IPv6 addressesMike RE Mallin
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31lib: Add SET_IPADDR_NONE macroMike RE Mallin
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-05-31lib: make python/ts_expand.py actually workDavid Lamparter
lib/typesafe.h was supposed to be outside the _TYPESAFE_EXPAND_MACROS guard, so that including lib/atomlist.h grabs all the typesafe container macros. (No effect on normal build, as _TYPESAFE_EXPAND_MACROS is never defined there.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-29Merge pull request #15082 from louis-6wind/fix-iff-lower-upIgor Ryzhov
lib: take into account the Linux IFF_LOWER_UP flag
2024-05-20Merge pull request #15980 from donaldsharp/agentx_updateDonatas Abraitis
*: Modify agentx to be allowed to be called
2024-05-15zebra: fix dump SR-TE information if availablePhilippe Guibert
The SR-TE color of nexthop should be displayed in all situations. Fixes: 553c8048460a ("zebra: fix JSON fields for 'show ip/ipv6 nht'") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-15zebra, lib: move nexthop display helper to lib folderPhilippe Guibert
The zebra_nexthop_vty_helper() and zebra_nexthop_json_helper() functions could be very helpful to display nexthop information from whatever daemon. Move the core function in the nexthop_vty_helper() and the nexthop_json_helper() function. The zebra API call remains unchanged. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-14Merge pull request #15876 from opensourcerouting/typesafe-expandMark Stapp
python: add tool to expand typesafe definitions
2024-05-14lib, vtysh, topotests: fix 'show ip[v6] access-list ... json' formattingPiotr Suchy
Similarly to recently fixed 'show ip[v6] prefix-list ...' - PR#15750, json output is not valid for 'show ip[v6] access-list ... json' commands, as it goes through all the running daemons and for each one it calls 'filter_show' creating a new json object. To aggreagate the output and create a valid json that can later be parsed, the commands were moved to vtysh and formatted accordingly Signed-off-by: Piotr Suchy <piotrsuchy@proton.me>
2024-05-10*: Modify agentx to be allowed to be calledDonald Sharp
If you had a situation where an operator turned on ospfd with snmp but not ospf6d and agentx was configured then you get into a situation where ospf6d would complain that the config for agentx did not exist. Let's modify the code to allow this situation to happen. Fixes: #15896 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-10lib: Allow doing match/set tag untaggedDonatas Abraitis
In route-map: `match tag untagged`. E.g. Cisco/Juniper allows that, but they use `match tag 0` instead. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-08Merge pull request #15962 from opensourcerouting/zmq-xref-setupDonald Sharp
lib: stick `XREF_SETUP` into libfrrzmq
2024-05-08Merge pull request #15608 from vjardin/libyang3Martin Winter
libyang3 - fondation step 1
2024-05-08lib: libyang.so.3 compatibilty layersVincent JARDIN
Let's support libyang 2.2.8 using libyang.so.3.0.8 It requires the commit ed277585ea from the libyang. Signed-off-by: Vincent Jardin <vjardin@free.fr>
2024-05-07lib: stick `XREF_SETUP` into libfrrzmqDavid Lamparter
Didn't catch this one when adding the warning/error (with -Werror) for missing this. Neither the CI nor I build with ZeroMQ enabled :(. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-07Merge pull request #15944 from lsang6WIND/fix-same-prefixRuss White
if: fix same connected address
2024-05-06Merge pull request #15594 from idryzhov/mgmt-rpcChristian Hopps
mgmtd: implement YANG RPC/action support
2024-05-06if: fix same connected addressLoïc Sang
Using the same address with a different prefix length is not supported. If we configure two identical addresses with different netmasks 192.168.1.1/30 and then 192.168.1.1/29. Zebra sends '192.168.1.1' with a prefix length of 29. However, the function 'zebra_interface_address_read()' reads '192.168.1.1/30' because the prefix length is not checked. Using 'same_prefix()' is more convenient. Signed-off-by: Loïc Sang <loic.sang@6wind.com>
2024-05-06Merge pull request #15902 from opensourcerouting/build-xref-setup-hppaDonald Sharp
build: fix missing `XREF_SETUP` (and HP PA-RISC build failure)
2024-05-02build: warn/fail on missing `XREF_SETUP()`David Lamparter
While clippy tries really, really hard to work under adverse conditions, and this catches missing XREF_SETUP() on almost all CPU architectures, this doesn't quite work on hppa. So, make it a warning on *all* platforms (or error for --enable-dev-build) in order to catch it before shipping off to Debian's buildd and blowing up there... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-02lib: fix `time_t` print without castDavid Lamparter
The gcc plugin wasn't warning about printing `suseconds_t` (which is `time_t`, but in `struct timeval`.) It needs to be printed with a cast, just like `time_t`. Luckily there is only one such usage. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>