netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* iptables: restore -T option
@ 2011-09-11 10:38 Jan Engelhardt
  2011-09-11 10:38 ` [PATCH 1/4] build: sort file list before build Jan Engelhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-09-11 10:38 UTC (permalink / raw)
  To: netfilter-devel



Suggestion to merge this into 'stable'.

===
The following changes since commit 62fc25fd1625f0f65b9eed3e15fe929dd0aff2c5:

  Merge branch 'master' of git://dev.medozas.de/iptables (2011-09-08 17:00:49 +0200)

are available in the git repository at:

  git://dev.medozas.de/iptables stable

Jan Engelhardt (4):
      build: sort file list before build
      doc: fix undesired newline in ip6tables-restore(8)
      ip6tables-restore: implement missing -T option
      doc: document iptables-restore's -T option

 extensions/GNUmakefile.in    |   12 ++++++------
 iptables/ip6tables-restore.8 |    4 +++-
 iptables/ip6tables-restore.c |   11 ++++++++++-
 iptables/iptables-restore.8  |    5 ++++-
 4 files changed, 23 insertions(+), 9 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] build: sort file list before build
  2011-09-11 10:38 iptables: restore -T option Jan Engelhardt
@ 2011-09-11 10:38 ` Jan Engelhardt
  2011-09-11 10:38 ` [PATCH 2/4] doc: fix undesired newline in ip6tables-restore(8) Jan Engelhardt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-09-11 10:38 UTC (permalink / raw)
  To: netfilter-devel

Manpage subsections are already sorted for obvious reasons. Since
$(wildcard) can actually return results unordered (just what the OS
can do) do the sorting with the .o file list too, for developer
comfort.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 extensions/GNUmakefile.in |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in
index a9edb1e..60f28c0 100644
--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -37,9 +37,9 @@ endif
 #
 #	Wildcard module list
 #
-pfx_build_mod := $(patsubst ${srcdir}/libxt_%.c,%,$(wildcard ${srcdir}/libxt_*.c))
-@ENABLE_IPV4_TRUE@ pf4_build_mod := $(patsubst ${srcdir}/libipt_%.c,%,$(wildcard ${srcdir}/libipt_*.c))
-@ENABLE_IPV6_TRUE@ pf6_build_mod := $(patsubst ${srcdir}/libip6t_%.c,%,$(wildcard ${srcdir}/libip6t_*.c))
+pfx_build_mod := $(patsubst ${srcdir}/libxt_%.c,%,$(sort $(wildcard ${srcdir}/libxt_*.c)))
+@ENABLE_IPV4_TRUE@ pf4_build_mod := $(patsubst ${srcdir}/libipt_%.c,%,$(sort $(wildcard ${srcdir}/libipt_*.c)))
+@ENABLE_IPV6_TRUE@ pf6_build_mod := $(patsubst ${srcdir}/libip6t_%.c,%,$(sort $(wildcard ${srcdir}/libip6t_*.c)))
 pfx_build_mod := $(filter-out @blacklist_modules@,${pfx_build_mod})
 pf4_build_mod := $(filter-out @blacklist_modules@,${pf4_build_mod})
 pf6_build_mod := $(filter-out @blacklist_modules@,${pf6_build_mod})
@@ -198,11 +198,11 @@ initext6.c: .initext6.dd
 #
 #	Manual pages
 #
-ex_matches = $(sort $(shell echo $(1) | LC_ALL=POSIX grep -Eo '\b[[:lower:][:digit:]_]+\b'))
-ex_targets = $(sort $(shell echo $(1) | LC_ALL=POSIX grep -Eo '\b[[:upper:][:digit:]_]+\b'))
+ex_matches = $(shell echo ${1} | LC_ALL=POSIX grep -Eo '\b[[:lower:][:digit:]_]+\b')
+ex_targets = $(shell echo ${1} | LC_ALL=POSIX grep -Eo '\b[[:upper:][:digit:]_]+\b')
 man_run    = \
 	${AM_VERBOSE_GEN} \
-	for ext in $(1); do \
+	for ext in $(sort ${1}); do \
 		f="${srcdir}/libxt_$$ext.man"; \
 		cf="${srcdir}/libxt_$$ext.c"; \
 		if [ -f "$$f" ] && grep -Eq "$(3)|NFPROTO_UNSPEC" "$$cf"; then \
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] doc: fix undesired newline in ip6tables-restore(8)
  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 ` Jan Engelhardt
  2011-09-11 10:38 ` [PATCH 3/4] ip6tables-restore: implement missing -T option Jan Engelhardt
  2011-09-11 10:38 ` [PATCH 4/4] doc: document iptables-restore's " Jan Engelhardt
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-09-11 10:38 UTC (permalink / raw)
  To: netfilter-devel

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

