diff options
author | 2020-09-15 20:28:27 +0000 | |
---|---|---|
committer | 2020-09-15 20:28:27 +0000 | |
commit | dbc83ade87d18a4e830f9701bd9c891f73ea890e (patch) | |
tree | 0634bc2b2c7346f755ed09a0da9cf8436b46dbae | |
parent | Align man page with reality (diff) | |
download | wireguard-openbsd-dbc83ade87d18a4e830f9701bd9c891f73ea890e.tar.xz wireguard-openbsd-dbc83ade87d18a4e830f9701bd9c891f73ea890e.zip |
"Route show" and "netstat -r" provide formatting for routing tables with
sufficient space to display v4 addresses cleanly, but which truncate v6
addresses. The -n flag on each already provides additional column width
for IPv6 addresses. Make this formatting the default.
OK phessler kn
-rw-r--r-- | sbin/route/show.c | 28 | ||||
-rw-r--r-- | usr.bin/netstat/show.c | 28 |
2 files changed, 20 insertions, 36 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c index ee402bf3024..a3ebb7d3f9f 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.114 2018/08/31 15:18:02 yasuoka Exp $ */ +/* $OpenBSD: show.c,v 1.115 2020/09/15 20:28:27 pamela Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -174,28 +174,20 @@ p_rttables(int af, u_int tableid, char prio) * width of destination/gateway column * strlen("fe80::aaaa:bbbb:cccc:dddd@gif0") == 30, strlen("/128") == 4 */ -#define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18) +#define WID_GW(af) ((af) == AF_INET6 ? 30 : 18) int WID_DST(int af) { - if (nflag) - switch (af) { - case AF_MPLS: - return 9; - case AF_INET6: - return 34; - default: - return 18; - } - else - switch (af) { - case AF_MPLS: - return 9; - default: - return 18; - } + switch (af) { + case AF_MPLS: + return 9; + case AF_INET6: + return 34; + default: + return 18; + } } /* diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c index ab6f63fd648..156559002b2 100644 --- a/usr.bin/netstat/show.c +++ b/usr.bin/netstat/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.55 2018/08/31 15:18:02 yasuoka Exp $ */ +/* $OpenBSD: show.c,v 1.56 2020/09/15 20:28:27 pamela Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -169,28 +169,20 @@ p_rttables(int af, u_int tableid) * width of destination/gateway column * strlen("fe80::aaaa:bbbb:cccc:dddd@gif0") == 30, strlen("/128") == 4 */ -#define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18) +#define WID_GW(af) ((af) == AF_INET6 ? 30 : 18) int WID_DST(int af) { - if (nflag) - switch (af) { - case AF_MPLS: - return 9; - case AF_INET6: - return 34; - default: - return 18; - } - else - switch (af) { - case AF_MPLS: - return 9; - default: - return 18; - } + switch (af) { + case AF_MPLS: + return 9; + case AF_INET6: + return 34; + default: + return 18; + } } /* |