Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Feb 2019 21:05:44 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343877 - head/sbin/ipfw
Message-ID:  <201902072105.x17L5imT065262@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);	



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902072105.x17L5imT065262>