Author: cy
Date: Fri Jul 17 19:07:44 2020
New Revision: 363280
URL: https://svnweb.freebsd.org/changeset/base/363280

Log:
  ipfstat -t defaults to IPv4 output. Make consistent with ipfstat -i
  and ipfstat -o where without an argument IPv4 and IPv6 states are
  shown. Use -4 and -6 to limit the display to IPv4 or IPv6 respectively.
  
  PR:           247952
  MFC after:    1 week

Modified:
  head/contrib/ipfilter/man/ipfstat.8
  head/contrib/ipfilter/tools/ipfstat.c

Modified: head/contrib/ipfilter/man/ipfstat.8
==============================================================================
--- head/contrib/ipfilter/man/ipfstat.8 Fri Jul 17 19:07:40 2020        
(r363279)
+++ head/contrib/ipfilter/man/ipfstat.8 Fri Jul 17 19:07:44 2020        
(r363280)
@@ -195,4 +195,5 @@ more entries is to resize the screen.
 .SH SEE ALSO
 ipf(8)
 .SH BUGS
-\fB-4\fP and \fB-6\fP should also be the default when displaying states.
+\fB-4\fP and \fB-6\fP are only valid with \fB-i\fP, \fB-o\fP, and \fB-t\fP.
+An error should result when used with other arguments.

Modified: head/contrib/ipfilter/tools/ipfstat.c
==============================================================================
--- head/contrib/ipfilter/tools/ipfstat.c       Fri Jul 17 19:07:40 2020        
(r363279)
+++ head/contrib/ipfilter/tools/ipfstat.c       Fri Jul 17 19:07:44 2020        
(r363280)
@@ -421,9 +421,9 @@ int main(argc,argv)
        else if (opts & OPT_STATETOP)
                topipstates(saddr, daddr, sport, dport, protocol,
 #ifdef USE_INET6
-                           use_inet6 && !use_inet4 ? 6 : 4,
+               use_inet6 && use_inet4 ? 0 : use_inet6 && !use_inet4 ? 6 : 4,
 #else
-                           4,
+               4,
 #endif
 #endif
                            refreshtime, topclosed, filter);
@@ -1367,7 +1367,7 @@ static void topipstates(saddr, daddr, sport, dport, pr
                        if (ipsstp->iss_list == NULL)
                                break;
 
-                       if (ips.is_v != ver)
+                       if (ver != 0 && ips.is_v != ver)
                                continue;
 
                        if ((filter != NULL) &&
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to