From 48c1bc6fa2f3aa755e89518054ef3f612d7b2c1f Mon Sep 17 00:00:00 2001 From: Henrik Nordstrom Date: Mon, 12 May 2008 20:53:16 +0200 Subject: Add support for --set-counters to iptables -P Adds support for setting the policy counters iptables -P INPUT -J DROP -c 10 20 Henrik Nordstrom --- ip6tables.c | 4 ++-- iptables.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ip6tables.c b/ip6tables.c index bc65012f..dc74bcbe 100644 --- a/ip6tables.c +++ b/ip6tables.c @@ -165,7 +165,7 @@ static char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] = /*ZERO*/ {'x','x','x','x','x',' ','x','x','x','x','x'}, /*NEW_CHAIN*/ {'x','x','x','x','x',' ','x','x','x','x','x'}, /*DEL_CHAIN*/ {'x','x','x','x','x',' ','x','x','x','x','x'}, -/*SET_POLICY*/{'x','x','x','x','x',' ','x','x','x','x','x'}, +/*SET_POLICY*/{'x','x','x','x','x',' ','x','x','x','x',' '}, /*RENAME*/ {'x','x','x','x','x',' ','x','x','x','x','x'} }; @@ -1802,7 +1802,7 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle) ret = ip6tc_rename_chain(chain, newname, handle); break; case CMD_SET_POLICY: - ret = ip6tc_set_policy(chain, policy, NULL, handle); + ret = ip6tc_set_policy(chain, policy, options&OPT_COUNTERS ? &fw.counters : NULL, handle); break; default: /* We should never reach this... */ diff --git a/iptables.c b/iptables.c index db97d08f..8c876d22 100644 --- a/iptables.c +++ b/iptables.c @@ -165,7 +165,7 @@ static char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] = /*ZERO*/ {'x','x','x','x','x',' ','x','x','x','x','x','x'}, /*NEW_CHAIN*/ {'x','x','x','x','x',' ','x','x','x','x','x','x'}, /*DEL_CHAIN*/ {'x','x','x','x','x',' ','x','x','x','x','x','x'}, -/*SET_POLICY*/{'x','x','x','x','x',' ','x','x','x','x','x','x'}, +/*SET_POLICY*/{'x','x','x','x','x',' ','x','x','x','x','x',' '}, /*RENAME*/ {'x','x','x','x','x',' ','x','x','x','x','x','x'} }; @@ -1842,7 +1842,7 @@ int do_command(int argc, char *argv[], char **table, iptc_handle_t *handle) ret = iptc_rename_chain(chain, newname, handle); break; case CMD_SET_POLICY: - ret = iptc_set_policy(chain, policy, NULL, handle); + ret = iptc_set_policy(chain, policy, options&OPT_COUNTERS ? &fw.counters : NULL, handle); break; default: /* We should never reach this... */ -- cgit v1.2.3