]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Add support for --set-counters to iptables -P
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Mon, 12 May 2008 18:53:16 +0000 (20:53 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 12 May 2008 18:53:16 +0000 (20:53 +0200)
Adds support for setting the policy counters

iptables -P INPUT -J DROP -c 10 20

Henrik Nordstrom <henrik@henriknordstrom.net>

ip6tables.c
iptables.c

index bc65012fb4f905332eeeede7e8afbc9b432f8c4f..dc74bcbe0c1fab7859195877cebb84ecacdbf60c 100644 (file)
@@ -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... */
index db97d08f7fa04c8356329abb9b6e2989ba656c8c..8c876d2275835b274b27e3287edbe0f5295cacce 100644 (file)
@@ -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... */