summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2010-07-29 16:35:41 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2010-07-29 16:35:41 +0000
commitda8fcaa8ab1beb9ebf06ac26cde49b9b4780347e (patch)
tree15387f4c7c5d0b899f0393febb7aca69ab7ae530 /usr.bin
parent3b786c117f4a4d197e4947ecd0e48bb208fcd89d (diff)
Print a column with the routing label if "netstat -vr" or "route
-v show" are called with the -v switch. ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/show.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c
index 3af0c5ba84f..62348b4f97b 100644
--- a/usr.bin/netstat/show.c
+++ b/usr.bin/netstat/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.31 2010/05/19 13:07:15 chl Exp $ */
+/* $OpenBSD: show.c,v 1.32 2010/07/29 16:35:40 bluhm Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -245,10 +245,13 @@ pr_rthdr(int af, int Aflag)
"Flags", "Refs", "Use", "Mtu", "Prio", "Interface");
break;
default:
- printf("%-*.*s %-*.*s %-6.6s %5.5s %8.8s %5.5s %4.4s %s\n",
+ printf("%-*.*s %-*.*s %-6.6s %5.5s %8.8s %5.5s %4.4s %s",
WID_DST(af), WID_DST(af), "Destination",
WID_GW(af), WID_GW(af), "Gateway",
"Flags", "Refs", "Use", "Mtu", "Prio", "Iface");
+ if (vflag)
+ printf(" %s", "Label");
+ putchar('\n');
break;
}
}
@@ -311,8 +314,11 @@ p_rtentry(struct rt_msghdr *rtm)
else
printf("%5s ", "-");
putchar((rtm->rtm_rmx.rmx_locks & RTV_MTU) ? 'L' : ' ');
- printf(" %2d %.16s", rtm->rtm_priority,
+ printf(" %2d %-5.16s", rtm->rtm_priority,
if_indextoname(rtm->rtm_index, ifbuf));
+ if (vflag && rti_info[RTAX_LABEL])
+ printf(" %s", ((struct sockaddr_rtlabel *)
+ rti_info[RTAX_LABEL])->sr_label);
putchar('\n');
}