aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2014-08-22 19:23:38 +0000
committerMark Johnston <markj@FreeBSD.org>2014-08-22 19:23:38 +0000
commitd77e67e495266d993f07d5b20822faf127bd1948 (patch)
tree2e400f4af0d04a05bbef1ca731ce01ca6b17a138
parent5fc263228151d48e246fc278ba257c535b6c9e38 (diff)
downloadsrc-d77e67e495266d993f07d5b20822faf127bd1948.tar.gz
src-d77e67e495266d993f07d5b20822faf127bd1948.zip
Suppress warnings when retrieving protocol stats from interfaces that
don't support IPv6 (e.g. pflog(4)). Reviewed by: hrs MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=270349
-rw-r--r--usr.bin/netstat/inet6.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 78383ac6a616..768ccf22a7ec 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -540,13 +540,13 @@ ip6_ifstats(char *ifname)
}
strcpy(ifr.ifr_name, ifname);
- printf("ip6 on %s:\n", ifr.ifr_name);
-
if (ioctl(s, SIOCGIFSTAT_IN6, (char *)&ifr) < 0) {
- perror("Warning: ioctl(SIOCGIFSTAT_IN6)");
+ if (errno != EPFNOSUPPORT)
+ perror("Warning: ioctl(SIOCGIFSTAT_IN6)");
goto end;
}
+ printf("ip6 on %s:\n", ifr.ifr_name);
p(ifs6_in_receive, "\t%ju total input datagram%s\n");
p(ifs6_in_hdrerr, "\t%ju datagram%s with invalid header received\n");
p(ifs6_in_toobig, "\t%ju datagram%s exceeded MTU received\n");
@@ -945,13 +945,13 @@ icmp6_ifstats(char *ifname)
}
strcpy(ifr.ifr_name, ifname);
- printf("icmp6 on %s:\n", ifr.ifr_name);
-
if (ioctl(s, SIOCGIFSTAT_ICMP6, (char *)&ifr) < 0) {
- perror("Warning: ioctl(SIOCGIFSTAT_ICMP6)");
+ if (errno != EPFNOSUPPORT)
+ perror("Warning: ioctl(SIOCGIFSTAT_ICMP6)");
goto end;
}
+ printf("icmp6 on %s:\n", ifr.ifr_name);
p(ifs6_in_msg, "\t%ju total input message%s\n");
p(ifs6_in_error, "\t%ju total input error message%s\n");
p(ifs6_in_dstunreach, "\t%ju input destination unreachable error%s\n");