Author: bdrewery
Date: Thu Feb  7 21:05:44 2019
New Revision: 343877
URL: https://svnweb.freebsd.org/changeset/base/343877

Log:
  ipfw table list: Fix showing header outside of 'all'.
  
  Properly pass down is_all to table_show_list().  This restores the behavior
  before r272840 so that only 'ipfw table all list' shows the headers.
  
  MFC after:    2 weeks
  Relnotes:     yes

Modified:
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/tables.c
==============================================================================
--- head/sbin/ipfw/tables.c     Thu Feb  7 20:58:45 2019        (r343876)
+++ head/sbin/ipfw/tables.c     Thu Feb  7 21:05:44 2019        (r343877)
@@ -282,13 +282,14 @@ ipfw_table_handler(int ac, char *av[])
                }
                break;
        case TOK_LIST:
+               arg = is_all ? (void*)1 : (void*)0;
                if (is_all == 0) {
                        ipfw_xtable_info i;
                        if ((error = table_get_info(&oh, &i)) != 0)
                                err(EX_OSERR, "failed to request table info");
-                       table_show_one(&i, NULL);
+                       table_show_one(&i, arg);
                } else {
-                       error = tables_foreach(table_show_one, NULL, 1);
+                       error = tables_foreach(table_show_one, arg, 1);
                        if (error != 0)
                                err(EX_OSERR, "failed to request tables list");
                }
@@ -821,13 +822,14 @@ table_show_one(ipfw_xtable_info *i, void *arg)
 {
        ipfw_obj_header *oh;
        int error;
+       int is_all = (int)arg;
 
        if ((error = table_do_get_list(i, &oh)) != 0) {
                err(EX_OSERR, "Error requesting table %s list", i->tablename);
                return (error);
        }
 
-       table_show_list(oh, 1);
+       table_show_list(oh, is_all);
 
        free(oh);
        return (0);     
_______________________________________________
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