diff --git a/iptables/ip6tables-restore.8 b/iptables/ip6tables-restore.8
index 0264807..aa09768 100644
--- a/iptables/ip6tables-restore.8
+++ b/iptables/ip6tables-restore.8
@@ -32,7 +32,6 @@ I/O redirection provided by your shell to read from a file
 restore the values of all packet and byte counters
 .TP
 \fB\-n\fR, \fB\-\-noflush\fR 
-.TP
 don't flush the previous contents of the table. If not specified, 
 .B ip6tables-restore
 flushes (deletes) all previous contents of the respective IPv6 Table.
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ip6tables-restore: implement missing -T option
  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
  2011-09-11 10:38 ` [PATCH 4/4] doc: document iptables-restore's " Jan Engelhardt
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-09-11 10:38 UTC (permalink / raw)
  To: netfilter-devel

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] doc: document iptables-restore's -T option
  2011-09-11 10:38 iptables: restore -T option Jan Engelhardt
                   ` (2 preceding siblings ...)
  2011-09-11 10:38 ` [PATCH 3/4] ip6tables-restore: implement missing -T option Jan Engelhardt
@ 2011-09-11 10:38 ` Jan Engelhardt
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2011-09-11 10:38 UTC (permalink / raw)
  To: netfilter-devel

Commit v1.4.0-rc1-12-ge8665f8 completely forgot this.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 iptables/ip6tables-restore.8 |    3 +++
 iptables/iptables-restore.8  |    5 ++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/iptables/ip6tables-restore.8 b/iptables/ip6tables-restore.8
index aa09768..59a3b2e 100644
--- a/iptables/ip6tables-restore.8
+++ b/iptables/ip6tables-restore.8
@@ -33,6 +33,9 @@ restore the values of all packet and byte counters
 .TP
 \fB\-n\fR, \fB\-\-noflush\fR 
 don't flush the previous contents of the table. If not specified, 
+.TP
+\fB\-T\fP, \fB\-\-table\fP \fIname\fP
+Restore only the named table even if the input stream contains other ones.
 .B ip6tables-restore
 flushes (deletes) all previous contents of the respective IPv6 Table.
 .SH BUGS
diff --git a/iptables/iptables-restore.8 b/iptables/iptables-restore.8
index a52bceb..0dd20cb 100644
--- a/iptables/iptables-restore.8
+++ b/iptables/iptables-restore.8
@@ -21,7 +21,7 @@
 .SH NAME
 iptables-restore \(em Restore IP Tables
 .SH SYNOPSIS
-\fBiptables\-restore\fP [\fB\-c\fP] [\fB\-n\fP]
+\fBiptables\-restore\fP [\fB\-c\fP] [\fB\-n\fP] [\fB\-T\fP \fIname\fP]
 .SH DESCRIPTION
 .PP
 .B iptables-restore
@@ -35,6 +35,9 @@ restore the values of all packet and byte counters
 don't flush the previous contents of the table. If not specified, 
 .B iptables-restore
 flushes (deletes) all previous contents of the respective IP Table.
+.TP
+\fB\-T\fP, \fB\-\-table\fP \fIname\fP
+Restore only the named table even if the input stream contains other ones.
 .SH BUGS
 None known as of iptables-1.2.1 release
 .SH AUTHOR
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-11 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/4] ip6tables-restore: implement missing -T option Jan Engelhardt
2011-09-11 10:38 ` [PATCH 4/4] doc: document iptables-restore's " Jan Engelhardt

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).