]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Check if su_local/su_remote exist before encoding BMP peer state 17103/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 15 Oct 2024 09:51:51 +0000 (12:51 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 15 Oct 2024 09:51:51 +0000 (12:51 +0300)
Fixes: 035304c25a3890a040acbe23ca385750b062cdce ("bgpd: bmp loc-rib peer up/down for vrfs")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_bmp.c

index 08f8b8b734ffeb16a2b3fe039d83f25f9604d7fc..bb24d5d69e7dc6e885a663861aab414170363869 100644 (file)
@@ -501,14 +501,14 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down)
                }
 
                /* Local Port, Remote Port */
-               if (is_locrib)
+               if (!peer->su_local || is_locrib)
                        stream_putw(s, 0);
                else if (peer->su_local->sa.sa_family == AF_INET6)
                        stream_putw(s, htons(peer->su_local->sin6.sin6_port));
                else if (peer->su_local->sa.sa_family == AF_INET)
                        stream_putw(s, htons(peer->su_local->sin.sin_port));
 
-               if (is_locrib)
+               if (!peer->su_remote || is_locrib)
                        stream_putw(s, 0);
                else if (peer->su_remote->sa.sa_family == AF_INET6)
                        stream_putw(s, htons(peer->su_remote->sin6.sin6_port));