summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2014-09-06 04:39:26 +0000
committermarkj <markj@FreeBSD.org>2014-09-06 04:39:26 +0000
commit5a094736fbe3fd6bd8c010c175a09079474f21b1 (patch)
tree4fbf7ab9d79f6bc57abd704e201518ed3ce92e8f /usr.bin/netstat
parent27eceb3a0f34841bf4ee20b50a6908858356ce12 (diff)
downloadFreeBSD-src-5a094736fbe3fd6bd8c010c175a09079474f21b1.zip
FreeBSD-src-5a094736fbe3fd6bd8c010c175a09079474f21b1.tar.gz
MFC r270348:
Add some missing checks for unsupported interfaces (e.g. pflog(4)) when handling ioctls. While here, remove duplicated checks for a NULL ifp in in6_control(): this check is already done near the beginning of the function. MFC r270349: Suppress warnings when retrieving protocol stats from interfaces that don't support IPv6 (e.g. pflog(4)). PR: 189117 Approved by: re (gjb)
Diffstat (limited to 'usr.bin/netstat')
-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 78383ac..768ccf2 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");
OpenPOWER on IntegriCloud