summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-12-12lib: fix capability double resource allocationRafael Zalamena
Don't let `zprivs_caps_init` allocate resources without checking if there were other caps previously allocated. This fixes a memory leak that happens on daemons that `fork()` and reuse the `<daemon>_di` (see `ldpd`/`lde`/`ldpe` code). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-09lib: Hide list macros in linklist.cDonald Sharp
The LISTNODE_ATTACH|DELETE macros are only used in linklist.c. Let's remove temptation from people to use them. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-08lib: fix zlog command types tableMark Stapp
Fix a number of differences between the zapi message enum and the log description table. Signed-off-by: Mark Stapp <mjs@labn.net>
2022-12-02lib: use specific MTYPE for interface descriptionsMark Stapp
Don't use MTYPE_TMP, use a real mem type. Signed-off-by: Mark Stapp <mjs@labn.net>
2022-12-01Merge pull request #12397 from opensourcerouting/vscode-introDonald Sharp
lib: handle visual studio code C/C++ extension
2022-11-28lib: handle visual studio code C/C++ extensionRafael Zalamena
Add some `pragma`s to handle errors that the C/C++ extension is not able to understand. Move `TRANSPARENT_UNION` to `lib/compiler.h` for consistency. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-11-26lib: Do not log `echo PING` commands from watchfrrDonald Sharp
Since the `echo PING` commands are from watchfrr and are sent a whole bunch when an operator has `log commands` on the amount of logging done is quite significant. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-24Merge pull request #12317 from mobash-rasool/ospf-fixesRuss White
ospfd: Fix RFC conformance test cases 25.19 and 27.6
2022-11-22lib: disable vrf before terminating interfacesStephen Worley
We must disable the vrf before we start terminating interfaces. On termination, we free the 'zebra_if' struct from the interface ->info pointer. We rely on that for subsystems like vxlan for cleanup when shutting down. ''' ==497406== Invalid read of size 8 ==497406== at 0x47E70A: zebra_evpn_del (zebra_evpn.c:1103) ==497406== by 0x47F004: zebra_evpn_cleanup_all (zebra_evpn.c:1363) ==497406== by 0x4F2404: zebra_evpn_vxlan_cleanup_all (zebra_vxlan.c:1158) ==497406== by 0x4917041: hash_iterate (hash.c:267) ==497406== by 0x4F25E2: zebra_vxlan_cleanup_tables (zebra_vxlan.c:5676) ==497406== by 0x4D52EC: zebra_vrf_disable (zebra_vrf.c:209) ==497406== by 0x49A247F: vrf_disable (vrf.c:340) ==497406== by 0x49A2521: vrf_delete (vrf.c:245) ==497406== by 0x49A2E2B: vrf_terminate_single (vrf.c:533) ==497406== by 0x49A2D8F: vrf_terminate (vrf.c:561) ==497406== by 0x441240: sigint (main.c:192) ==497406== by 0x4981F6D: frr_sigevent_process (sigevent.c:130) ==497406== Address 0x6d68c68 is 200 bytes inside a block of size 272 free'd ==497406== at 0x48470E4: free (vg_replace_malloc.c:872) ==497406== by 0x4942CF0: qfree (memory.c:141) ==497406== by 0x49196A9: if_delete (if.c:293) ==497406== by 0x491C54C: if_terminate (if.c:1031) ==497406== by 0x49A2E22: vrf_terminate_single (vrf.c:532) ==497406== by 0x49A2D8F: vrf_terminate (vrf.c:561) ==497406== by 0x441240: sigint (main.c:192) ==497406== by 0x4981F6D: frr_sigevent_process (sigevent.c:130) ==497406== by 0x499A5F0: thread_fetch (thread.c:1775) ==497406== by 0x492850E: frr_run (libfrr.c:1197) ==497406== by 0x441746: main (main.c:476) ==497406== Block was alloc'd at ==497406== at 0x4849464: calloc (vg_replace_malloc.c:1328) ==497406== by 0x49429A5: qcalloc (memory.c:116) ==497406== by 0x491D971: if_new (if.c:174) ==497406== by 0x491ACC8: if_create_name (if.c:228) ==497406== by 0x491ABEB: if_get_by_name (if.c:613) ==497406== by 0x427052: netlink_interface (if_netlink.c:1178) ==497406== by 0x43BC18: netlink_parse_info (kernel_netlink.c:1188) ==497406== by 0x4266D7: interface_lookup_netlink (if_netlink.c:1288) ==497406== by 0x42B634: interface_list (if_netlink.c:2368) ==497406== by 0x4ABF83: zebra_ns_enable (zebra_ns.c:127) ==497406== by 0x4AC17E: zebra_ns_init (zebra_ns.c:216) ==497406== by 0x44166C: main (main.c:408) ''' Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-11-22Merge pull request #12311 from opensourcerouting/feature/bgp_snmp_bgp4v2-mibRuss White
bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry)
2022-11-22zebra: traffic control ZAPISiger Yang
This commit adds ZAPI encoders & decoders for traffic control operations, which include tc_qdisc, tc_class and tc_filter. Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-11-22zebra: traffic control state managementSiger Yang
This allows Zebra to manage QDISC, TCLASS, TFILTER in kernel and do cleaning jobs when it starts up. Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-11-21lib, vtysh: Allow watchfrr to receive start/end linesDonald Sharp
Watchfrr really should receive notification about start/end read of configuration. Let's fix that. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-21ospfd: Fix RFC conformance test cases 25.19 and 27.6Mobashshera Rasool
Steps to reproduce: -------------------------- 1. ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0 with DUT as DR. 2. ANVL: Listen (for up to 2 * <RxmtInterval> seconds) on DIface-0. 3. DUT: Send <OSPF-LSU> packet. 4. ANVL: Verify that the received <OSPF-LSU> packet contains a Network- LSA for network N1 originated by DUT, and the LS Sequence Number is set to <InitialSequenceNumber>. 5. ANVL: Establish full adjacency with DUT for neighbor Rtr-0-B on DIface-0 with DUT as DR. 6. ANVL: Listen (for up to 2 * <RxmtInterval> seconds) on DIface-0. 7. DUT: Send <OSPF-LSU> packet. 8. ANVL: Verify that the received <OSPF-LSU> packet contains a new instance of the Network-LSA for network N1 originated by DUT, and the LS Sequence Number is set to (<InitialSequenceNumber> + 1). Both the test cases were failing while verifying the initial sequence number for network LSA. This is because currently OSPF does not reset its LSA sequence number when it is going down. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-11-17Merge pull request #12081 from sworleys/EMM-upstreamDonatas Abraitis
Rework of Various Handling in EVPN for Extended Mac Mobility
2022-11-16Merge pull request #11992 from pguibert6WIND/pathd_debugRuss White
Pathd debug
2022-11-14pathd: use a define to store the the length of endpoint stringPhilippe Guibert
The endpoint string is a 46 byte length buffer. Use a single place to store the length of that buffer. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-11-14Merge pull request #12219 from cscarpitta/feature/srv6-usid-behavior-supportDonatas Abraitis
bgpd, zebra: Add support for SRv6 uSID Behaviors
2022-11-14bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry)Donatas Abraitis
http://www.circitor.fr/Mibs/Mib/B/BGP4V2-MIB.mib Compared with Arista BGP4V2-MIB implementation, almost identical (despite that Arista has slightly some additional MIBs). Example: ``` iso.3.6.1.3.5.1.1.2.1.1.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.1.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.2.1.4.192.168.10.64 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.1.4.192.168.10.65 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.2.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.3.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 2A 02 47 80 01 23 00 00 00 00 00 00 00 00 00 01 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.3.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.4.1.4.192.168.10.64 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.1.4.192.168.10.65 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.4.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 0 iso.3.6.1.3.5.1.1.2.1.5.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 2A 02 47 80 01 23 00 00 00 00 00 00 00 00 00 02 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.5.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.6.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 179 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.6.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.7.1.4.192.168.10.64 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.1.4.192.168.10.65 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.7.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 65000 iso.3.6.1.3.5.1.1.2.1.8.1.4.192.168.10.64 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.1.4.192.168.10.65 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.8.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: C0 00 02 FC iso.3.6.1.3.5.1.1.2.1.9.1.4.192.168.10.64 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.1.4.192.168.10.65 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 54814 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.9.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 0 iso.3.6.1.3.5.1.1.2.1.10.1.4.192.168.10.64 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.1.4.192.168.10.65 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Gauge32: 65002 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Gauge32: 65001 iso.3.6.1.3.5.1.1.2.1.10.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Gauge32: 65001 iso.3.6.1.3.5.1.1.2.1.11.1.4.192.168.10.64 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.1.4.192.168.10.65 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = STRING: "dddd" iso.3.6.1.3.5.1.1.2.1.11.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.11.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = Hex-STRING: 00 00 00 00 iso.3.6.1.3.5.1.1.2.1.12.1.4.192.168.10.64 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.1.4.192.168.10.65 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.12.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 2 iso.3.6.1.3.5.1.1.2.1.13.1.4.192.168.10.64 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.13.1.4.192.168.10.65 = INTEGER: 3 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.121 = INTEGER: 3 iso.3.6.1.3.5.1.1.2.1.13.2.16.42.12.47.7.72.150.6.102.0.0.0.0.0.0.177.128 = INTEGER: 1 iso.3.6.1.3.5.1.1.2.1.14.1.4.192.168.10.64 = Hex-STRING: 4F 4B 00 iso.3.6.1.3.5.1.1.2.1.14.1.4.192.168.10.65 = Hex-STRING: 4F 4B 32 00 iso.3.6.1.3.5.1.1.2.1.14.2.16.42.2.71.128.1.35.0.0.0.0.0.0.0.0.0.2 = Hex-STRING: 69 70 76 36 00 ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-08lib,zebra: Add SRv6 uSID info to VTY outputCarmine Scarpitta
In this commit, we extend to print the `SRV6_LOCATOR_USID` flag. The output appears as follows: ``` { "locators":[ { "name":"loc1", "prefix":"fc00:0:1::/48", "blockBitsLength":32, "nodeBitsLength":16, "functionBitsLength":16, "argumentBitsLength":0, "uSID":true, "statusUp":true, "chunks":[ { "prefix":"fc00:0:1::/48", "proto":"bgp" } ] } ] } ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-11-08lib: Add support for SRv6 Behavior codepointsCarmine Scarpitta
In this commit, we introduce a new enumeration to encode the SRv6 Endpoint Behaviors codepoints defined in the IANA SRv6 Endpoint Behaviors Registry (https://www.iana.org/assignments/segment-routing/segment-routing.xhtml). Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-11-07lib: Add PCRE2 supportDonatas Abraitis
Some results: ``` ==== PCRE ==== % ./a.out "^65001" "65001" comparing: ^65001 / 65001 ret status: 0 [14:31] donatas-pc donatas /home/donatas % ./a.out "^65001_" "65001" comparing: ^65001_ / 65001 ret status: 0 ===== PCRE2 ===== % ./a.out "^65001" "65001" comparing: ^65001 / 65001 ret status: 0 [14:30] donatas-pc donatas /home/donatas % ./a.out "^65001_" "65001" comparing: ^65001_ / 65001 ret status: 1 ``` Seems that if using PCRE2, we need to escape outer `()` chars and `|`. Sounds like a bug. But this is only with some older PCRE2 versions. With >= 10.36, I wasn't able to reproduce this, everything is fine and working as expected. Adding _FRR_PCRE2_POSIX definition because pcre2posix.h does not have include's guard. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-07Merge pull request #12238 from donaldsharp/appendDonatas Abraitis
lib, zebra: Allow for zebra to recognize that a route has gotten desy…
2022-11-04*: Add ability to encode / decode resilence down zapiDonald Sharp
At this point add abilty for the encode/decode of the resilience down ZAPI to zebra. Just hookup sharpd at this point in time. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04*: Add ability for daemons to notice resilience changesDonald Sharp
This patch just introduces the callback mechanism for the resilient nexthop changes so that upper level daemons can take advantage of the change. This does nothing at this point but just call some code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04lib, vtysh: Add ability to specify resilient nhgsDonald Sharp
Add the ability to specify a resilient nexthop group nexthop-group A resilient buckets 32 idle_timer 100 unbalanced_timer 500 nexthop 192.168.100.1 enp7s0 nexthop 192.168.100.33 enp7s0 nexthop 192.168.122.1 enp1s0 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04lib, zebra: Add ability to encode/decode resilient nhg'sDonald Sharp
Add ability to read the nexthop group resilient linux kernel data as well as write it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04lib: When adding to front of list ensure we handle tail toDonald Sharp
When inserting to the front of a list with listnode_add_head if the list is empty, the tail will not be properly set and subsuquent calls to insert/remove will cause the function to crash. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04lib, zebra: Allow for zebra to recognize that a route has gotten desyncedDonald Sharp
FRR does not use the NLM_F_APPEND semantics ( in fact I would argue that the NLM_F_APPEND semantics just introduce pain for all parties involved ) I would also argue that most people who use the kernel netlink api have recognized that NLM_F_APPEND for a route is a recipe for disaster that is well documented and as such it is not used as anything other than a curiousity by operators. See: https://bugzilla.redhat.com/show_bug.cgi?id=1337855 https://github.com/thom311/libnl/issues/226 Are 2 great examples of how confusing it is for anyone in user space to know what the correct thing to do is. Given that new fields can be added with no semantics to allow us to know what has resulted in a change or not. In an attempt to recognize this, let's note that FRR believes it has gotten out of sync with the kernel. Future commits will react to the desynchronized route and request from the kernel a reload of that specific route if possible. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-03lib: Fix double set of event pointer to NULLDonald Sharp
The event system when executing a thread already sets the pointer of it to NULL. No need to do it again. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-03Merge pull request #12196 from opensourcerouting/xref-vtyshDonald Sharp
*: rewrite `extract.pl` using `xref` infra
2022-10-31Merge pull request #12114 from opensourcerouting/feature/bgp_aigp_attributeRuss White
bgpd: Implement AIGP
2022-10-31Merge pull request #12230 from cscarpitta/fix/replace-inet-top-in-srv6-libmobash-rasool
lib: Use `%pI6`/`%pI4` to print SRv6 seg6local ctx
2022-10-30lib: Use `%pI6`/`%pI4` to print SRv6 seg6local ctxCarmine Scarpitta
This commit changes `seg6local_context2str()` to use `%pI6`/`%pI4` instead of `inet_ntop` to print the SRv6 seg6local context information. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-29Merge pull request #12224 from ↵Donald Sharp
cscarpitta/fix/enhance-srv6-locator-chunk-free-api bgpd: Enhance the `srv6_locator_chunk_free()` API by automatically setting the pointer to the freed memory to `NULL`
2022-10-29lib, bgpd: Enhance `srv6_locator_chunk_free()` APICarmine Scarpitta
A programmer can use the `srv6_locator_chunk_free()` function to free the memory allocated for a `struct srv6_locator_chunk`. The programmer invokes `srv6_locator_chunk_free()` by passing a single pointer to the `struct srv6_locator_chunk` to be freed. `srv6_locator_chunk_free()` uses `XFREE()` to free the memory. It is the responsibility of the programmer to set the `struct srv6_locator_chunk` pointer to NULL after freeing memory with `srv6_locator_chunk_free()`. This commit modifies the `srv6_locator_chunk_free()` function to take a double pointer instead of a single pointer. In this way, setting the `struct srv6_locator_chunk` pointer to NULL is no longer the programmer's responsibility but is the responsibility of `srv6_locator_chunk_free()`. This prevents programmers from making mistakes such as forgetting to set the pointer to NULL after invoking `srv6_locator_chunk_free()`. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-29lib,zebra: Send SRv6 locator flags over the ZAPICarmine Scarpitta
In this commit, we extend the ZAPI to support encoding and decoding the locator flags contained in the messages exchanged between zebra and the routing daemons. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-29lib: Add `SRV6_LOCATOR_USID` flag to SRv6 locatorCarmine Scarpitta
In this commit, we add support for a new flag called `SRV6_LOCATOR_USID`. When the `SRV6_LOCATOR_USID` flag is set, the routing protocols will install SRv6 behaviors with the uSID in the dataplane. This flag is used to specify a locator as a uSID locator. When a locator is specified as a uSID locator, all the SRv6 SIDs allocated from the locator by the routing protocols (like BGP) are bound to the SRv6 uSID behaviors and use the SRv6 uSID codepoints in the BGP update message. We extend the SRv6 locator implementation to add support for a `usid` flag. When the `usid` flag is set, the bgpd will install SRv6 behaviors with the uSID in the dataplane and use the proper SRv6 Endpoint Behavior codepoint in the BGP advertisement. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-29lib: Add support for flags to the SRv6 locatorCarmine Scarpitta
In this commit, we introduce the ability to specify flags for an SRv6 locator. Flags can be used to specify the properties of the locator. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-28Merge pull request #12154 from louis-6wind/fix-te-default-bandwidthOlivier Dugeon
lib: fix the default TE bandwidth
2022-10-27lib: fix the default TE bandwidthLouis Scalbert
When enabling the interface link-params, a default bandwidth is assigned to the Max, Reservable and Unreserved Bandwidth variables. If the bandwidth is set at in the interface context, this value is used. Otherwise, a default bandwidth value of 10 Gbps is set. Revert the default value to 10 Mbps as it was intended in the initial commit. 10 Mbps is a low value so that the link will not be prioritized when computing the paths. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-10-27lib: fix coverity scan failure in zebra_interface_link_params_read()Louis Scalbert
The code was working but the coverity scan reported a failure. Clarify the code to make the coverity scan happy. Fixes: fe0a129687 ("lib,zebra: link-params are not flushed after no enable") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
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>
2022-10-26bgpd: Implement Accumulated IGP Metric Attribute for BGPDonatas Abraitis
https://www.rfc-editor.org/rfc/rfc7311.html Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-26lib: Add ptr_get_be64() functionDonatas Abraitis
Get a single uint64_t value from two uint32_t values. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-25Merge pull request #12125 from louis-6wind/fix-link-paramsOlivier Dugeon
lib,zebra,ospf: link-params are not flushed after "no enable"
2022-10-24Merge pull request #11673 from cscarpitta/srv6-per-vrf-sidDonatas Abraitis
bgpd: add support for SRv6 L3VPN for IPv4 and IPv6 address families using a single SID
2022-10-20lib: Remove unnecessary comparison, for linked listDonald Sharp
In the comparison function for a linked list code was always checking against passed in NULL's. The comparison function will never receive a NULL value for data from the linklist.c code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-18lib: add block/node/arg len to SRv6 locator JSONCarmine Scarpitta
This commit adds the SRv6 locator's block length, node length and argument length to the output of the command "show segment-routing srv6 locator json" Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18zebra, lib: add support for SRv6 End.DT46 behaviorCarmine Scarpitta
This commit enables zebra to install End.DT46 nexthops into the Linux kernel. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>