summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorEsben Norby <norby@cvs.openbsd.org>2008-04-30 12:43:24 +0000
committerEsben Norby <norby@cvs.openbsd.org>2008-04-30 12:43:24 +0000
commit9c7289cb79e29eac6e48dc178ba2a4b756ade788 (patch)
tree606e19d4368738742562392ced4e4406f59cdb5c /sbin
parent291aedc0026420ae60cf678c4850376e36a6b372 (diff)
Correct MPLS output of route -n show.
ok claudio@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/show.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c
index 4a8296659d9..72e7a0b6190 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.62 2008/04/28 11:36:14 norby Exp $ */
+/* $OpenBSD: show.c,v 1.63 2008/04/30 12:43:23 norby Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -205,9 +205,30 @@ 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_DST(af) ((af) == AF_INET6 ? (nflag ? 34 : 18) : 18)
#define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18)
+int
+WID_DST(int af)
+{
+
+ if (nflag)
+ switch (af) {
+ case AF_MPLS:
+ return 48;
+ case AF_INET6:
+ return 34;
+ default:
+ return 18;
+ }
+ else
+ switch (af) {
+ case AF_MPLS:
+ return 48;
+ default:
+ return 18;
+ }
+}
+
/*
* Print header for routing table columns.
*/