[netfilter-cvslog] r7522 - trunk/iptables

kaber at trash.net kaber at trash.net
Mon May 12 20:53:16 CEST 2008


Author: kaber at trash.net
Date: 2008-05-12 20:53:16 +0200 (Mon, 12 May 2008)
New Revision: 7522

Modified:
   trunk/iptables/ip6tables.c
   trunk/iptables/iptables.c
Log:
[patch 2/4] 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 <henrik at henriknordstrom.net>


Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c	2008-05-12 18:51:45 UTC (rev 7521)
+++ trunk/iptables/ip6tables.c	2008-05-12 18:53:16 UTC (rev 7522)
@@ -165,7 +165,7 @@
 /*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 @@
 		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... */

Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c	2008-05-12 18:51:45 UTC (rev 7521)
+++ trunk/iptables/iptables.c	2008-05-12 18:53:16 UTC (rev 7522)
@@ -165,7 +165,7 @@
 /*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 @@
 		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... */




More information about the netfilter-cvslog mailing list