summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/session.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-05-06 14:07:44 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-05-06 14:07:44 +0000
commitd6574ebb052aabec45404046d619d68062fe488b (patch)
tree2f0985fed9bb28fe8233e67eda6c399dcf65c9c7 /usr.sbin/bgpd/session.c
parent5098a53d2df5c9e688d80876f762c430c139a112 (diff)
the Address Family Identifier field in the capability announcement is
2 octets, thus we need to transform it from/to network byte order... fixes capability announcement and -parsing
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r--usr.sbin/bgpd/session.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index ca10ece881d..b94b46f9550 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.166 2004/05/06 12:18:02 henning Exp $ */
+/* $OpenBSD: session.c,v 1.167 2004/05/06 14:07:43 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -992,7 +992,7 @@ session_open(struct peer *p)
if (p->capa.ann_mp) {
/* multiprotocol extensions, RFC 2858 */
bzero(&capa_mp_v4, sizeof(capa_mp_v4));
- capa_mp_v4.afi = AFI_IPv4;
+ capa_mp_v4.afi = htons(AFI_IPv4);
capa_mp_v4.safi = SAFI_UNICAST;
op_len += 6; /* 1 code + 1 len + 4 data */
}
@@ -1682,6 +1682,7 @@ parse_refresh(struct peer *peer)
/* afi, 2 byte */
memcpy(&r.afi, p, sizeof(r.afi));
+ r.afi = ntohs(r.afi);
p += 2;
/* reserved, 1 byte */
p += 1;
@@ -1835,6 +1836,7 @@ parse_capabilities(struct peer *peer, u_char *d, u_int16_t dlen)
return (-1);
}
memcpy(&mp_afi, capa_val, sizeof(mp_afi));
+ mp_afi = ntohs(mp_afi);
memcpy(&mp_safi, capa_val + 3, sizeof(mp_safi));
switch (mp_afi) {
case AFI_IPv4: