From e081a19e97d14b0b78f67ef470ed0d2ea2141833 Mon Sep 17 00:00:00 2001 From: bdrewery Date: Thu, 28 Feb 2019 20:57:41 +0000 Subject: [PATCH] MFC r343877,r343880: r343877: ipfw table list: Fix showing header outside of 'all'. r343880: Fix build of r343877 Relnotes: yes --- sbin/ipfw/tables.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index 89bc36375d8..2f288a39f70 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -282,13 +282,14 @@ ipfw_table_handler(int ac, char *av[]) } break; case TOK_LIST: + arg = is_all ? (void*)1 : NULL; 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,16 @@ table_show_one(ipfw_xtable_info *i, void *arg) { ipfw_obj_header *oh; int error; + int is_all; + + is_all = arg == NULL ? 0 : 1; 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); -- 2.45.0