From: Peter Warasin <peter@endian.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/3] iptables-edit: adds --table to iptables-restore
Date: Sat, 20 Oct 2007 02:57:00 +0200 [thread overview]
Message-ID: <4719525C.2080400@endian.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
adds --table to iptables-restore which allows to restore only the
supplied table
Signed-off-by: Peter Warasin <peter@endian.com>
--
:: e n d i a n
:: open source - open minds
:: peter warasin
:: http://www.endian.com :: peter@endian.com
[-- Attachment #2: iptables-1.3.8-edit-p1.patch --]
[-- Type: text/x-patch, Size: 1507 bytes --]
--- iptables-1.3.8.patch/iptables-restore.c.orig 2007-10-19 01:17:49.000000000 +0200
+++ iptables-1.3.8.patch/iptables-restore.c 2007-10-19 01:33:06.000000000 +0200
@@ -32,6 +32,7 @@
{ "help", 0, 0, 'h' },
{ "noflush", 0, 0, 'n'},
{ "modprobe", 1, 0, 'M'},
+ { "table", 1, 0, 'T'},
{ 0 }
};
@@ -46,6 +47,7 @@
" [ --test ]\n"
" [ --help ]\n"
" [ --noflush ]\n"
+ " [ --table=<TABLE> ]\n"
" [ --modprobe=<command>]\n", name);
exit(1);
@@ -114,6 +116,7 @@
FILE *in;
const char *modprobe = 0;
int in_table = 0, testing = 0;
+ const char *tablename = 0;
program_name = "iptables-restore";
program_version = IPTABLES_VERSION;
@@ -127,7 +130,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) {
switch (c) {
case 'b':
binary = 1;
@@ -151,6 +154,9 @@
case 'M':
modprobe = optarg;
break;
+ case 'T':
+ tablename = optarg;
+ break;
}
}
@@ -203,6 +209,8 @@
strncpy(curtable, table, IPT_TABLE_MAXNAMELEN);
curtable[IPT_TABLE_MAXNAMELEN] = '\0';
+ if (tablename && (strcmp(tablename, table) != 0))
+ continue;
if (handle)
iptc_free(&handle);
@@ -429,6 +437,8 @@
free_argv();
}
+ if (tablename && (strcmp(tablename, curtable) != 0))
+ continue;
if (!ret) {
fprintf(stderr, "%s: line %u failed\n",
program_name, line);
reply other threads:[~2007-10-20 1:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4719525C.2080400@endian.com \
--to=peter@endian.com \
--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).