Date: Fri, 22 Aug 2014 19:23:39 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270349 - head/usr.bin/netstat Message-ID: <201408221923.s7MJNd5x015655@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Aug 22 19:23:38 2014 New Revision: 270349 URL: http://svnweb.freebsd.org/changeset/base/270349 Log: Suppress warnings when retrieving protocol stats from interfaces that don't support IPv6 (e.g. pflog(4)). Reviewed by: hrs MFC after: 2 weeks Modified: head/usr.bin/netstat/inet6.c Modified: head/usr.bin/netstat/inet6.c ============================================================================== --- head/usr.bin/netstat/inet6.c Fri Aug 22 19:21:08 2014 (r270348) +++ head/usr.bin/netstat/inet6.c Fri Aug 22 19:23:38 2014 (r270349) @@ -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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408221923.s7MJNd5x015655>