summaryrefslogtreecommitdiff
path: root/zebra
AgeCommit message (Collapse)Author
2025-02-12Merge pull request #18091 from FRRouting/mergify/bp/stable/10.0/pr-17935Donald Sharp
zebra: include resolving nexthops in nhg hash (backport #17935)
2025-02-11zebra: guard against junk in nexthop->rmap_srcDavid Lamparter
rmap_src wasn't initialized, so for IPv4 the unused 12 bytes would contain whatever junk is on the stack on function entry. Also move the IPv4 parse before the IPv6 parse so if it's successful we can be sure the other bytes haven't been touched. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit b666ee510eb480da50476b1bbc84bdf8365df95c)
2025-02-11zebra: include resolving nexthops in nhg hashMark Stapp
Ensure that the nhg hash comparison function includes all nexthops, including recursive-resolving nexthops. Signed-off-by: Mark Stapp <mjs@cisco.com> (cherry picked from commit cb7cf73992847cfd4af796085bf14f2fdc4fa8db)
2025-02-04zebra: evpn svd hash avoid double freeChirag Shah
Upon zebra shutdown hash_clean_and_free is called where user free function is passed, The free function should not call hash_release which lead to double free of hash bucket. Fix: The fix is to avoid calling hash_release from free function if its called from hash_clean_and_free path. 10 0x00007f0422b7df1f in free () from /lib/x86_64-linux-gnu/libc.so.6 11 0x00007f0422edd779 in qfree (mt=0x7f0423047ca0 <MTYPE_HASH_BUCKET>, ptr=0x55fc8bc81980) at ../lib/memory.c:130 12 0x00007f0422eb97e2 in hash_clean (hash=0x55fc8b979a60, free_func=0x55fc8a529478 <svd_nh_del_terminate>) at ../lib/hash.c:290 13 0x00007f0422eb98a1 in hash_clean_and_free (hash=0x55fc8a675920 <svd_nh_table>, free_func=0x55fc8a529478 <svd_nh_del_terminate>) at ../lib/hash.c:305 14 0x000055fc8a5323a5 in zebra_vxlan_terminate () at ../zebra/zebra_vxlan.c:6099 15 0x000055fc8a4c9227 in zebra_router_terminate () at ../zebra/zebra_router.c:276 16 0x000055fc8a4413b3 in zebra_finalize (dummy=0x7fffb881c1d0) at ../zebra/main.c:269 17 0x00007f0422f44387 in event_call (thread=0x7fffb881c1d0) at ../lib/event.c:2011 18 0x00007f0422ecb6fa in frr_run (master=0x55fc8b733cb0) at ../lib/libfrr.c:1243 19 0x000055fc8a441987 in main (argc=14, argv=0x7fffb881c4a8) at ../zebra/main.c:584 Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit 1d4f5b9b19588d77d3eaf06440c26a8c974831a3)
2024-12-03zebra: separate zebra ZAPI server open and acceptMark Stapp
Separate zebra's ZAPI server socket handling into two phases: an early phase that opens the socket, and a later phase that starts listening for client connections. Signed-off-by: Mark Stapp <mjs@cisco.com> (cherry picked from commit 506097a1b96974c261411edd25330ceaf90fa3db)
2024-10-31zebra: Add missing new line for help stringDonatas Abraitis
``` -A, --asic-offload FRR is interacting with an asic underneath the linux kernel --v6-with-v4-nexthops Underlying dataplane supports v6 routes with v4 nexthops -s, --nl-bufsize Set netlink receive buffer size ``` Fixes: 1f5611c06d1c243b42279748788f0627793ead9c ("zebra: Allow zebra cli to accept v6 routes with v4 nexthops") Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 25ae643996d338b8230fb15a9064843fe85de224)
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-18Merge pull request #17131 from FRRouting/mergify/bp/stable/10.0/pr-17116Donatas Abraitis
zebra: unlock node only after operation in zebra_free_rnh() (backport #17116)
2024-10-16zebra: fix heap-use-after free on ns shutdownPhilippe Guibert
The following ASAN issue has been observed: > ERROR: AddressSanitizer: heap-use-after-free on address 0x6160000acba4 at pc 0x55910c5694d0 bp 0x7ffe3a8ac850 sp 0x7ffe3a8ac840 > READ of size 4 at 0x6160000acba4 thread T0 > #0 0x55910c5694cf in ctx_info_from_zns zebra/zebra_dplane.c:3315 > #1 0x55910c569696 in dplane_ctx_ns_init zebra/zebra_dplane.c:3331 > #2 0x55910c56bf61 in dplane_ctx_nexthop_init zebra/zebra_dplane.c:3680 > #3 0x55910c5711ca in dplane_nexthop_update_internal zebra/zebra_dplane.c:4490 > #4 0x55910c571c5c in dplane_nexthop_delete zebra/zebra_dplane.c:4717 > #5 0x55910c61e90e in zebra_nhg_uninstall_kernel zebra/zebra_nhg.c:3413 > #6 0x55910c615d8a in zebra_nhg_decrement_ref zebra/zebra_nhg.c:1919 > #7 0x55910c6404db in route_entry_update_nhe zebra/zebra_rib.c:454 > #8 0x55910c64c904 in rib_re_nhg_free zebra/zebra_rib.c:2822 > #9 0x55910c655be2 in rib_unlink zebra/zebra_rib.c:4212 > #10 0x55910c6430f9 in zebra_rtable_node_cleanup zebra/zebra_rib.c:968 > #11 0x7f26f275b8a9 in route_node_free lib/table.c:75 > #12 0x7f26f275bae4 in route_table_free lib/table.c:111 > #13 0x7f26f275b749 in route_table_finish lib/table.c:46 > #14 0x55910c65db17 in zebra_router_free_table zebra/zebra_router.c:191 > #15 0x55910c65dfb5 in zebra_router_terminate zebra/zebra_router.c:244 > #16 0x55910c4f40db in zebra_finalize zebra/main.c:249 > #17 0x7f26f2777108 in event_call lib/event.c:2011 > #18 0x7f26f264180e in frr_run lib/libfrr.c:1212 > #19 0x55910c4f49cb in main zebra/main.c:531 > #20 0x7f26f2029d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 > #21 0x7f26f2029e3f in __libc_start_main_impl ../csu/libc-start.c:392 > #22 0x55910c4b0114 in _start (/usr/lib/frr/zebra+0x1ae114) It happens with FRR using the kernel. During shutdown, the namespace identifier is attempted to be obtained by zebra, in an attempt to prepare zebra dataplane nexthop messages. Fix this by accessing the ns structure. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> (cherry picked from commit 7ae70eb5ef48e565427b416e22a1ccbed1e96120)
2024-10-16zebra: unlock node only after operation in zebra_free_rnh()Enke Chen
Move route_unlock_node() after rnh_list_del(). Signed-off-by: Enke Chen <enchen@paloaltonetworks.com> (cherry picked from commit 5b6ff51b8ae7f8c7348cea4de9543956f32641a7)
2024-10-04zebra: Fix crash during reconnectIgor Zhukov
fpm_enqueue_rmac_table expects an fpm_rmac_arg* as its argument. The issue can be reproduced by dropping the TCP session using: ss -K dst 127.0.0.1 dport = 2620 I used Fedora 40 and frr 9.1.2 and I got the gdb backtrace: (gdb) bt 0 0x00007fdd7d6997ea in fpm_enqueue_rmac_table (bucket=0x2134dd0, arg=0x2132b60) at zebra/dplane_fpm_nl.c:1217 1 0x00007fdd7dd1560d in hash_iterate (hash=0x21335f0, func=0x7fdd7d6997a0 <fpm_enqueue_rmac_table>, arg=0x2132b60) at lib/hash.c:252 2 0x00007fdd7dd1560d in hash_iterate (hash=0x1e5bf10, func=func@entry=0x7fdd7d698900 <fpm_enqueue_l3vni_table>, arg=arg@entry=0x7ffed983bef0) at lib/hash.c:252 3 0x00007fdd7d698b5c in fpm_rmac_send (t=<optimized out>) at zebra/dplane_fpm_nl.c:1262 4 0x00007fdd7dd6ce22 in event_call (thread=thread@entry=0x7ffed983c010) at lib/event.c:1970 5 0x00007fdd7dd20758 in frr_run (master=0x1d27f10) at lib/libfrr.c:1213 6 0x0000000000425588 in main (argc=10, argv=0x7ffed983c2e8) at zebra/main.c:492 Signed-off-by: Igor Zhukov <fsb4000@yandex.ru> (cherry picked from commit a3877e4444dc3a1253135d3b9479935fc9a966f8)
2024-09-25zebra: Add missing proto translationsDonald Sharp
Add missing isis and eigrp proto translations. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit f53dde0e5921aafae0a00d993257ea7423b5ee97)
2024-09-25zebra: Correctly report metricsDonald Sharp
Report the routes metric in IPFORWARDMETRIC1 and return -1 for the other metrics as required by the IP-FORWARD-MIB. inetCidrRouteMetric2 OBJECT-TYPE SYNTAX Integer32 MAX-ACCESS read-create STATUS current DESCRIPTION "An alternate routing metric for this route. The semantics of this metric are determined by the routing- protocol specified in the route's inetCidrRouteProto value. If this metric is not used, its value should be set to -1." DEFVAL { -1 } ::= { inetCidrRouteEntry 13 } I've included metric2 but it's the same for all of them. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit e41ae0acc1940b568def5018efad3df019023f85)
2024-09-25zebra: Let's use memset instead of walking bytes and setting to 0Donald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit 659cd66427ac8a6fe705b4a319245b7c88f80c05)
2024-09-25zebra: Fix snmp walk of zebra ribDonald Sharp
The snmp walk of the zebra rib was skipping entries because in_addr_cmp was replaced with a prefix_cmp which worked slightly differently causing parts of the zebra rib tree to be skipped. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit ecd9d441b082e3f24139eb96915b18fc17996c08)
2024-08-12zebra: Ensure non-equal id's are not same nhg'sDonald Sharp
The function zebra_nhg_hash_equal is only used as a hash function for storage of NHG's and retrieval. If you have say two nhg's: 31 (25/26) 32 (25/26) This function would return them as being equal. Which of course leads to the problem when you attempt to hash_release 32 but release 31 from the hash. Then later when you attempt to do hash comparisons 32 has actually been freed leaving to use after free situations and shit goes down hill fast. This hash is only used as part of the hash comparison function for nexthop group storage. Since this is so let's always return the 31/32 nhg's are not equal at all. We possibly have a different problem where we are creating 31 and 32 ( when 31 should have just been used instead of 32 ) but we need to prevent any type of hash release problem at all. This supercedes any other issue( that should be tracked down on it's own ). Since you can have use after free situation that leads to a crash -vs- some possible nexthop group duplication which is very minor in comparison. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit 5a1b61aeba1b83825e1656a047aab35be0c1db55)
2024-07-14zebra: Fix to avoid two Vrfs with same table idsRajasekar Raja
During internal testing, when the following sequence is followed, two non default vrfs end up pointing to the same table-id - Initially vrf201 has table id 1002 - ip link add dev vrf202 type vrf table 1002 - ip link set dev vrf202 up - ip link set dev <intrerface> master vrf202 This will ideally lead to zebra exit since this is a misconfiguration as expected. However if we perform a restart frr.service at this point, we end up having two vrfs pointing to same table-id and bad things can happen. This is because in the interface_vrf_change, we incorrectly check for vrf_lookup_by_id() to evaluate if there is a misconfig. This works well for a non restart case but not for the startup case. root@mlx-3700-20:mgmt:/var/log/frr# sudo vtysh -c "sh vrf" vrf mgmt id 37 table 1001 vrf vrf201 id 46 table 1002 vrf vrf202 id 59 table 1002 >>>> Fix: in all cases of misconfiguration, exit zebra as expected. Ticket :#3970414 Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com> (cherry picked from commit c77e15710d6a3a9be71f41a9ce608f06b2795dfb)
2024-06-21zebra: fix evpn mh bond member proto reinstallChirag Shah
In case of EVPN MH bond, a member port going in protodown state due to external reason (one case being linkflap), frr updates the state correctly but upon manually clearing external reason trigger FRR to reinstate protodown without any reason code. Fix is to ensure if the protodown reason was external and new state is to have protodown 'off' then do no reinstate protodown. Ticket: #3947432 Testing: switch:#ip link show swp1 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff protodown on protodown_reason <linkflap> switch:#ip link set swp1 protodown off protodown_reason linkflap off switch:#ip link show swp1 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit e4d843b438ae7cbae89ae47af0754fb1db153c6c)
2024-05-21zebra: Deny the routes if ip protocol CLI refers to an undefined rmapPooja Jagadeesh Doijode
Currently zebra does not deny the routes if `ip protocol <proto> route-map FOO` commmand is configured with reference to an undefined route-map (FOO in this case). However, on FRR restart, in zebra_route_map_check() routes get denied if route-map name is available but the route-map is not defined. This change was introduced in fd303a4ba14c762550db972317e1e88528768005. Fix: When `ip protocol <proto> route-map FOO` CLI is configured with reference to an undefined route-map FOO, let the processing in ip_protocol_rm_add() and ip_protocol_rm_del() go through so that zebra can deny the routes instead of simply returning. This will result in consistent behavior. Testing Done: Before fix: ``` spine-1# configure spine-1(config)# ip protocol bgp route-map rmap7 root@spine-1:mgmt:/var/home/cumulus# vtysh -c "show run" | grep rmap7 ip protocol bgp route-map rmap7 root@spine-1:mgmt:/var/home/cumulus# spine-1(config)# do show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric, Z - FRR, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure C>* 27.0.0.1/32 is directly connected, lo, 02:27:45 B>* 27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1, weight 1, 02:27:35 B>* 27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2, weight 1, 02:27:40 B>* 27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3, weight 1, 02:27:40 B>* 27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4, weight 1, 02:27:40 ``` After fix: ``` spine-1(config)# ip protocol bgp route-map route-map67 spine-1(config)# do show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric, Z - FRR, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure C>* 27.0.0.1/32 is directly connected, lo, 00:35:03 B 27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1 inactive, weight 1, 00:34:58 B 27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2 inactive, weight 1, 00:34:57 B 27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3 inactive, weight 1, 00:34:57 B 27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4 inactive, weight 1, 00:34:58 spine-1(config)# root@spine-1:mgmt:/var/home/cumulus# ip route show root@spine-1:mgmt:/var/home/cumulus# ``` Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com> (cherry picked from commit 705e8ef78f84dea3af5943a74571f968ad076c8d)
2024-05-18zebra: fix mpls commandanlan_cs
Configured with "mpls label bind 1.1.1.1/32 explicit-null", the running configuration is: ``` ! mpls label bind 1.1.1.1/32 IPv4 Explicit Null ! ``` After this commit, the running configuration is: ``` ! mpls label bind 1.1.1.1/32 explicit-null ! ``` And add the support for the "no" form: ``` anlan(config)# mpls label bind 1.1.1.1/32 explicit-null anlan(config)# no mpls label bind 1.1.1.1/32 explicit-null ``` Signed-off-by: anlan_cs <anlan_cs@tom.com> (cherry picked from commit 05ad3ccb034c174d2e853e88b826ca0db1e77f45)
2024-05-08zebra: fix EVPN svd based remote nh neigh delChirag Shah
In the context of SVD (Single VxLAN Device) for L3VNI, the remote VTEP's nexthop is programmed neighbor entry against SVD along with neighbor entry against SVI. However, when L3VNI is removed or the VRF is disabled, all SVI based remote nexthop neighbors are uninstalled and deleted. The SVD based neigh entries remains in Zebra and the Kernel. Subsequently, when reconfiguring L3VNI and relearning the same nexthop, the neighbor entry is not programmed is because it is not removed from Zebra SVD neighbor hash table, leading to the failure to reprogram the entry. With this fix, the SVD nexthop neigh entry is uninstalled and deleted from Zebra and Kernel. Ticket: #3729045 Testing: borderleaf:# ip neigh show 2.2.2.2 2.2.2.2 dev vlan2560_l3 lladdr 00:01:00:00:1d:09 extern_learn NOARP proto zebra 2.2.2.2 dev vxlan99 lladdr 00:01:00:00:1d:09 extern_learn NOARP proto zebra With the fix: Zebra log shows both enties SVD (vxlan99) and SVI (vlan2560_l3) neighbor entries are deleted. 2024/05/03 18:41:33.527125 ZEBRA: [NH6N7-54CD1] Tx RTM_DELNEIGH family ipv4 IF vxlan99(16) Neigh 2.2.2.2 MAC null flags 0x10 state 0x0 ext_flags 0x0 2024/05/03 18:41:33.527128 ZEBRA: [NH6N7-54CD1] Tx RTM_DELNEIGH family ipv4 IF vlan2560_l3(18) Neigh 2.2.2.2 MAC null flags 0x10 state 0x0 ext_flags 0x0 borderleaf:# ip neigh show 2.2.2.2 borderleaf:# Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit fde6dd7bb9161cf58fdd8ca066cce77bad159c9d)
2024-04-23lib, 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> (cherry picked from commit 29c1ff446e581fc403d155fd1d00b7c944cba56a)
2024-04-18lib, zebra: fix exit commandsIgor Ryzhov
If a command is not marked as `YANG`-converted, the current command batching buffer is flushed before executing the command. We shouldn't flush the buffer when executing an `exit` command. It should only be flushed if the next command is not `YANG`-converted, which is checked by the command itself, not the previous `exit`. Fixes #15706. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com> (cherry picked from commit 57811a53ba65f755cb2ff9cdc682b8a249144ffa)
2024-04-16zebra: fix encoded DNSSL lengthIgor Ryzhov
The encoded DNSSL length is not set so the value is missing from RA packet. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com> (cherry picked from commit 8d6f7a43974633abb15a57b24bc30f462bd8841e)
2024-04-01zebra: don't deref vxlan-vni arrayMark Stapp
Null-check the vxlan-vni array info coming into zebra from the dataplane. Signed-off-by: Mark Stapp <mjs@cisco.com> (cherry picked from commit 75ef259b1dd9273478414ea0684243f535ec8f33)
2024-03-30vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ↵Piotr Suchy
ip route vrf all json' Command 'show ip route vrf <vrf_name> json' returns a valid json object, however if instead of <vrf_name> we specify 'all', we get an invalid json object, like: {//vrf1 routes}{//vrf2 routes}{vrf3 routes} After the fix: {"vrf1":{//vrf1 routes},"vrf2:{//vrf2 routes},"vrf3":{//vrf3 routes}} Which is a valid json object, that can be parsed effectively using built-in modules. The rest of the commands remains unaffected and behave the same. Signed-off-by: Piotr Suchy <psuchy@akamai.com> (cherry picked from commit 0e2fc3d67f1d358896a764373f41cb59c095eda9)
2024-03-22zebra: Fix crash on macvlan link down/upTomi Salminen
Whenever a link up change was detected on a macvlan device where the linked device wasn't visible in the namespace zebra was running in, the linked zebra interface was NULL. This was already handled in the event of a link down, but was ommitted from the upside. Added the same null check to the up-side. Signed-off-by: Tomi Salminen <tlsalmin@gmail.com> (cherry picked from commit bdf6a9ba810b58146371e8a0000397d2ae9ea956)
2024-03-18zebra: fix route deletion during zebra shutdownAlexander Skorichenko
Split zebra's vrf_terminate() into disable() and delete() stages. The former enqueues all events for the dplane thread. Memory freeing is performed in the second stage. Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com> (cherry picked from commit 444ce317b2af491b5cdc321286772627a5d4c8ea)
2024-02-27zebra: fix crash if macvlan link in another netnsLouis Scalbert
A macvlan interface can have its underlying link-interface in another namespace (aka. netns). However, by default, zebra does not know the interface from the other namespaces. It results in a crash the pointer to the link interface is NULL. > 6 0x0000559d77a329d3 in zebra_vxlan_macvlan_up (ifp=0x559d798b8e00) at /root/frr/zebra/zebra_vxlan.c:4676 > 4676 link_zif = link_ifp->info; > (gdb) list > 4671 struct interface *link_ifp, *link_if; > 4672 > 4673 zif = ifp->info; > 4674 assert(zif); > 4675 link_ifp = zif->link; > 4676 link_zif = link_ifp->info; > 4677 assert(link_zif); > 4678 > (gdb) p zif->link > $2 = (struct interface *) 0x0 > (gdb) p zif->link_ifindex > $3 = 15 Fix the crash by returning when the macvlan link-interface is in another namespace. No need to go further because any vxlan under the macvlan interface would not be accessible by zebra. Link: https://github.com/FRRouting/frr/issues/15370 Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> (cherry picked from commit 44e6e3868d7a1488447f2be446dbd7cb5a5559ce)
2024-02-25lib: fix nb callbacks for containers inside choice caseIgor Ryzhov
Containers inside a choice's case must be treated as presence containers as they can be explicitly created and deleted. They must have `create` and `destroy` callbacks, otherwise the internal data they represent may never be deleted. The issue can be reproduced with the following steps: - create an access-list with destination-network params ``` # access-list test seq 1 permit ip any 10.10.10.0 0.0.0.255 ``` - delete the `destination-network` container ``` # mgmt delete-config /frr-filter:lib/access-list[name='test'][type='ipv4']/entry[sequence='1']/destination-network # mgmt commit apply MGMTD: No changes found to be committed! ``` As the `destination-network` container is non-presence, and all its leafs are mandatory, mgmtd doesn't see any changes to be commited and simply updates its YANG data tree without passing any updates to backend daemons. This commit fixes the issue by requiring `create` and `destroy` callbacks for containers inside choice's cases. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com> (cherry picked from commit 0b905f740459291bca12e552aea4975fb46e9d98)
2024-02-07Merge pull request #15314 from ↵Donald Sharp
opensourcerouting/fix/remove_bgp_evpn_attr_get_df_pref bgpd: A couple random EVPN findings
2024-02-06zebra: Use uint16_t for DF preferenceDonatas Abraitis
It's 16-bits everywhere, not sure why it was here as 32. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-05zebra: Reorg `struct route_entry` to have important bits firstDonald Sharp
The `struct route_entry` had items that were almost never used at the front of the data structure resulting in items that would be loaded first into memory that were never used. Let's reorg a tiny bit and put all the frequently used items in the first cache line. I'm sure people will notice .000000001 speedup new layout: sharpd@eva /w/h/s/frr1 (reorg_route_entry)> /home/sharpd/pahole/build/pahole --reorganize --show_reorg_steps -C route_entry zebra/.libs/zebra struct route_entry { struct re_list_item next; /* 0 8 */ struct nhg_hash_entry * nhe; /* 8 8 */ uint32_t nhe_id; /* 16 4 */ uint32_t nhe_installed_id; /* 20 4 */ int type; /* 24 4 */ vrf_id_t vrf_id; /* 28 4 */ uint32_t table; /* 32 4 */ uint32_t metric; /* 36 4 */ uint32_t mtu; /* 40 4 */ uint32_t nexthop_mtu; /* 44 4 */ uint32_t flags; /* 48 4 */ uint32_t status; /* 52 4 */ uint32_t dplane_sequence; /* 56 4 */ uint16_t instance; /* 60 2 */ uint8_t distance; /* 62 1 */ /* XXX 1 byte hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ route_tag_t tag; /* 64 4 */ /* XXX 4 bytes hole, try to pack */ time_t uptime; /* 72 8 */ struct re_opaque * opaque; /* 80 8 */ struct nexthop_group fib_ng; /* 88 32 */ struct nexthop_group fib_backup_ng; /* 120 32 */ /* size: 152, cachelines: 3, members: 20 */ /* sum members: 147, holes: 2, sum holes: 5 */ /* last cacheline: 24 bytes */ }; Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-04zebra: coverity fixesIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-02Merge pull request #10151 from pguibert6WIND/ensure_routing_protocols_good_bwDonald Sharp
zebra: avoid having speed set to UINT32_MAX
2024-02-02Merge pull request #15216 from donaldsharp/zebra_opaque_mem_leakJafar Al-Gharaibeh
zebra: Fix opaque memory leak in rare situation
2024-02-01*: create a single registry of daemons' default port valuesMark Stapp
Create a single registry of default port values that daemons are using. Most of these are vty ports, but there are some others for features like ospfapi and zebra FPM. Signed-off-by: Mark Stapp <mjs@labn.net>
2024-01-29doc, yang, zebra: allow bandwidth up to 1 terabit/secPhilippe Guibert
Allow bandwidth up to 1000000 Mb/s (ie. 1 Tb/s) and document it. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-29zebra: fix speed set to UINT32_MAXPhilippe Guibert
get_iflink_speed() returns UINT32_MAX when the speeds is unknown. Routing daemons (at least ospfd) interprets it as the high value. Return errors in get_iflink_speed() to avoid the confusion. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-29zebra: fix compiler warning about truncation.Christian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-28lib, mgmtd, zebra: cleanup of zebra conversion to mgmtdIgor Ryzhov
- use `apply_finish` callback when possible to avoid multiple applies per commit - move table range working to the CLI handler - remove unnecessary conditional compilation - remove unnecessary boolean conversion Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert to mgmtdIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert vrf configuration output to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: make vrf netns commands do nothingIgor Ryzhov
These commands don't really provide any functionality. VRF is associated with netns automatically based on its name, and it's not possible to associate VRF and netns with different names with these commands: - When trying to assosiate a VRF with an already existing netns with a different name: `NS /run/netns/test is already configured with VRF 1(test)` - When trying to assiciate a VRF with a non-existing netns, so they become linked once the netns is created: `Invalid pathname for /run/netns/test: No such file or directory` - When doing "no netns" to unlink the netns and link it back to the same VRF: `VRF 1 is already configured with VRF test` - When doing "no netns" to unlink the netns and link it to another VRF: `Can not associate NS 4294967295 with NETNS /run/netns/test` As shown above, not a single usecase is working. We can't remove them completely to preserve backwards-compatibility, so just make them empty. The main reason for this change is not to spend a lot of time trying to figure out how to convert them to northbound. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert table range command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert resolve-via-default commands to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: fix vni NB conversionIgor Ryzhov
- unnecessary command duplication - usage of oper data during validation - unnecessary checks for things that can't happen Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert route-map delay-timer command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert ip nht commands to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert ip protocol commands to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>