netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@medozas.de>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH 3/4] ip6tables-restore: implement missing -T option
Date: Sun, 11 Sep 2011 12:38:45 +0200	[thread overview]
Message-ID: <1315737527-19595-4-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1315737527-19595-1-git-send-email-jengelh@medozas.de>

Commit v1.4.0-rc1-12-ge8665f8 forgot to port the change to the
ip6tables part.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 iptables/ip6tables-restore.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c
index 985744d..1487504 100644
--- a/iptables/ip6tables-restore.c
+++ b/iptables/ip6tables-restore.c
@@ -36,6 +36,7 @@ static const struct option options[] = {
 	{.name = "help",     .has_arg = false, .val = 'h'},
 	{.name = "noflush",  .has_arg = false, .val = 'n'},
 	{.name = "modprobe", .has_arg = true,  .val = 'M'},
+	{.name = "table",    .has_arg = true,  .val = 'T'},
 	{NULL},
 };
 
@@ -121,6 +122,7 @@ int ip6tables_restore_main(int argc, char *argv[])
 	char curtable[IP6T_TABLE_MAXNAMELEN + 1];
 	FILE *in;
 	int in_table = 0, testing = 0;
+	const char *tablename = NULL;
 
 	line = 0;
 
@@ -137,7 +139,7 @@ int ip6tables_restore_main(int argc, char *argv[])
 	init_extensions6();
 #endif
 
-	while ((c = getopt_long(argc, argv, "bcvthnM:", options, NULL)) != -1) {
+	while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) {
 		switch (c) {
 			case 'b':
 				binary = 1;
@@ -161,6 +163,9 @@ int ip6tables_restore_main(int argc, char *argv[])
 			case 'M':
 				xtables_modprobe_program = optarg;
 				break;
+			case 'T':
+				tablename = optarg;
+				break;
 		}
 	}
 
@@ -216,6 +221,8 @@ int ip6tables_restore_main(int argc, char *argv[])
 			strncpy(curtable, table, IP6T_TABLE_MAXNAMELEN);
 			curtable[IP6T_TABLE_MAXNAMELEN] = '\0';
 
+			if (tablename != NULL && strcmp(tablename, table) != 0)
+				continue;
 			if (handle)
 				ip6tc_free(handle);
 
@@ -442,6 +449,8 @@ int ip6tables_restore_main(int argc, char *argv[])
 			free_argv();
 			fflush(stdout);
 		}
+		if (tablename != NULL && strcmp(tablename, curtable) != 0)
+			continue;
 		if (!ret) {
 			fprintf(stderr, "%s: line %u failed\n",
 					ip6tables_globals.program_name,
-- 
1.7.3.4


  parent reply	other threads:[~2011-09-11 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-11 10:38 iptables: restore -T option Jan Engelhardt
2011-09-11 10:38 ` [PATCH 1/4] build: sort file list before build Jan Engelhardt
2011-09-11 10:38 ` [PATCH 2/4] doc: fix undesired newline in ip6tables-restore(8) Jan Engelhardt
2011-09-11 10:38 ` Jan Engelhardt [this message]
2011-09-11 10:38 ` [PATCH 4/4] doc: document iptables-restore's -T option Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315737527-19595-4-git-send-email-jengelh@medozas.de \
    --to=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).