diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2014-11-11 07:15:34 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2014-11-11 07:15:34 +0000 |
commit | 6e8caec0e01a8762dc5831bf41d93bb6816f8248 (patch) | |
tree | e9ed3febdafce3ea7433f5f2df295ed6c454b34c | |
parent | a482b97eeb677391ac8f5c8d217f89a0c1302338 (diff) |
The default output format for 32bit AS numbers has moved from AS_DOT+
to ASPLAIN.
Of course, you can still input AS numbers in either format.
OK henning@, claudio@, benno@, sthen@
-rw-r--r-- | usr.sbin/bgpd/util.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index 854adc4dc6b..3ae38bcc1cc 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.17 2013/10/30 17:28:33 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.18 2014/11/11 07:15:33 phessler Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -92,16 +92,11 @@ log_sockaddr(struct sockaddr *sa) const char * log_as(u_int32_t as) { - static char buf[12]; /* "65000.65000\0" */ + static char buf[11]; /* "4294967294\0" */ + + if (snprintf(buf, sizeof(buf), "%u", as) == -1) + return ("?"); - if (as <= USHRT_MAX) { - if (snprintf(buf, sizeof(buf), "%u", as) == -1) - return ("?"); - } else { - if (snprintf(buf, sizeof(buf), "%u.%u", as >> 16, - as & 0xffff) == -1) - return ("?"); - } return (buf); } |