]> 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)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 4 Apr 2023 07:49:56 +0000 (07:49 +0000)
added htons to ports in the peer-up message to fix byte order

Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
(cherry picked from commit 9e681c84fa07d768d41fb8fba269c965c8c08a4b)

bgpd/bgp_bmp.c

index bcab4099c049442ab8d338ed423e8da9f2d41da9..05c6a14aae62effcb7a5d83e98c21771d0b12f77 100644 (file)
@@ -402,13 +402,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,