summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2013-10-30 17:28:33 +0000
committerderaadt <deraadt@openbsd.org>2013-10-30 17:28:33 +0000
commit32ecd2d8de40ca5cc6498e64a7689a35295511e0 (patch)
treead089ecd32cb5e8e9ed6b200c4d626df548ec320
parentanother simple %i to %d conversion for obviousness (diff)
downloadwireguard-openbsd-32ecd2d8de40ca5cc6498e64a7689a35295511e0.tar.xz
wireguard-openbsd-32ecd2d8de40ca5cc6498e64a7689a35295511e0.zip
use more careful format strings to deal with various forms of AS#'s
ok claudio benno
-rw-r--r--usr.sbin/bgpd/printconf.c10
-rw-r--r--usr.sbin/bgpd/util.c8
2 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c
index 5674838d13d..484bdf20c85 100644
--- a/usr.sbin/bgpd/printconf.c
+++ b/usr.sbin/bgpd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.91 2013/10/19 15:04:25 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.92 2013/10/30 17:28:33 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -89,7 +89,7 @@ print_community(int as, int type)
else if (as == COMMUNITY_NEIGHBOR_AS)
printf("neighbor-as:");
else
- printf("%d:", as);
+ printf("%u:", (unsigned int)as);
if (type == COMMUNITY_ANY)
printf("* ");
@@ -104,15 +104,15 @@ print_extcommunity(struct filter_extcommunity *c)
{
switch (c->type & EXT_COMMUNITY_VALUE) {
case EXT_COMMUNITY_TWO_AS:
- printf("%s %i:%i ", log_ext_subtype(c->subtype),
+ printf("%s %hu:%u ", log_ext_subtype(c->subtype),
c->data.ext_as.as, c->data.ext_as.val);
break;
case EXT_COMMUNITY_IPV4:
- printf("%s %s:%i ", log_ext_subtype(c->subtype),
+ printf("%s %s:%u ", log_ext_subtype(c->subtype),
inet_ntoa(c->data.ext_ip.addr), c->data.ext_ip.val);
break;
case EXT_COMMUNITY_FOUR_AS:
- printf("%s %s:%i ", log_ext_subtype(c->subtype),
+ printf("%s %s:%u ", log_ext_subtype(c->subtype),
log_as(c->data.ext_as4.as4), c->data.ext_as.val);
break;
case EXT_COMMUNITY_OPAQUE:
diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c
index d8df024d1c3..854adc4dc6b 100644
--- a/usr.sbin/bgpd/util.c
+++ b/usr.sbin/bgpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.16 2013/10/19 15:04:26 claudio Exp $ */
+/* $OpenBSD: util.c,v 1.17 2013/10/30 17:28:33 deraadt Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -118,18 +118,18 @@ log_rd(u_int64_t rd)
case EXT_COMMUNITY_TWO_AS:
u32 = rd & 0xffffffff;
u16 = (rd >> 32) & 0xffff;
- snprintf(buf, sizeof(buf), "rd %i:%i", u16, u32);
+ snprintf(buf, sizeof(buf), "rd %hu:%u", u16, u32);
break;
case EXT_COMMUNITY_FOUR_AS:
u32 = (rd >> 16) & 0xffffffff;
u16 = rd & 0xffff;
- snprintf(buf, sizeof(buf), "rd %s:%i", log_as(u32), u16);
+ snprintf(buf, sizeof(buf), "rd %s:%hu", log_as(u32), u16);
break;
case EXT_COMMUNITY_IPV4:
u32 = (rd >> 16) & 0xffffffff;
u16 = rd & 0xffff;
addr.s_addr = htonl(u32);
- snprintf(buf, sizeof(buf), "rd %s:%i", inet_ntoa(addr), u16);
+ snprintf(buf, sizeof(buf), "rd %s:%hu", inet_ntoa(addr), u16);
break;
default:
return ("rd ?");