SOURCES: iptables-batch.patch - I hope that's finally proper way

zbyniu zbyniu at pld-linux.org
Fri Mar 27 00:37:49 CET 2009


Author: zbyniu                       Date: Thu Mar 26 23:37:49 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- I hope that's finally proper way

---- Files affected:
SOURCES:
   iptables-batch.patch (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/iptables-batch.patch
diff -u SOURCES/iptables-batch.patch:1.5 SOURCES/iptables-batch.patch:1.6
--- SOURCES/iptables-batch.patch:1.5	Thu Mar 26 14:11:12 2009
+++ SOURCES/iptables-batch.patch	Fri Mar 27 00:37:43 2009
@@ -24,7 +24,7 @@
 diff -urN iptables-1.4.1.1.orig/iptables-batch.c iptables-1.4.1.1/iptables-batch.c
 --- iptables-1.4.1.1.orig/iptables-batch.c	1970-01-01 01:00:00.000000000 +0100
 +++ iptables-1.4.1.1/iptables-batch.c	2008-08-24 10:42:00.000000000 +0200
-@@ -0,0 +1,474 @@
+@@ -0,0 +1,475 @@
 +/*
 + * Author: Ludwig Nussel <ludwig.nussel at suse.de>
 + *
@@ -217,9 +217,6 @@
 +static unsigned num_tables;
 +struct table_handle* current_table;
 +
-+/* Search path for Xtables .so files */
-+static const char *xtables_libdir;
-+
 +static void
 +alloc_tables()
 +{
@@ -355,7 +352,11 @@
 +static void
 +help()
 +{
-+	fprintf(stderr, "Usage: %s [FILE]\n\n", xt_params->program_name);
++#ifdef BATCH_IPV6
++	fprintf(stderr, "Usage: %s [FILE]\n\n", ip6tables_globals.program_name);
++#else
++	fprintf(stderr, "Usage: %s [FILE]\n\n", iptables_globals.program_name);
++#endif
 +	puts("Read iptables commands from FILE, commit them at EOF\n");
 +	puts("In addition to normal iptables calls the commands");
 +	puts("'commit' and 'exit' are understood.");
@@ -383,22 +384,22 @@
 +	FILE* fp = stdin;
 +
 +#ifdef BATCH_IPV6
-+	//program_name = "ip6tables-batch";
-+
-+	xtables_libdir = getenv("XTABLES_LIBDIR");
-+	if (!xtables_libdir) {
-+		xtables_libdir = getenv("IP6TABLES_LIB_DIR");
-+		if (!xtables_libdir)
-+			xtables_libdir = XTABLES_LIBDIR;
++	ip6tables_globals.program_name = "ip6tables-batch";
++	ret = xtables_init_all(&ip6tables_globals, NFPROTO_IPV6);
++	if (ret < 0) {
++		fprintf(stderr, "%s/%s Failed to initialize xtables\n",
++				ip6tables_globals.program_name,
++				ip6tables_globals.program_version);
++		exit(1);
 +	}
 +#else
-+	//program_name = "iptables-batch";
-+
-+	xtables_libdir = getenv("XTABLES_LIBDIR");
-+	if (!xtables_libdir) {
-+		xtables_libdir = getenv("IPTABLES_LIB_DIR");
-+		if (!xtables_libdir)
-+			xtables_libdir = XTABLES_LIBDIR;
++	iptables_globals.program_name = "iptables-batch";
++	ret = xtables_init_all(&iptables_globals, NFPROTO_IPV4);
++	if (ret < 0) {
++		fprintf(stderr, "%s/%s Failed to initialize xtables\n",
++			iptables_globals.program_name,
++			iptables_globals.program_version);
++		exit(1);
 +	}
 +
 +#endif
@@ -409,7 +410,7 @@
 +#endif
 +	if(argc > 1)
 +	{
-+		if(!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h"))
++		if(strcmp(argv[1], "--help") || strcmp(argv[1], "-h"))
 +		{
 +			help();
 +		}
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/iptables-batch.patch?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list