On Nov 5 2007 01:13, Peter Warasin wrote: >Date: Mon, 05 Nov 2007 01:13:53 +0100 >From: Peter Warasin <peter@xxxxxxxxxx> >To: <netfilter-devel@xxxxxxxxxxxxxxx> >Subject: [PATCH 1/3] iptables-edit: iptables-edit: adds --table to > iptables-restore > > >-- >:: e n d i a n >:: open source - open minds > >:: peter warasin >:: http://www.endian.com :: peter@xxxxxxxxxx > Well, please send patches inline so I can reply to something. |adds --table to iptables-restore which allows to restore only the |supplied table | |Signed-off-by: Peter Warasin <peter@xxxxxxxxxx> |--- | iptables-restore.c | 12 +++++++++++- | 1 file changed, 11 insertions(+), 1 deletion(-) | |Index: iptables-restore.c |=================================================================== |--- iptables-restore.c.orig |+++ iptables-restore.c |@@ -33,6 +33,7 @@ | { "help", 0, 0, 'h' }, | { "noflush", 0, 0, 'n'}, | { "modprobe", 1, 0, 'M'}, |+ { "table", 1, 0, 'T'}, | { 0 } | }; | |@@ -47,6 +48,7 @@ | " [ --test ]\n" | " [ --help ]\n" | " [ --noflush ]\n" |+ " [ --table=<TABLE> ]\n" | " [ --modprobe=<command>]\n", name); | | exit(1); |@@ -123,6 +125,7 @@ | FILE *in; | const char *modprobe = 0; | int in_table = 0, testing = 0; |+ const char *tablename = 0; Use NULL instead. | | program_name = "iptables-restore"; | program_version = IPTABLES_VERSION; |@@ -136,7 +139,7 @@ | init_extensions(); | #endif | |- while ((c = getopt_long(argc, argv, "bcvthnM:", options, NULL)) != -1) { |+ while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) { Use -t instead, that would go in line with the -t from iptables. | switch (c) { | case 'b': | binary = 1; |@@ -160,6 +163,9 @@ | case 'M': | modprobe = optarg; | break; |+ case 'T': |+ tablename = optarg; |+ break; | } | } | |@@ -212,6 +218,8 @@ | strncpy(curtable, table, IPT_TABLE_MAXNAMELEN); | curtable[IPT_TABLE_MAXNAMELEN] = '\0'; | |+ if (tablename && (strcmp(tablename, table) != 0)) |+ continue; drop extra () | if (handle) | iptc_free(&handle); | |@@ -438,6 +446,8 @@ | | free_argv(); | } |+ if (tablename && (strcmp(tablename, curtable) != 0)) |+ continue; | if (!ret) { | fprintf(stderr, "%s: line %u failed\n", | program_name, line); same - To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html