]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
let DO_MULTI=1 work for ip6tables* binaries part 2
authorHann-Huei Chiou <koala@ascenvision.com>
Wed, 31 Oct 2007 11:48:04 +0000 (11:48 +0000)
committerPatrick McHardy <kaber@trash.net>
Wed, 31 Oct 2007 11:48:04 +0000 (11:48 +0000)
Sorry forgot to mention that the "ip6tables-multi.c" (in the patch) which is
not in the repository has to be manually added.

Hann-huei Chiou <koala@ascenvision.com>

ip6tables-multi.c [new file with mode: 0644]

diff --git a/ip6tables-multi.c b/ip6tables-multi.c
new file mode 100644 (file)
index 0000000..0bcface
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libgen.h>
+
+int ip6tables_main(int argc, char **argv);
+int ip6tables_save_main(int argc, char **argv);
+int ip6tables_restore_main(int argc, char **argv);
+
+int main(int argc, char **argv) {
+  char *progname;
+
+  if (argc == 0) {
+    fprintf(stderr, "no argv[0]?");
+    exit(1);
+  } else {
+    progname = basename(argv[0]);
+
+    if (!strcmp(progname, "ip6tables"))
+      return ip6tables_main(argc, argv);
+    
+    if (!strcmp(progname, "ip6tables-save"))
+      return ip6tables_save_main(argc, argv);
+    
+    if (!strcmp(progname, "ip6tables-restore"))
+      return ip6tables_restore_main(argc, argv);
+    
+    fprintf(stderr, "ip6tables multi-purpose version: unknown applet name %s\n", progname);
+    exit(1);
+  }
+}