frr icon indicating copy to clipboard operation
frr copied to clipboard

bgpd: fix no bgp as-path access-list issue

Open fdumontet6WIND opened this issue 1 year ago • 3 comments

router bgp 65001 no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as external neighbor 192.168.1.2 timers 3 10 address-family ipv4 unicast neighbor 192.168.1.2 route-map r2 in exit-address-family ! ip prefix-list p1 seq 5 permit 172.16.255.31/32 ! route-map r2 permit 10 match ip address prefix-list p1 set as-path exclude 65003 route-map r2 permit 20 set as-path exclude all !

we make the following commands

bgp as-path access-list FIRST permit ^65 bgp as-path access-list SECOND permit 2 route-map r2 permit 6 set as-path exclude as-path-access-list SECOND

and then

no bgp as-path access-list SECOND permit 2 clear bgp *

we have the following crash in bgp

           Stack trace of thread 536083:
            #0  0x00007f87f8aacfe1 raise (libpthread.so.0 + 0x12fe1)
            https://github.com/FRRouting/frr/pull/1  0x00007f87f8cf6870 core_handler (libfrr.so.0 +
	    0xf6870)
            https://github.com/FRRouting/frr/issues/2  0x00007f87f8aad140 __restore_rt (libpthread.so.0 +
	    0x13140)
            https://github.com/FRRouting/frr/issues/3  0x00007f87f89a5122 __GI___regexec (libc.so.6 +
	    0xdf122)
            https://github.com/FRRouting/frr/issues/4  0x000055d7f198b4a7 aspath_filter_exclude_acl (bgpd +
	    0x2054a7)
            https://github.com/FRRouting/frr/pull/5  0x000055d7f1902187 route_set_aspath_exclude (bgpd +
	    0x17c187)
            https://github.com/FRRouting/frr/pull/6  0x00007f87f8ce54b0 route_map_apply_ext (libfrr.so.0
	    + 0xe54b0)
            https://github.com/FRRouting/frr/pull/7  0x000055d7f18da925 bgp_input_modifier (bgpd +
	    0x154925)
            https://github.com/FRRouting/frr/pull/8  0x000055d7f18e0647 bgp_update (bgpd + 0x15a647)
            https://github.com/FRRouting/frr/issues/9  0x000055d7f18e4772 bgp_nlri_parse_ip (bgpd +
	    0x15e772)
            https://github.com/FRRouting/frr/pull/10 0x000055d7f18c38ae bgp_nlri_parse (bgpd + 0x13d8ae)
            https://github.com/FRRouting/frr/issues/11 0x000055d7f18c6b7a bgp_update_receive (bgpd +
	    0x140b7a)
            https://github.com/FRRouting/frr/pull/12 0x000055d7f18c8ff3 bgp_process_packet (bgpd +
	    0x142ff3)
            https://github.com/FRRouting/frr/pull/13 0x00007f87f8d0dce0 thread_call (libfrr.so.0 +
	    0x10dce0)
            https://github.com/FRRouting/frr/issues/14 0x00007f87f8cacb28 frr_run (libfrr.so.0 + 0xacb28)
            https://github.com/FRRouting/frr/pull/15 0x000055d7f18435da main (bgpd + 0xbd5da)
            https://github.com/FRRouting/frr/issues/16 0x00007f87f88e9d0a __libc_start_main (libc.so.6 +
	    0x23d0a)
            https://github.com/FRRouting/frr/issues/17 0x000055d7f18415fa _start (bgpd + 0xbb5fa)

analysis

crash is due to the fact that there were always a pointer from as-path exclude to deleted as-path access list.

fix we add a backpointer mechanism to manage the dependency beetween as-path access-list and aspath exclude.

fdumontet6WIND avatar Feb 16 '24 16:02 fdumontet6WIND

ci:rerun

fdumontet6WIND avatar Feb 17 '24 18:02 fdumontet6WIND

@Mergifyio backport dev/10.0 stable/9.1

ton31337 avatar Feb 18 '24 12:02 ton31337

backport dev/10.0 stable/9.1

✅ Backports have been created

mergify[bot] avatar Feb 18 '24 12:02 mergify[bot]

ci:rerun

fdumontet6WIND avatar Feb 20 '24 18:02 fdumontet6WIND

failure not linked with pull request ci:rerun

fdumontet6WIND avatar Feb 26 '24 17:02 fdumontet6WIND