]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: fix route-target display with as dotted format
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 7 Jun 2023 15:26:52 +0000 (17:26 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 27 Feb 2024 13:28:22 +0000 (14:28 +0100)
commit7c1480fd2fc9309bc23d1c6f387320370a1d335a
tree839704ee8bf0a0b3cb0e551eccf62d6e91c7ef08
parent7ad689b6015bac8925ffd203128d99847a913f2c
bgpd: fix route-target display with as dotted format

The following command results in a wrong route-target
display:
> # show running-config
> [..]
> route-map rmap permit 1
>  set extcommunity rt 1.45:55
> exit
> router bgp 1.45 as-notation plain
> neighbor 192.0.2.1 remote-as 65500
> address-family ipv4 unicast
> network 192.0.2.2/32 route-map rmap
>

Observed output:

> # show bgp ipv4 192.0.2.2/32
> [..]
>     Extended Community: RT:1.0.0.45:55
>

The decoding of the passed cli string assumes this is an
IP address, whereas it is an AS number in dotted format.
Consequently, the vty output will use the ip address encoding.

Count the number of dots in the extended community format.
If a single dot number is detected, the AS format is passed,
and used by the vty output.

After fix:

>
> # show bgp ipv4 192.0.2.2/32
> [..]
>    Extended Community: RT:65581:55
>

For remind, AS 65581 and AS 1.45 are a unique AS number.

> show bgp neighbor
> BGP neighbor is 192.0.2.1, remote AS 65500, local AS 65581, external link
> [..]

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_ecommunity.c