summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmytro Shytyi <dmytro.shytyi@6wind.com>2024-08-08 15:53:11 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-08-22 05:19:37 +0000
commit4fa61713cfb1159f57dd99eb7cb017e5ec1f7962 (patch)
treee9b95e702449b21bb1daeaec51b52223f0459028
parent50521a90583524fdcd8961e124ded6602625f4e1 (diff)
bgpd: fix, do not access peer->notify.data when it is null
bgp crash on rt2 spotted when 2 commands launched consequently: T0: rr, config -> router bgp 65004 -> neighbor 192.168.12.2 password 8888 T1: rt2, snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.7336.4.2.1 T2: rt2 bgp is crashed. config rt2-bgp: --------------- ! debug bgp updates ! router bgp 65002 no bgp ebgp-requires-policy no bgp network import-check no bgp default ipv4-unicast neighbor 192.168.12.4 remote-as external neighbor 192.168.12.4 timers 1 3 neighbor 192.168.12.4 timers connect 1 neighbor 2001:db8::12:4 remote-as external neighbor 2001:db8::12:4 timers 1 3 neighbor 2001:db8::12:4 timers connect 1 ! address-family ipv4 unicast neighbor 192.168.12.4 activate neighbor 192.168.12.4 addpath-tx-all-paths exit-address-family address-family ipv6 unicast neighbor 2001:db8::12:4 activate exit-address-family ! agentx ! config rt2-snmpd: agentAddress 127.0.0.1,[::1] group public_group v1 public group public_group v2c public access public_group "" any noauth prefix all all none rocommunity public default view all included .1 iquerySecName frr rouser frr master agentx agentXSocket /etc/frr/agentx agentXPerms 777 755 root frr config rt2-zebra: ----------------- ! interface r2-eth0 ip address 192.168.12.2/24 ipv6 address 2001:db8::12:2/64 ! config rr-bgpd: --------------- ! debug bgp updates ! router bgp 65004 no bgp ebgp-requires-policy no bgp network import-check no bgp default ipv4-unicast neighbor 192.168.12.1 remote-as external neighbor 192.168.12.1 timers 1 3 neighbor 192.168.12.1 timers connect 1 neighbor 192.168.12.2 remote-as external neighbor 192.168.12.2 timers 1 3 neighbor 192.168.12.2 timers connect 1 neighbor 192.168.12.3 remote-as external neighbor 192.168.12.3 timers 1 3 neighbor 192.168.12.3 timers connect 1 neighbor 2001:db8::12:1 remote-as external neighbor 2001:db8::12:1 timers 1 3 neighbor 2001:db8::12:1 timers connect 1 neighbor 2001:db8::12:2 remote-as external neighbor 2001:db8::12:2 timers 1 3 neighbor 2001:db8::12:2 timers connect 1 neighbor 2001:db8::12:3 remote-as external neighbor 2001:db8::12:3 timers 1 3 neighbor 2001:db8::12:3 timers connect 1 ! address-family ipv4 unicast neighbor 192.168.12.1 activate neighbor 192.168.12.1 addpath-tx-all-paths neighbor 192.168.12.1 route-server-client neighbor 192.168.12.2 activate neighbor 192.168.12.2 addpath-tx-all-paths neighbor 192.168.12.2 route-server-client neighbor 192.168.12.3 activate neighbor 192.168.12.3 addpath-tx-all-paths neighbor 192.168.12.3 route-server-client exit-address-family address-family ipv6 unicast neighbor 2001:db8::12:1 activate neighbor 2001:db8::12:1 route-server-client neighbor 2001:db8::12:2 activate neighbor 2001:db8::12:2 route-server-client neighbor 2001:db8::12:3 activate neighbor 2001:db8::12:3 route-server-client exit-address-family ! agentx ! config rr-zebra: ---------------- ! interface rr-eth0 ip address 192.168.12.4/24 ipv6 address 2001:db8::12:4/64 ! Fixes: 2d8fff6b81bb ("bgpd: Implement BGP4V2-MIB(bgp4V2PeerErrorsTable)") Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com> (cherry picked from commit d53460554552c288831524c60dd98c303cba7c26)
-rw-r--r--bgpd/bgp_snmp_bgp4v2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bgpd/bgp_snmp_bgp4v2.c b/bgpd/bgp_snmp_bgp4v2.c
index 0c8ed33d43..5b8da5aeba 100644
--- a/bgpd/bgp_snmp_bgp4v2.c
+++ b/bgpd/bgp_snmp_bgp4v2.c
@@ -340,7 +340,8 @@ static uint8_t *bgpv2PeerErrorsTable(struct variable *v, oid name[],
}
return SNMP_STRING("");
case BGP4V2_PEER_LAST_ERROR_RECEIVED_DATA:
- if (peer->last_reset == PEER_DOWN_NOTIFY_RECEIVED)
+ if (peer->last_reset == PEER_DOWN_NOTIFY_RECEIVED &&
+ peer->notify.data)
return SNMP_STRING(peer->notify.data);
else
return SNMP_STRING("");