From 9e681c84fa07d768d41fb8fba269c965c8c08a4b Mon Sep 17 00:00:00 2001 From: Maxence Younsi Date: Mon, 3 Apr 2023 17:19:32 +0200 Subject: [PATCH] bgpd: bmp fix peer-up ports byte order added htons to ports in the peer-up message to fix byte order Signed-off-by: Maxence Younsi --- bgpd/bgp_bmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 73dbf4ab2b..baf164679c 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -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, -- 2.39.5