FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.21k stars 1.24k forks source link

"show bgp l2vpn evpn json" command results in bgp restart #4501

Closed karamalla0406 closed 5 years ago

karamalla0406 commented 5 years ago

"show bgp l2vpn evpn json" command results in BGP daemon crash, if there are EVPN type-2 routes to be displayed.

Stack Trace:

Thread 1 "bgpd" received signal SIGSEGV, Segmentation fault. 0x00007f84889e59c3 in json_object_object_add () from /lib/x86_64-linux-gnu/libjson-c.so.2 (gdb) bt

0 0x00007f84889e59c3 in json_object_object_add () from /lib/x86_64-linux-gnu/libjson-c.so.2

1 0x00000000004bbf84 in bgp_show_ethernet_vpn (vty=0x202e380, prd=0x0, type=bgp_show_type_normal, output_arg=0x0, option=0, use_json=)

at bgpd/bgp_evpn_vty.c:1190

2 0x00007f8488f23782 in cmd_execute_command_real (vline=vline@entry=0x1ffdec0, vty=vty@entry=0x202e380, cmd=cmd@entry=0x0, filter=FILTER_RELAXED) at lib/command.c:1059

3 0x00007f8488f25923 in cmd_execute_command (vline=vline@entry=0x1ffdec0, vty=vty@entry=0x202e380, cmd=cmd@entry=0x0, vtysh=vtysh@entry=0) at lib/command.c:1118

4 0x00007f8488f25a5b in cmd_execute (vty=vty@entry=0x202e380, cmd=cmd@entry=0x202fa10 "show bgp l2vpn evpn json ", matched=matched@entry=0x0, vtysh=vtysh@entry=0)

at lib/command.c:1272

5 0x00007f8488f60b31 in vty_command (vty=vty@entry=0x202e380, buf=0x202fa10 "show bgp l2vpn evpn json ") at lib/vty.c:525

6 0x00007f8488f60d2d in vty_execute (vty=vty@entry=0x202e380) at lib/vty.c:1294

7 0x00007f8488f62d5d in vtysh_read (thread=) at lib/vty.c:2137

8 0x00007f8488f5cdcb in thread_call (thread=thread@entry=0x7fff3cb6a890) at lib/thread.c:1547

9 0x00007f8488f38f15 in frr_run (master=0x1a17e80) at lib/libfrr.c:1021

10 0x000000000041e91e in main (argc=4, argv=0x7fff3cb6abe8) at bgpd/bgp_main.c:485

(gdb) fr 1

1 0x00000000004bbf84 in bgp_show_ethernet_vpn (vty=0x202e380, prd=0x0, type=bgp_show_type_normal, output_arg=0x0, option=0, use_json=)

at bgpd/bgp_evpn_vty.c:1190

1190 json_object_object_add(json_nroute, buf, (gdb) list 1185 output_count++; 1186 } 1187 if (use_json) { 1188 json_object_object_add(json_prefix_info, 1189 "paths", json_array); 1190 json_object_object_add(json_nroute, buf, 1191 json_prefix_info); 1192 } 1193 } 1194 (gdb) p json_nroute $1 = (json_object *) 0x0

dev# show bgp l2vpn evpn BGP table version is 20, local router ID is 5.1.1.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path Route Distinguisher: as2 101:10003

> [5]:[0]:[32]:[141.1.1.1] 5.1.1.1 0 100 i > [5]:[0]:[32]:[141.1.1.2] 5.1.1.1 0 100 i > [5]:[0]:[32]:[141.1.1.3] 5.1.1.1 0 100 i > [5]:[0]:[32]:[141.1.1.4]

...... Route Distinguisher: ip 5.1.1.2:2

> [2]:[0]:[48]:[00:50:56:b5:12:35] 1.1.1.1 32768 i > [2]:[0]:[48]:[00:50:56:b5:12:35]:[32]:[22.1.1.5] 1.1.1.1 32768 i > [2]:[0]:[48]:[00:50:56:b5:d6:23]:[32]:[22.1.1.1] 1.1.1.1 32768 i > [2]:[0]:[48]:[00:50:56:b5:d6:23]:[128]:[fe80::250:56ff:feb5:d623] 1.1.1.1 32768 i *> [3]:[0]:[32]:[1.1.1.1] 1.1.1.1 32768 i Route Distinguisher: ip 5.1.1.2:3

Configuration:

dev# show running-config Building configuration...

Current configuration: ! frr version 7.2-dev-MyOwnFRRVersion frr defaults traditional hostname dev log file /var/log/frr/bgp.log log syslog informational service integrated-vtysh-config ! debug zebra events debug zebra kernel debug zebra vxlan ! vrf vrf-vni10001 ip route 171.1.1.1/32 Null0 vni 10001 exit-vrf ! vrf vrf-vni10002 vni 10002 exit-vrf ! vrf vrf-vni10003 vni 10003 exit-vrf ! router bgp 200 bgp router-id 5.1.1.2 neighbor 52.1.1.1 remote-as 100 neighbor 52.1.1.1 update-source 52.1.1.2 neighbor 52.1.1.1 timers 5 15 ! address-family ipv4 unicast no neighbor 52.1.1.1 activate exit-address-family ! address-family l2vpn evpn neighbor 52.1.1.1 activate vni 300 advertise-default-gw exit-vni advertise-all-vni exit-address-family ! router bgp 200 vrf vrf-vni10001 bgp router-id 5.1.1.2 neighbor 53.1.1.1 remote-as 300 neighbor 5311::1 remote-as 300 ! address-family ipv4 unicast no neighbor 5311::1 activate exit-address-family ! address-family ipv6 unicast neighbor 5311::1 activate exit-address-family ! address-family l2vpn evpn advertise ipv4 unicast advertise ipv6 unicast exit-address-family ! router bgp 200 vrf vrf-vni10002 bgp router-id 5.1.1.2 neighbor 54.1.1.1 remote-as 300 neighbor 5411::1 remote-as 300 ! address-family ipv4 unicast no neighbor 5411::1 activate exit-address-family ! address-family ipv6 unicast neighbor 5411::1 activate exit-address-family ! address-family l2vpn evpn advertise ipv4 unicast advertise ipv6 unicast exit-address-family ! router bgp 200 vrf vrf-vni10003 bgp router-id 5.1.1.2 neighbor 55.1.1.1 remote-as 400 neighbor 5511::1 remote-as 400 ! address-family ipv4 unicast no neighbor 5511::1 activate exit-address-family ! address-family ipv6 unicast neighbor 5511::1 activate exit-address-family ! address-family l2vpn evpn advertise ipv4 unicast advertise ipv6 unicast exit-address-family ! line vty ! end

donaldsharp commented 5 years ago

I thought I put a fix out for this last week. Do you have a recent version of FRR?

donaldsharp commented 5 years ago

actually it's still in review https://github.com/FRRouting/frr/pull/4470/commits/26e424bafe4aa3e89627faf145bad277dd34218a

lkrishnamoor commented 5 years ago

I tested @donaldsharp 's fix for this issue. It looks like his diff fixes this crash. @srimohans @karamalla0406