diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-12-08 17:36:13 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-12-08 17:36:13 +0000 |
commit | 4cb6ee9ade6c6816176d4cdb11ac1dba7d4bdb93 (patch) | |
tree | 34b0b4b0fc21c12623a7381e8be2eacaaccdd454 /usr.sbin | |
parent | 74da68ee956ef3261b1f4d84bc2fbd57fdd9fb1d (diff) |
Must byte-swap extended community data before printing since it is in
network byte order. Found and tested by Pete Vickers.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 0dc392e2a68..cb3224c2ef3 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.152 2009/12/08 15:10:29 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.153 2009/12/08 17:36:12 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -1231,7 +1231,7 @@ show_rib_detail_msg(struct imsg *imsg, int nodescr) memcpy(&as, data, sizeof(as)); memcpy(&id, data + sizeof(as), sizeof(id)); printf(" Aggregator: %s [%s]\n", - log_as(htonl(as)), inet_ntoa(id)); + log_as(ntohl(as)), inet_ntoa(id)); break; case ATTR_ORIGINATOR_ID: memcpy(&id, data, sizeof(id)); @@ -1416,19 +1416,20 @@ show_ext_community(u_char *data, u_int16_t len) case EXT_COMMUNITY_TWO_AS: memcpy(&as2, data + i + 2, sizeof(as2)); memcpy(&u32, data + i + 4, sizeof(u32)); - printf("%s %hu:%u", get_ext_subtype(subtype), as2, u32); + printf("%s %s:%u", get_ext_subtype(subtype), + log_as(ntohs(as2)), ntohl(u32)); break; case EXT_COMMUNITY_IPV4: memcpy(&ip, data + i + 2, sizeof(ip)); memcpy(&u16, data + i + 6, sizeof(u16)); printf("%s %s:%hu", get_ext_subtype(subtype), - inet_ntoa(ip), u16); + inet_ntoa(ip), ntohs(u16)); break; case EXT_COMMUNITY_FOUR_AS: memcpy(&as4, data + i + 2, sizeof(as4)); memcpy(&u16, data + i + 6, sizeof(u16)); printf("%s %s:%hu", get_ext_subtype(subtype), - log_as(as4), u16); + log_as(ntohl(as4)), ntohs(u16)); break; case EXT_COMMUNITY_OPAQUE: memcpy(&ext, data + i, sizeof(ext)); |