Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: fix, do not access peer->notify.data when it is null #16546

Merged

Conversation

dmytroshytyi-6WIND
Copy link
Contributor

@dmytroshytyi-6WIND dmytroshytyi-6WIND commented Aug 9, 2024

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 crashed.

[EDIT1] -> reduce the configs as @ton31337 requested
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
 !
 address-family ipv4 unicast
  neighbor 192.168.12.4 activate
  neighbor 192.168.12.4 addpath-tx-all-paths
 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
 !

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.2 remote-as external
 neighbor 192.168.12.2 timers 1 3
 neighbor 192.168.12.2 timers connect 1
 !
 address-family ipv4 unicast
  neighbor 192.168.12.2 activate
  neighbor 192.168.12.2 addpath-tx-all-paths
  neighbor 192.168.12.2 route-server-client
 exit-address-family
!
agentx
!

config rr-zebra:

!
interface rr-eth0
 ip address 192.168.12.4/24
!

Signed-off-by: Dmytro Shytyi [email protected]

@dmytroshytyi-6WIND
Copy link
Contributor Author

ci:rerun

Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reduce every *.conf to a minimal that is needed for a test, because now it's lots of leftovers, etc. To ease the life when need to debug it.

@@ -0,0 +1,123 @@
#!/usr/bin/env python

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add SPDX-License tag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ton31337
Thank you for your comments.

SPDX-License tag fixed and configs are reduced.

@dmytroshytyi-6WIND dmytroshytyi-6WIND force-pushed the fix_bgp_open_notification_snmp branch from 7712317 to 55f3829 Compare August 12, 2024 16:43
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cleanups for topotest file and LGTM.

import os
import sys
import json
from time import sleep
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you drop this import, it's not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

from time import sleep
import pytest
import functools
import subprocess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ton31337
Copy link
Member

@Mergifyio backport stable/10.1 stable/10.0 stable/9.1 stable/9.0

Copy link

mergify bot commented Aug 12, 2024

backport stable/10.1 stable/10.0 stable/9.1 stable/9.0

✅ Backports have been created

@dmytroshytyi-6WIND dmytroshytyi-6WIND force-pushed the fix_bgp_open_notification_snmp branch from 55f3829 to 9360fbc Compare August 14, 2024 11:43
test_func1 = functools.partial(_check_bgp_session)
_, result1 = topotest.run_and_expect(test_func1, None, count=60, wait=0.5)

assert result1 is None, "Failed to verify the nexthop_resolution MPLS: bgp session"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mpls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


output = json.loads(r2.vtysh_cmd("show bgp summary json"))

if output["ipv4Unicast"]["peers"]["192.168.12.4"]["state"] == "Established":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the same format we have/use for such things, see "expected = {...}".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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 <[email protected]>
This test checks the bgp crash on rt2 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: test if rt2 bgp is crashed.

Signed-off-by: Dmytro Shytyi <[email protected]>
@dmytroshytyi-6WIND dmytroshytyi-6WIND force-pushed the fix_bgp_open_notification_snmp branch from 9360fbc to e23005f Compare August 21, 2024 13:28
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ton31337 ton31337 merged commit 0db6045 into FRRouting:master Aug 22, 2024
10 of 11 checks passed
ton31337 added a commit that referenced this pull request Aug 22, 2024
bgpd: fix, do not access peer->notify.data when it is null (backport #16546)
ton31337 added a commit that referenced this pull request Aug 22, 2024
bgpd: fix, do not access peer->notify.data when it is null (backport #16546)
donaldsharp added a commit that referenced this pull request Aug 22, 2024
bgpd: fix, do not access peer->notify.data when it is null (backport #16546)
donaldsharp added a commit that referenced this pull request Aug 22, 2024
bgpd: fix, do not access peer->notify.data when it is null (backport #16546)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants