summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxence Younsi <mx.yns@outlook.fr>2023-04-03 17:19:32 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2023-04-04 07:49:56 +0000
commit988cbf4334a7fa2f637acb9d0fec199ec4ec822c (patch)
tree027a143d9ae3ef6f7c2d9b80b5cc2dbe31a5e617
parentb109cef92d23b58cbfd81b9ececca760e7c3bf2e (diff)
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 <mx.yns@outlook.fr> (cherry picked from commit 9e681c84fa07d768d41fb8fba269c965c8c08a4b)
-rw-r--r--bgpd/bgp_bmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c
index 41b6fe37ff..dbc356bc40 100644
--- a/bgpd/bgp_bmp.c
+++ b/bgpd/bgp_bmp.c
@@ -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,