Skip to contentSkip to conversation

iptables-xml broken with IPTABLES_MULTI

PATCH Applied Lutz Jaenicke 2 participants 3 messages Dec 7, 2006 – Dec 11, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

Hi!

as of iptables-1.3.7 a new "iptables-xml" command is added automatically to the IPTABLES_MULTI executable. It however breaks during build. The attached patch seems to fix it.

Best regards,
Lutz

Signature · 8 lines
Dr.-Ing. Lutz Jänicke
CTO
Innominate Security Technologies AG  /protecting industrial networks/
tel: +49.30.6392-3308
fax: +49.30.6392-3307
Albert-Einstein-Str. 14
D-12489 Berlin, Germany
www.innominate.com

Index: ip6tables-restore.c
===================================================================
RCS file: /cvs/mguard/iptables/ip6tables-restore.c,v retrieving revision 1.5

ip6tables-restore.c +1 -1
diff -u -r1.5 ip6tables-restore.c
@@ -74,7 +74,7 @@
 	return handle;
 }
 
-int parse_counters(char *string, struct ip6t_counters *ctr)
+static int parse_counters(char *string, struct ip6t_counters *ctr)
 {
 	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2);
 }

Index: iptables-multi.c
===================================================================
RCS file: /cvs/mguard/iptables/iptables-multi.c,v
retrieving revision 1.5

iptables-multi.c +4 -0
diff -u -r1.5 iptables-multi.c
@@ -12,6 +12,7 @@
 int iptables_main(int argc, char **argv);
 int iptables_save_main(int argc, char **argv);
 int iptables_restore_main(int argc, char **argv);
+int iptables_xml_main(int argc, char **argv);
 
 int innominate_log_api = 0;
 
@@ -72,6 +73,9 @@
     if (!strcmp(progname, "iptables-restore"))
       return iptables_restore_main(argc, argv);
     
+    if (!strcmp(progname, "iptables-xml"))
+      return iptables_xml_main(argc, argv);
+    
     fprintf(stderr, "iptables multi-purpose version: unknown applet name %s\n", progname);
     exit(1);
   }

Index: iptables-restore.c
===================================================================
RCS file: /cvs/mguard/iptables/iptables-restore.c,v retrieving revision 1.5

iptables-restore.c +1 -1
diff -u -r1.5 iptables-restore.c
@@ -71,7 +71,7 @@
 	return handle;
 }
 
-int parse_counters(char *string, struct ipt_counters *ctr)
+static int parse_counters(char *string, struct ipt_counters *ctr)
 {
 	return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2);
 }

Index: iptables-xml.c
===================================================================
RCS file: /cvs/mguard/iptables/iptables-xml.c,v
retrieving revision 1.1

iptables-xml.c +5 -4
diff -u -r1.1 iptables-xml.c
@@ -26,9 +26,9 @@
 /* no need to link with iptables.o */
 const char *program_name;
 const char *program_version;
-int line = 0;
 
-void
+#ifndef IPTABLES_MULTI
+int line = 0;
 exit_error(enum exittype status, char *msg, ...)
 {
 	va_list args;
@@ -41,6 +41,7 @@
 	/* On error paths, make sure that we don't leak memory */
 	exit(status);
 }
+#endif
 
 static void print_usage(const char *name, const char *version)
 	    __attribute__ ((noreturn));
@@ -66,7 +67,7 @@
 	exit(1);
 }
 
-int
+static int
 parse_counters(char *string, struct ipt_counters *ctr)
 {
 	if (string != NULL)
@@ -605,7 +606,7 @@
 
 #ifdef IPTABLES_MULTI
 int
-iptables_restore_main(int argc, char *argv[])
+iptables_xml_main(int argc, char *argv[])
 #else
 int
 main(int argc, char *argv[])
#1 lore raw

From: Lutz Jaenicke <[email protected]>
Date: Thu, 7 Dec 2006 13:38:47 +0100

Quoted 5 lines

Hi!

as of iptables-1.3.7 a new "iptables-xml" command is added automatically to the IPTABLES_MULTI executable. It however breaks during build. The attached patch seems to fix it.

Wow same timing. Your patch is better than mine, then I'll apply it.

Thanks a lot.

-- Yasuyuki Kozakai

#2 lore raw

From: Yasuyuki KOZAKAI <[email protected]>
Date: Thu, 07 Dec 2006 21:49:02 +0900 (JST)

Quoted 5 lines

From: Lutz Jaenicke <[email protected]>
Date: Thu, 7 Dec 2006 13:38:47 +0100

Quoted 2 lines

Hi!

Quoted 7 lines
Quoted 3 lines

as of iptables-1.3.7 a new "iptables-xml" command is added automatically to the IPTABLES_MULTI executable. It however breaks during build. The attached patch seems to fix it.

Wow same timing. Your patch is better than mine, then I'll apply it.

Thanks a lot.

Applied. I've also added the deleted 'void' for exit_error and fixed Makefile to create link iptables-xml to iptables.

-- Yasuyuki Kozakai