Add -L option. netstat -r -L behaves like 4.3BSD netstat -r, that is, it
does not show route table entries pointing to link level addresses (ARP entries or IPv6 neighbour discovery entries).
This commit is contained in:
parent
4d1abcb145
commit
cef52aa203
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.23 1999/07/01 18:40:36 itojun Exp $ */
|
||||
/* $NetBSD: main.c,v 1.24 1999/09/15 20:12:18 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.23 1999/07/01 18:40:36 itojun Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.24 1999/09/15 20:12:18 is Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -304,7 +304,8 @@ main(argc, argv)
|
||||
af = AF_UNSPEC;
|
||||
pcbaddr = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "Aabdf:ghI:liM:mN:nP:p:rstuvw:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "Aabdf:ghI:LliM:mN:nP:p:rstuvw:"))
|
||||
!= -1)
|
||||
switch(ch) {
|
||||
case 'A':
|
||||
Aflag = 1;
|
||||
@ -348,6 +349,9 @@ main(argc, argv)
|
||||
case 'i':
|
||||
iflag = 1;
|
||||
break;
|
||||
case 'L':
|
||||
Lflag = 1;
|
||||
break;
|
||||
case 'l':
|
||||
lflag = 1;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: netstat.1,v 1.24 1999/09/15 19:57:02 is Exp $
|
||||
.\" $NetBSD: netstat.1,v 1.25 1999/09/15 20:12:18 is Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1990, 1992, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -46,7 +46,7 @@
|
||||
.Op Fl M Ar core
|
||||
.Op Fl N Ar system
|
||||
.Nm ""
|
||||
.Op Fl dgimnrsv
|
||||
.Op Fl dgiLmnrsv
|
||||
.Op Fl f Ar address_family
|
||||
.Op Fl M Ar core
|
||||
.Op Fl N Ar system
|
||||
@ -151,6 +151,8 @@ options is also present, multicast addresses currently in use are shown
|
||||
for each Ethernet interface and for each IP interface address.
|
||||
Multicast addresses are shown on separate lines following the interface
|
||||
address with which they are associated.
|
||||
.It Fl L
|
||||
Don't show link-level routes (e.g., IPv4 ARP or IPv6 neighbour cache).
|
||||
.It Fl M
|
||||
Extract values associated with the name list from the specified core
|
||||
instead of the default
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netstat.h,v 1.14 1999/07/01 18:40:36 itojun Exp $ */
|
||||
/* $NetBSD: netstat.h,v 1.15 1999/09/15 20:12:18 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -45,6 +45,7 @@ int dflag; /* show i/f dropped packets */
|
||||
int gflag; /* show group (multicast) routing or stats */
|
||||
#endif
|
||||
int iflag; /* show interfaces */
|
||||
int Lflag; /* don't show LLINFO entries */
|
||||
int lflag; /* show routing table with use and ref */
|
||||
int mflag; /* show memory stats */
|
||||
int nflag; /* show addresses numerically */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route.c,v 1.39 1999/09/03 04:26:31 itojun Exp $ */
|
||||
/* $NetBSD: route.c,v 1.40 1999/09/15 20:12:18 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: route.c,v 1.39 1999/09/03 04:26:31 itojun Exp $");
|
||||
__RCSID("$NetBSD: route.c,v 1.40 1999/09/15 20:12:18 is Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -373,6 +373,8 @@ np_rtentry(rtm)
|
||||
static int old_af;
|
||||
int af = 0, interesting = RTF_UP | RTF_GATEWAY | RTF_HOST;
|
||||
|
||||
if (Lflag && (rtm->rtm_flags & RTF_LLINFO))
|
||||
return;
|
||||
#ifdef notdef
|
||||
/* for the moment, netmasks are skipped over */
|
||||
if (!banner_printed) {
|
||||
@ -562,6 +564,9 @@ p_rtentry(rt)
|
||||
union sockaddr_union addr_un, mask_un;
|
||||
struct sockaddr *addr, *mask;
|
||||
|
||||
if (Lflag && (rt->rt_flags & RTF_LLINFO))
|
||||
return;
|
||||
|
||||
memset(&addr_un, 0, sizeof(addr_un));
|
||||
memset(&mask_un, 0, sizeof(mask_un));
|
||||
addr = sockcopy(kgetsa(rt_key(rt)), &addr_un);
|
||||
|
Loading…
Reference in New Issue
Block a user