]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Do not process VRF import/export to/from auto created VRF instances
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 28 Jul 2024 11:26:13 +0000 (14:26 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Mon, 29 Jul 2024 09:20:17 +0000 (09:20 +0000)
Fixes the crash:

```
(gdb) bt
0  __pthread_kill_implementation (no_tid=0, signo=11, threadid=124583315603008) at ./nptl/pthread_kill.c:44
1  __pthread_kill_internal (signo=11, threadid=124583315603008) at ./nptl/pthread_kill.c:78
2  __GI___pthread_kill (threadid=124583315603008, signo=signo@entry=11) at ./nptl/pthread_kill.c:89
3  0x0000714ed0242476 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
4  0x0000714ed074cfb7 in core_handler (signo=11, siginfo=0x7ffe6d9792b0, context=0x7ffe6d979180) at lib/sigevent.c:258
5  <signal handler called>
6  0x000060f55e33ffdd in route_table_get_info (table=0x0) at ./lib/table.h:177
7  0x000060f55e340053 in bgp_dest_table (dest=0x60f56dabb840) at ./bgpd/bgp_table.h:156
8  0x000060f55e340c9f in is_route_injectable_into_vpn (pi=0x60f56dbc4a60) at ./bgpd/bgp_mplsvpn.h:331
9  0x000060f55e34507c in vpn_leak_from_vrf_update (to_bgp=0x60f56da52070, from_bgp=0x60f56da75af0, path_vrf=0x60f56dbc4a60) at bgpd/bgp_mplsvpn.c:1575
10 0x000060f55e346657 in vpn_leak_from_vrf_update_all (to_bgp=0x60f56da52070, from_bgp=0x60f56da75af0, afi=AFI_IP) at bgpd/bgp_mplsvpn.c:2028
11 0x000060f55e340c10 in vpn_leak_postchange (direction=BGP_VPN_POLICY_DIR_TOVPN, afi=AFI_IP, bgp_vpn=0x60f56da52070, bgp_vrf=0x60f56da75af0) at ./bgpd/bgp_mplsvpn.h:310
12 0x000060f55e34a692 in vpn_leak_postchange_all () at bgpd/bgp_mplsvpn.c:3737
13 0x000060f55e3d91fc in router_bgp (self=0x60f55e5cbc20 <router_bgp_cmd>, vty=0x60f56e2d7660, argc=3, argv=0x60f56da19830) at bgpd/bgp_vty.c:1601
14 0x0000714ed069ddf5 in cmd_execute_command_real (vline=0x60f56da32a80, vty=0x60f56e2d7660, cmd=0x0, up_level=0) at lib/command.c:1002
15 0x0000714ed069df6e in cmd_execute_command (vline=0x60f56da32a80, vty=0x60f56e2d7660, cmd=0x0, vtysh=0) at lib/command.c:1061
16 0x0000714ed069e51e in cmd_execute (vty=0x60f56e2d7660, cmd=0x60f56dbf07d0 "router bgp 100\n", matched=0x0, vtysh=0) at lib/command.c:1227
17 0x0000714ed076faa0 in vty_command (vty=0x60f56e2d7660, buf=0x60f56dbf07d0 "router bgp 100\n") at lib/vty.c:616
18 0x0000714ed07719c4 in vty_execute (vty=0x60f56e2d7660) at lib/vty.c:1379
19 0x0000714ed07740f0 in vtysh_read (thread=0x7ffe6d97c700) at lib/vty.c:2374
20 0x0000714ed07685c4 in event_call (thread=0x7ffe6d97c700) at lib/event.c:1995
21 0x0000714ed06e3351 in frr_run (master=0x60f56d1d2e40) at lib/libfrr.c:1232
22 0x000060f55e2c4b44 in main (argc=7, argv=0x7ffe6d97c978) at bgpd/bgp_main.c:555
(gdb)
```

Fixes https://github.com/FRRouting/frr/issues/16484

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 04f9372409a11a59dafbbf8423f0cf832b99cf0e)

bgpd/bgp_mplsvpn.c
bgpd/bgp_vty.c

index 90881621b331e0b2b181a696f9a2987f22b2a086..1bc1a47c69a0b10581c5d8bc5f7e248cd0b08a78 100644 (file)
@@ -3730,6 +3730,9 @@ void vpn_leak_postchange_all(void)
                if (bgp->inst_type != BGP_INSTANCE_TYPE_VRF)
                        continue;
 
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO))
+                       continue;
+
                vpn_leak_postchange(
                        BGP_VPN_POLICY_DIR_TOVPN,
                        AFI_IP,
@@ -3749,6 +3752,9 @@ void vpn_leak_postchange_all(void)
                if (bgp->inst_type != BGP_INSTANCE_TYPE_VRF)
                        continue;
 
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO))
+                       continue;
+
                vpn_leak_postchange(
                        BGP_VPN_POLICY_DIR_FROMVPN,
                        AFI_IP,
index 38c335f75a3fa21f21d0232b6263c99459d058c6..1a87799ad2842839b57706bfb3c8029e0fa445e4 100644 (file)
@@ -1703,7 +1703,7 @@ DEFUN (no_router_bgp,
                                        continue;
 
                                if (CHECK_FLAG(tmp_bgp->vrf_flags, BGP_VRF_AUTO))
-                                       continue;
+                                       bgp_delete(tmp_bgp);
 
                                if (CHECK_FLAG(
                                            tmp_bgp->af_flags[AFI_IP]