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

BMP listener sockets are not destroyed when the BMP target is removed via vtysh #18177

Open
2 tasks done
jesusvasquez333 opened this issue Feb 15, 2025 · 0 comments
Open
2 tasks done
Assignees
Labels
triage Needs further investigation

Comments

@jesusvasquez333
Copy link

Description

There is an issue when trying to remove a BMP listener via vtysh with no bmp targets ..., The listening socket is not destroyed correctly. Here is an example:

We start with a configuration that has a BMP listener:

$ sudo cat /etc/frr/frr.conf
frr version 10.0.2
frr defaults datacenter
log syslog informational
service integrated-vtysh-config
!
router bgp 65001
 bgp router-id 10.210.80.218
 !
 bmp targets TEST
  bmp listener 127.0.0.1 port 1234
 exit
exit
!
$ sudo systemctl restart frr

We see the BMP listener is active:

$ sudo vtysh

Hello, this is FRRouting (version 10.0.2).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

# show bmp
BMP state for BGP VRF default:

  Route Mirroring         0 bytes (0 messages) pending
                          0 bytes maximum buffer used

  Targets "TEST":
    Route Mirroring disabled
    Listeners:
      127.0.0.1:1234

    Outbound connections:
 remote   state      timer   local

    0 connected clients:
 remote   uptime   MonSent   MirrSent   MirrLost   ByteSent   ByteQ   ByteQKernel

We also see the listener socket:

$ netstat -l | grep 1234
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN

Now, let's try to remove the BMP

$ sudo vtysh

Hello, this is FRRouting (version 10.0.2).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

# configure
# router bgp
(config-router)# no bmp targets TEST
(config-router)# end
# show running-config
Building configuration...

Current configuration:
!
frr version 10.0.2
frr defaults datacenter
log syslog informational
service integrated-vtysh-config
!
router bgp 65001
 bgp router-id 10.210.80.218
exit
!
end

The BMP listener is not listed anymore:

# show bmp
BMP state for BGP VRF default:

  Route Mirroring         0 bytes (0 messages) pending
                          0 bytes maximum buffer used

However, the listener socket is still open:

$ netstat -l | grep 1234
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN

If now, we try to reload the original configuration again, which has the BMP listener:

$ sudo systemctl reload frr
$ sudo vtysh -c "show running-config"
Building configuration...

Current configuration:
!
frr version 10.0.2
frr defaults datacenter
log syslog informational
service integrated-vtysh-config
!
router bgp 65001
 bgp router-id 10.210.80.218
 !
 bmp targets TEST

  bmp listener 127.0.0.1 port 1234
 exit
exit
!
end

A new socket is created, and we end up with 2 sockets:

$ netstat -l | grep 1234
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN

If we repeat these steps again, we end up with a new socket, and the old sockets are never destroyed.

$ netstat -l | grep 1234
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN

The same happens if we, instead of using vtysh, modify the frr.conf file and do a frr reload.


One workaround to avoid this issue is to do a no bmp listener ... and a no bmp targets.... Here is an example:

We start with the same configuration:

$ sudo vtysh

Hello, this is FRRouting (version 10.0.2).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

# show running-config
Building configuration...

Current configuration:
!
frr version 10.0.2
frr defaults datacenter
log syslog informational
service integrated-vtysh-config
!
router bgp 65001
 bgp router-id 10.210.80.218
 !
 bmp targets TEST

  bmp listener 127.0.0.1 port 1234
 exit
exit
!
end

And we see the socket:

$ netstat -l | grep 1234
tcp        0      0 localhost:1234          0.0.0.0:*               LISTEN

If we do this sequence:

# configure
(config)# router bgp
(config-router)# bmp targets TEST
(config-bgp-bmp)# no bmp listener 127.0.0.1 port 1234
(config-bgp-bmp)# exit
(config-router)# no bmp targets TEST

Then in this case the socket is destroyed:

$ netstat -l | grep 1234
$

Another way to clean the socket is to do a frr restart instead of reload.

Version

# show version
FRRouting 10.0.2 (hostname) on Linux(6.8.0-52-generic).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
configured with:
    '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-option-checking' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--sbindir=/usr/lib/frr' '--with-vtysh-pager=/usr/bin/pager' '--libdir=/usr/lib/x86_64-linux-gnu/frr' '--with-moduledir=/usr/lib/x86_64-linux-gnu/frr/modules' '--disable-dependency-tracking' '--enable-rpki' '--disable-scripting' '--enable-pim6d' '--with-libpam' '--enable-doc' '--enable-doc-html' '--enable-snmp' '--enable-fpm' '--disable-protobuf' '--disable-zeromq' '--enable-ospfapi' '--enable-bgp-vnc' '--enable-multipath=256' '--enable-user=frr' '--enable-group=frr' '--enable-vty-group=frrvty' '--enable-configfile-mask=0640' '--enable-logfile-mask=0640' 'build_alias=x86_64-linux-gnu' 'PYTHON=python3'

How to reproduce

As explained in the description:

  • Instantiate a BGP router with a BMP listener,
  • Remove the listener using vtysh with no bmp targets ...,
  • Check that the listener socket is still open via netstat or equivalent.

Expected behavior

The BMP listener socket to be destroyed after removing the BMP listener with no bmp targets ....

Actual behavior

The BMP listener socket is not destroyed after removing the BMP listener with no bmp targets ....

Additional context

No response

Checklist

  • I have searched the open issues for this bug.
  • I have not included sensitive information in this report.
@jesusvasquez333 jesusvasquez333 added the triage Needs further investigation label Feb 15, 2025
@eqvinox eqvinox self-assigned this Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs further investigation
Projects
None yet
Development

No branches or pull requests

2 participants