diff options
Diffstat (limited to 'usr.bin/netstat/route.c')
-rw-r--r-- | usr.bin/netstat/route.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 01311e5..596fcd5 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -89,17 +89,23 @@ struct bits { { RTF_DYNAMIC, 'D' }, { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, /* Completed -- for routing messages only */ - { RTF_CLONING, 'C' }, { RTF_XRESOLVE, 'X' }, - { RTF_LLINFO, 'L' }, { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, - { RTF_WASCLONED,'W' }, { RTF_PRCLONING,'c' }, { RTF_PROTO3, '3' }, { RTF_BLACKHOLE,'B' }, { RTF_BROADCAST,'b' }, +#ifdef RTF_LLINFO + { RTF_LLINFO, 'L' }, +#endif +#ifdef RTF_WASCLONED + { RTF_WASCLONED,'W' }, +#endif +#ifdef RTF_CLONING + { RTF_CLONING, 'C' }, +#endif { 0 , 0 } }; @@ -316,23 +322,12 @@ static void size_cols_rtentry(struct rtentry *rt) { static struct ifnet ifnet, *lastif; - struct rtentry parent; static char buffer[100]; const char *bp; struct sockaddr *sa; sa_u addr, mask; int len; - /* - * Don't print protocol-cloned routes unless -a. - */ - if (rt->rt_flags & RTF_WASCLONED && !aflag) { - if (kget(rt->rt_parent, parent) != 0) - return; - if (parent.rt_flags & RTF_PRCLONING) - return; - } - bzero(&addr, sizeof(addr)); if ((sa = kgetsa(rt_key(rt)))) bcopy(sa, &addr, sa->sa_len); @@ -352,7 +347,7 @@ size_cols_rtentry(struct rtentry *rt) wid_flags = MAX(len, wid_flags); if (addr.u_sa.sa_family == AF_INET || Wflag) { - len = snprintf(buffer, sizeof(buffer), "%ld", rt->rt_refcnt); + len = snprintf(buffer, sizeof(buffer), "%d", rt->rt_refcnt); wid_refs = MAX(len, wid_refs); len = snprintf(buffer, sizeof(buffer), "%lu", rt->rt_use); wid_use = MAX(len, wid_use); @@ -761,22 +756,11 @@ static void p_rtentry(struct rtentry *rt) { static struct ifnet ifnet, *lastif; - struct rtentry parent; static char buffer[128]; static char prettyname[128]; struct sockaddr *sa; sa_u addr, mask; - /* - * Don't print protocol-cloned routes unless -a. - */ - if (rt->rt_flags & RTF_WASCLONED && !aflag) { - if (kget(rt->rt_parent, parent) != 0) - return; - if (parent.rt_flags & RTF_PRCLONING) - return; - } - bzero(&addr, sizeof(addr)); if ((sa = kgetsa(rt_key(rt)))) bcopy(sa, &addr, sa->sa_len); @@ -788,7 +772,7 @@ p_rtentry(struct rtentry *rt) snprintf(buffer, sizeof(buffer), "%%-%d.%ds ", wid_flags, wid_flags); p_flags(rt->rt_flags, buffer); if (addr.u_sa.sa_family == AF_INET || Wflag) { - printf("%*ld %*lu ", wid_refs, rt->rt_refcnt, + printf("%*d %*lu ", wid_refs, rt->rt_refcnt, wid_use, rt->rt_use); if (Wflag) { if (rt->rt_rmx.rmx_mtu != 0) |