]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: bmp fix peer-up ports byte order
authorMaxence Younsi <mx.yns@outlook.fr>
Mon, 3 Apr 2023 15:19:32 +0000 (17:19 +0200)
committerMaxence Younsi <mx.yns@outlook.fr>
Mon, 3 Apr 2023 15:19:32 +0000 (17:19 +0200)
added htons to ports in the peer-up message to fix byte order

Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
bgpd/bgp_bmp.c

index 73dbf4ab2b4ec8f0446b37c5bc78007154cd39a0..baf164679c725586c871eaaa0c7df7e46d2e4037 100644 (file)
@@ -389,13 +389,13 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down)
 
                /* Local Port, Remote Port */
                if (peer->su_local->sa.sa_family == AF_INET6)
-                       stream_putw(s, peer->su_local->sin6.sin6_port);
+                       stream_putw(s, htons(peer->su_local->sin6.sin6_port));
                else if (peer->su_local->sa.sa_family == AF_INET)
-                       stream_putw(s, peer->su_local->sin.sin_port);
+                       stream_putw(s, htons(peer->su_local->sin.sin_port));
                if (peer->su_remote->sa.sa_family == AF_INET6)
-                       stream_putw(s, peer->su_remote->sin6.sin6_port);
+                       stream_putw(s, htons(peer->su_remote->sin6.sin6_port));
                else if (peer->su_remote->sa.sa_family == AF_INET)
-                       stream_putw(s, peer->su_remote->sin.sin_port);
+                       stream_putw(s, htons(peer->su_remote->sin.sin_port));
 
                static const uint8_t dummy_open[] = {
                        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,