]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd, topotests: fix wrong peer type for loc-rib peer events
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 30 Oct 2024 20:24:44 +0000 (21:24 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 11 Dec 2024 10:29:37 +0000 (11:29 +0100)
When running the bgp_bmp test, peer_up message from the loc-rib
are received with a wrong peer type.
> {"peer_type": "global instance", "policy": "pre-policy", "ipv6": false, "peer_ip": "0.0.0.0",
> "peer_distinguisher": "0:0", "peer_asn": 0, "peer_bgp_id": "0.0.0.0",
> "timestamp": "2024-10-16 21:59:53.111963", "bmp_log_type": "peer up", "local_ip": "0.0.0.0",
> "local_port": 0, "remote_port": 0, "seq": 1}

RFC9069 mentions in 5.1 that peer address must be set to 0.0.0.0,
and the peer_type value must be set to 3. Today, the value set
is 0 (global instance). This is wrong.

Fix this by modifying the BMP client, update the peer type value to
loc-rib on peer up messages.

Modify the current BMP test, by checking the peer up messages for the
0.0.0.0 IP address (which is the value used for loc-rib).

> {"peer_type": "loc-rib instance", "is_filtered": false, "policy": "loc-rib",
> "peer_distinguisher": "0:0", "peer_asn": 65501, "peer_bgp_id": "192.168.0.1",
> "timestamp": "2024-10-16 21:59:53.111963", "bmp_log_type": "peer up", "local_ip": "0.0.0.0",
> "local_port": 0, "remote_port": 0, "seq": 1}

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

index d6df56026078f22f51f628ace0aed382466b70cc..e86e80ba274270cf936aafde01551eb3f68764ee 100644 (file)
@@ -481,6 +481,9 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down)
                /* TODO: remove this when other RD and local instances supported */
                peer_type = BMP_PEER_TYPE_GLOBAL_INSTANCE;
 
+       if (is_locrib == false)
+               peer_type = BMP_PEER_TYPE_GLOBAL_INSTANCE;
+
 #define BGP_BMP_MAX_PACKET_SIZE        1024
 #define BMP_PEERUP_INFO_TYPE_STRING 0
        s = stream_new(BGP_MAX_PACKET_SIZE);
@@ -552,9 +555,7 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down)
 
                bmp_common_hdr(s, BMP_VERSION_3,
                                BMP_TYPE_PEER_DOWN_NOTIFICATION);
-               bmp_per_peer_hdr(s, peer->bgp, peer, 0,
-                                BMP_PEER_TYPE_GLOBAL_INSTANCE, 0,
-                                &uptime_real);
+               bmp_per_peer_hdr(s, peer->bgp, peer, 0, peer_type, 0, &uptime_real);
 
                type_pos = stream_get_endp(s);
                stream_putc(s, 0);      /* placeholder for down reason */