summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/if.c8
-rw-r--r--usr.bin/netstat/main.c5
-rw-r--r--usr.bin/netstat/netstat.14
3 files changed, 14 insertions, 3 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index ca88fce..4fb63b8 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -251,7 +251,6 @@ intpr(int interval, u_long ifnetaddr, void (*pfunc)(char *))
*cp = '\0';
ifaddraddr = (u_long)TAILQ_FIRST(&ifnet.if_addrhead);
}
- printf("%-5.5s %-5lu ", name, ifnet.if_mtu);
ifaddrfound = ifaddraddr;
/*
@@ -269,6 +268,7 @@ intpr(int interval, u_long ifnetaddr, void (*pfunc)(char *))
drops = ifnet.if_snd.ifq_drops;
if (ifaddraddr == 0) {
+ printf("%-5.5s %-5lu ", name, ifnet.if_mtu);
printf("%-13.13s ", "none");
printf("%-15.15s ", "none");
} else {
@@ -280,6 +280,12 @@ intpr(int interval, u_long ifnetaddr, void (*pfunc)(char *))
cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
CP(&ifaddr);
sa = (struct sockaddr *)cp;
+ if (af != AF_UNSPEC && sa->sa_family != af) {
+ ifaddraddr =
+ (u_long)TAILQ_NEXT(&ifaddr.ifa, ifa_link);
+ continue;
+ }
+ printf("%-5.5s %-5lu ", name, ifnet.if_mtu);
switch (sa->sa_family) {
case AF_UNSPEC:
printf("%-13.13s ", "none");
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 46e03f5..8d1e044 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -393,6 +393,8 @@ main(argc, argv)
else if (strcmp(optarg, "iso") == 0)
af = AF_ISO;
#endif
+ else if (strcmp(optarg, "link") == 0)
+ af = AF_LINK;
else {
errx(1, "%s: unknown address family", optarg);
}
@@ -754,7 +756,8 @@ usage(void)
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: netstat [-AaLnSW] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
-" netstat -i | -I interface [-abdnt] [-M core] [-N system]",
+" netstat -i | -I interface [-abdnt] [-f address_family]\n"
+" [-M core] [-N system]",
" netstat -w wait [-I interface] [-d] [-M core] [-N system]",
" netstat -s [-s] [-z] [-f protocol_family | -p protocol] [-M core]",
" netstat -i | -I interface -s [-f protocol_family | -p protocol]\n"
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index 7ce61f7..5662ecc 100644
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -90,6 +90,7 @@ but show ports symbolically.
.Nm
.Fl i | I Ar interface
.Op Fl abdnt
+.Op Fl f Ar address_family
.Op Fl M Ar core
.Op Fl N Ar system
.Ek
@@ -109,7 +110,7 @@ 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
+If
.Fl b
is also present, show the number of bytes in and out.
If
@@ -286,6 +287,7 @@ The following address families and protocols are recognized:
.\".It Cm iso Pq Dv AF_ISO
.\".Cm clnp , cltp , esis , tp
.It Cm unix Pq Dv AF_UNIX
+.It Cm link Pq Dv AF_LINK
.El
.Pp
The program will complain if
OpenPOWER on IntegriCloud