Exa-Networks / exabgp

The BGP swiss army knife of networking
Other
2.09k stars 448 forks source link

Healthcheck not sets IP address without '--label' argument #1088

Closed Toosaman closed 2 years ago

Toosaman commented 2 years ago

Hi, I found a strange behavior of the healthcheck script when '--label' argument not used:

root@host:/# python3 -m exabgp healthcheck --debug --ip 192.168.168.1/32
DEBUG[healthcheck] Retrieve loopback IP addresses
DEBUG[healthcheck] Loopback addresses: []
DEBUG[healthcheck] Setup loopback IP address 192.168.168.1/32
DEBUG[healthcheck] Transition to RISING
DEBUG[healthcheck] Transition to UP
INFO[healthcheck] send announces for UP state to ExaBGP
DEBUG[healthcheck] exabgp: announce route 192.168.168.1/32 next-hop self med 100
announce route 192.168.168.1/32 next-hop self med 100
root@host:/# ip ad sh dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever

Let's try with '--label' arg:

root@host:/# python3 -m exabgp healthcheck --debug --ip 192.168.168.1/32 --label test
DEBUG[healthcheck] Retrieve loopback IP addresses
DEBUG[healthcheck] Loopback addresses: []
DEBUG[healthcheck] Setup loopback IP address 192.168.168.1/32
DEBUG[healthcheck] Transition to RISING
DEBUG[healthcheck] Transition to UP
INFO[healthcheck] send announces for UP state to ExaBGP
DEBUG[healthcheck] exabgp: announce route 192.168.168.1/32 next-hop self med 100
announce route 192.168.168.1/32 next-hop self med 100
root@host:/# ip ad sh dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 192.168.168.1/32 scope global lo:test
       valid_lft forever preferred_lft forever

I checked the code and found this:

https://github.com/Exa-Networks/exabgp/blob/5c894ade884b39c1b27a56015a0b5bda02d10c56/src/exabgp/application/healthcheck.py#L245-L253

a bug?

thomas-mangin commented 2 years ago

Thank you for reporting the problem with the indent!