summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
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>
2024-05-02Merge pull request #15837 from acooks-at-bda/dev/fix-deprecated-cares-apiDavid Lamparter
2024-05-01Merge pull request #15890 from httpstorm/frr-macOS-section.2024-04-30David Lamparter
2024-05-01Merge pull request #15673 from pguibert6WIND/isis_srv6_usidDonatas Abraitis
lib: fix srv6 locator flags propagated to isis
2024-04-30lib: fix error on MacOSRuben Kerkhof
Sections use a different syntax for Mach-O executables. Fixes: lib/bfd.c:35:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma DEFINE_MTYPE_STATIC(LIB, BFD_INFO, "BFD info") ^ ./lib/memory.h:140:2: note: expanded from macro 'DEFINE_MTYPE_STATIC' DEFINE_MTYPE_ATTR(group, name, static, desc) \ ^ ./lib/memory.h:110:26: note: expanded from macro 'DEFINE_MTYPE_ATTR' __attribute__((section(".data.mtypes"))) = { { \ ^ 1 error generated. Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com> Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
2024-04-30Merge pull request #15653 from pguibert6WIND/link_state_srv6_capasOlivier Dugeon
Link state srv6 capas
2024-04-29python: add tool to expand typesafe definitionsDavid Lamparter
This can be used to get less cryptic error/warnings from GCC when dealing with something typesafe container related. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-27Merge pull request #15854 from mjstapp/dump_outofsync_flagDonatas Abraitis
lib: add ZEBRA_FLAG_OUTOFSYNC to dump_flags function
2024-04-26lib: add ZEBRA_FLAG_OUTOFSYNC to dump_flags functionMark Stapp
Right where the zapi route flags are defined, there's a comment asking that the flag-dumper-function also be updated. Also apply clang-format's preferences, so next person won't have to. Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-04-26Merge pull request #15723 from ↵Russ White
opensourcerouting/feature/extended_link_bw_refactored_v1 bgpd: Implement extended link-bandwidth
2024-04-26lib: take into account the iff_lower_up flagLouis Scalbert
In Linux, a network driver can set the interface flags IFF_UP and IFF_RUNNING although the IFF_LOWER_UP flag is down, which means the interface is ready but the carrier is down: > These values contain interface state: > > ifinfomsg::if_flags & IFF_UP: > Interface is admin up > ifinfomsg::if_flags & IFF_RUNNING: > Interface is in RFC2863 operational state UP or UNKNOWN. This is for > backward compatibility, routing daemons, dhcp clients can use this > flag to determine whether they should use the interface. > ifinfomsg::if_flags & IFF_LOWER_UP: > Driver has signaled netif_carrier_on() However, FRR considers an interface is operational as soon it is up (IFF_UP) and running (IFF_RUNNING), disregarding the IFF_LOWER_UP flag. This can lead to a scenario where FRR starts adding routes through an interface that is technically down at the carrier level, resulting in kernel errors. > Jan 02 18:07:18 dut-vm zebra[283731]: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Network is down, type=RTM_NEWNEXTHOP(104), seq=243, pid=3112881162 > Jan 02 18:07:18 dut-vm zebra[283731]: [X5XE1-RS0SW][EC 4043309074] Failed to install Nexthop (318[if 164]) into the kernel > Jan 02 18:07:18 dut-vm zebra[283731]: [HSYZM-HV7HF] Extended Error: Carrier for nexthop device is down > Jan 02 18:07:18 dut-vm zebra[283731]: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Network is down, type=RTM_NEWNEXTHOP(104), seq=245, pid=3112881162 > Jan 02 18:07:18 dut-vm zebra[283731]: [HSYZM-HV7HF] Extended Error: Nexthop id does not exist > Jan 02 18:07:18 dut-vm zebra[283731]: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWROUTE(24), seq=246, pid=3112881162 > Jan 02 18:07:18 dut-vm zebra[283731]: [X5XE1-RS0SW][EC 4043309074] Failed to install Nexthop (320[10.125.0.2 if 164]) into the kernel > Jan 02 18:07:18 dut-vm zebra[283731]: [VYKYC-709DP] default(0:254):0.0.0.0/0: Route install failed Consider an interface is operational when it has the IFF_UP, IFF_RUNNING and IFF_LOWER_UP flags. Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/operstates.rst?h=v6.7-rc8#n29 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv4/nexthop.c?h=v6.7-rc8#n2886 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/netdevice.h?h=v6.7-rc8#n4198 Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-26build: include our own copy of if.h and dependenciesLouis Scalbert
Import our a copy of Linux if.h and its dependencies (compiler_types.h and libc-compat.h) from the above links. In "if.h", "#include <linux/compiler.h>" has been replaced by "#include <linux/compiler_types.h>". libc-compat.h is needed to avoid conflicts with glibc. Include "linux/if.h" in "zebra.h" when compiling on Linux. De-reference "net/if.h" in C files. Note that "net/if.h" is still needed. It is even included in many Linux kernel files. "linux/if.h" provides additional definitions. Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/if.h?h=v5.5 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/libc-compat.h?h=v5.5 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/linux/compiler_types.h?h=v5.5 Link: https://patchwork.ozlabs.org/project/glibc/patch/1461512707-23058-1-git-send-email-mikko.rapeli@iki.fi/ Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-26Merge pull request #15588 from opensourcerouting/sqlite-filename-sizeDonald Sharp
lib: fix SQLite dbfile path length
2024-04-26lib: replace deprecated ares_gethostbynameAndrew Cooks
c-ares has deprecated ares_gethostbyname() in version 1.28.0 Replace it with ares_getaddrinfo(). This fixes a build error on Fedora 40. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-04-25yang: ietf-netconf-acm needs to be in libfrrDavid Lamparter
ietf-key-chain depends on ietf-netconf-acm, and lib/ code sets up the former, so ietf-netconf-acm needs to be embedded in the libfrr too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-04-25lib: replace deprecated ares_process()Andrew Cooks
ares_process(...) has been deprecated. Replace it with ares_process_fd(...) Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-04-24lib,bgpd,vtysh: move bgp vty defines to libMark Stapp
Stop including a bgp header file from vtysh; move a couple of cli string defines to a library header. Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-04-23Merge pull request #15769 from ↵Mark Stapp
raja-rajasekar/rajasekarr/backpressure_display_i_o_buf zebra: Actually display I/O buffer sizes (part-2)
2024-04-23Merge pull request #15714 from mjstapp/sync_pthread_startupDonald Sharp
lib: serialize pthread startup
2024-04-23isis, lib: add isis srv6 capability to ls_nodePhilippe Guibert
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-23isisd, lib: add link state support for srv6 adjacenciesPhilippe Guibert
Add support for endx_lan and endx adjacency. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-23lib: fix srv6 locator flags propagated to isisPhilippe Guibert
When usid is not used, the isis_srv6_topo1 test does not work. The SID prefix allocated by isis is different when the usid flags is set or not. When the flags is not transmitted to isis, the SID allocated is supposed to be a 128 bit mask length SID, which is not what the isis_srv6_topo1 test is supposed to obtain. Fix this by exchanging the flags locator value in the zclient api. Fixes: 9b7491e1fc04 ("lib: Add support for flags to the SRv6 locator") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-23Merge pull request #15815 from donaldsharp/blackhole_reinstallMark Stapp
lib, zebra: Check for not being a blackhole route
2024-04-23Merge pull request #15750 from piotrsuchy/json_show_ip_prefix_list_fixDonatas Abraitis
vtysh, lib: fix 'show ip[v6] prefix-list ... json' JSON display by moving it to vtysh to fix formatting issue
2024-04-22*: Use uint64_t for weight down the path to ZebraDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-22bgpd: Implement draft-li-idr-link-bandwidth-ext-01Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-22lib, zebra: Check for not being a blackhole routeDonald Sharp
In zebra_interface_nhg_reinstall zebra is checking that the nhg is a singleton and not a blackhole nhg. This was originally done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX, NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX. This was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6. These were both possible to be received and maintained from the upper level protocol for when a route is being recursively resolved. If we have gotten to this point in zebra_interface_nhg_reinstall the nexthop group has already been installed at least once and we *know* that it is actually a valid nexthop. What the test is really trying to do is ensure that we are not reinstalling a blackhole nexthop group( Which is not possible to even be here by the way, but safety first! ). So let's change to test for that instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-22lib: fix style and add more comments to NB codeIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22lib: add native RPC processing to mgmt frontend clientIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22mgmtd: add native RPC processingIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22mgmtd: add backend xpath map for RPCIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22lib: add native RPC processing to mgmt backend clientIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>