Submitted By: Jim Gifford <jciccone@linuxfromscratch.org>
Date: 2007-02-05
Initial Package Version: 1.3.7
Origin: http://lists.netfilter.org/pipermail/netfilter-devel/2006-December/026344.html
Upstream Status: Already Applied
Description: Fixes Build Issues with DO_MULTI=1

diff -Naur iptables-1.3.7.orig/Makefile iptables-1.3.7/Makefile
--- iptables-1.3.7.orig/Makefile	2006-12-04 03:16:01.000000000 -0800
+++ iptables-1.3.7/Makefile	2007-02-05 10:57:33.000000000 -0800
@@ -170,7 +170,7 @@
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
 
 ifeq ($(DO_MULTI), 1)
-$(DESTDIR)$(BINDIR)/iptables-xml: iptables-xml
+$(DESTDIR)$(BINDIR)/iptables-xml: iptables
 	@[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
 	ln -sf $< $@
 else
diff -Naur iptables-1.3.7.orig/iptables-multi.c iptables-1.3.7/iptables-multi.c
--- iptables-1.3.7.orig/iptables-multi.c	2006-12-04 03:15:20.000000000 -0800
+++ iptables-1.3.7/iptables-multi.c	2007-02-05 10:55:22.000000000 -0800
@@ -6,6 +6,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 main(int argc, char **argv) {
   char *progname;
@@ -24,6 +25,8 @@
     
     if (!strcmp(progname, "iptables-restore"))
       return iptables_restore_main(argc, argv);
+    if (!strcmp(progname, "iptables-xml"))
+      return iptables_restore_main(argc, argv);
     
     fprintf(stderr, "iptables multi-purpose version: unknown applet name %s\n", progname);
     exit(1);
diff -Naur iptables-1.3.7.orig/iptables-xml.c iptables-1.3.7/iptables-xml.c
--- iptables-1.3.7.orig/iptables-xml.c	2006-12-04 03:15:20.000000000 -0800
+++ iptables-1.3.7/iptables-xml.c	2007-02-05 10:55:22.000000000 -0800
@@ -26,8 +26,9 @@
 /* no need to link with iptables.o */
 const char *program_name;
 const char *program_version;
-int line = 0;
 
+#ifndef IPTABLES_MULTI
+int line = 0;
 void
 exit_error(enum exittype status, char *msg, ...)
 {
@@ -41,6 +42,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 +68,7 @@
 	exit(1);
 }
 
-int
+static int
 parse_counters(char *string, struct ipt_counters *ctr)
 {
 	if (string != NULL)
@@ -605,7 +607,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[])
