]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables-save: remove binary dumping dead code
authorJan Engelhardt <jengelh@medozas.de>
Sat, 27 Aug 2011 11:06:37 +0000 (13:06 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 11 Sep 2011 15:31:34 +0000 (17:31 +0200)
Was never implemented, kill it.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
iptables/ip6tables-save.c
iptables/iptables-save.c

index ad0e70f07041734bfb0adece792f02f607c9785f..38b0c2f2a4d22962ac4762b08987cd8f29108337 100644 (file)
 #include <dlfcn.h>
 #endif
 
-static int show_binary = 0, show_counters = 0;
+static int show_counters = 0;
 
 static const struct option options[] = {
-       {.name = "binary",   .has_arg = false, .val = 'b'},
        {.name = "counters", .has_arg = false, .val = 'c'},
        {.name = "dump",     .has_arg = false, .val = 'd'},
        {.name = "table",    .has_arg = true,  .val = 't'},
@@ -76,52 +75,45 @@ static int do_output(const char *tablename)
                xtables_error(OTHER_PROBLEM, "Cannot initialize: %s\n",
                           ip6tc_strerror(errno));
 
-       if (!show_binary) {
-               time_t now = time(NULL);
-
-               printf("# Generated by ip6tables-save v%s on %s",
-                      IPTABLES_VERSION, ctime(&now));
-               printf("*%s\n", tablename);
-
-               /* Dump out chain names first,
-                * thereby preventing dependency conflicts */
-               for (chain = ip6tc_first_chain(h);
-                    chain;
-                    chain = ip6tc_next_chain(h)) {
-
-                       printf(":%s ", chain);
-                       if (ip6tc_builtin(chain, h)) {
-                               struct ip6t_counters count;
-                               printf("%s ",
-                                      ip6tc_get_policy(chain, &count, h));
-                               printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt);
-                       } else {
-                               printf("- [0:0]\n");
-                       }
+       time_t now = time(NULL);
+
+       printf("# Generated by ip6tables-save v%s on %s",
+              IPTABLES_VERSION, ctime(&now));
+       printf("*%s\n", tablename);
+
+       /* Dump out chain names first,
+        * thereby preventing dependency conflicts */
+       for (chain = ip6tc_first_chain(h);
+            chain;
+            chain = ip6tc_next_chain(h)) {
+
+               printf(":%s ", chain);
+               if (ip6tc_builtin(chain, h)) {
+                       struct ip6t_counters count;
+                       printf("%s ",
+                              ip6tc_get_policy(chain, &count, h));
+                       printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt);
+               } else {
+                       printf("- [0:0]\n");
                }
+       }
 
+       for (chain = ip6tc_first_chain(h);
+            chain;
+            chain = ip6tc_next_chain(h)) {
+               const struct ip6t_entry *e;
 
-               for (chain = ip6tc_first_chain(h);
-                    chain;
-                    chain = ip6tc_next_chain(h)) {
-                       const struct ip6t_entry *e;
-
-                       /* Dump out rules */
-                       e = ip6tc_first_rule(chain, h);
-                       while(e) {
-                               print_rule6(e, h, chain, show_counters);
-                               e = ip6tc_next_rule(e, h);
-                       }
+               /* Dump out rules */
+               e = ip6tc_first_rule(chain, h);
+               while(e) {
+                       print_rule6(e, h, chain, show_counters);
+                       e = ip6tc_next_rule(e, h);
                }
-
-               now = time(NULL);
-               printf("COMMIT\n");
-               printf("# Completed on %s", ctime(&now));
-       } else {
-               /* Binary, huh?  OK. */
-               xtables_error(OTHER_PROBLEM, "Binary NYI\n");
        }
 
+       now = time(NULL);
+       printf("COMMIT\n");
+       printf("# Completed on %s", ctime(&now));
        ip6tc_free(h);
 
        return 1;
@@ -151,10 +143,6 @@ int ip6tables_save_main(int argc, char *argv[])
 
        while ((c = getopt_long(argc, argv, "bcdt:", options, NULL)) != -1) {
                switch (c) {
-               case 'b':
-                       show_binary = 1;
-                       break;
-
                case 'c':
                        show_counters = 1;
                        break;
index 73fba12afc3ab8269a1f8e84725ee336bfab725f..a25a186eff5321d3cfeca86c8f51e1b8913d94be 100644 (file)
 #include <dlfcn.h>
 #endif
 
-static int show_binary = 0, show_counters = 0;
+static int show_counters = 0;
 
 static const struct option options[] = {
-       {.name = "binary",   .has_arg = false, .val = 'b'},
        {.name = "counters", .has_arg = false, .val = 'c'},
        {.name = "dump",     .has_arg = false, .val = 'd'},
        {.name = "table",    .has_arg = true,  .val = 't'},
@@ -74,52 +73,45 @@ static int do_output(const char *tablename)
                xtables_error(OTHER_PROBLEM, "Cannot initialize: %s\n",
                           iptc_strerror(errno));
 
-       if (!show_binary) {
-               time_t now = time(NULL);
-
-               printf("# Generated by iptables-save v%s on %s",
-                      IPTABLES_VERSION, ctime(&now));
-               printf("*%s\n", tablename);
-
-               /* Dump out chain names first,
-                * thereby preventing dependency conflicts */
-               for (chain = iptc_first_chain(h);
-                    chain;
-                    chain = iptc_next_chain(h)) {
-
-                       printf(":%s ", chain);
-                       if (iptc_builtin(chain, h)) {
-                               struct ipt_counters count;
-                               printf("%s ",
-                                      iptc_get_policy(chain, &count, h));
-                               printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt);
-                       } else {
-                               printf("- [0:0]\n");
-                       }
+       time_t now = time(NULL);
+
+       printf("# Generated by iptables-save v%s on %s",
+              IPTABLES_VERSION, ctime(&now));
+       printf("*%s\n", tablename);
+
+       /* Dump out chain names first,
+        * thereby preventing dependency conflicts */
+       for (chain = iptc_first_chain(h);
+            chain;
+            chain = iptc_next_chain(h)) {
+
+               printf(":%s ", chain);
+               if (iptc_builtin(chain, h)) {
+                       struct ipt_counters count;
+                       printf("%s ",
+                              iptc_get_policy(chain, &count, h));
+                       printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt);
+               } else {
+                       printf("- [0:0]\n");
                }
+       }
 
+       for (chain = iptc_first_chain(h);
+            chain;
+            chain = iptc_next_chain(h)) {
+               const struct ipt_entry *e;
 
-               for (chain = iptc_first_chain(h);
-                    chain;
-                    chain = iptc_next_chain(h)) {
-                       const struct ipt_entry *e;
-
-                       /* Dump out rules */
-                       e = iptc_first_rule(chain, h);
-                       while(e) {
-                               print_rule4(e, h, chain, show_counters);
-                               e = iptc_next_rule(e, h);
-                       }
+               /* Dump out rules */
+               e = iptc_first_rule(chain, h);
+               while(e) {
+                       print_rule4(e, h, chain, show_counters);
+                       e = iptc_next_rule(e, h);
                }
-
-               now = time(NULL);
-               printf("COMMIT\n");
-               printf("# Completed on %s", ctime(&now));
-       } else {
-               /* Binary, huh?  OK. */
-               xtables_error(OTHER_PROBLEM, "Binary NYI\n");
        }
 
+       now = time(NULL);
+       printf("COMMIT\n");
+       printf("# Completed on %s", ctime(&now));
        iptc_free(h);
 
        return 1;
@@ -150,10 +142,6 @@ iptables_save_main(int argc, char *argv[])
 
        while ((c = getopt_long(argc, argv, "bcdt:", options, NULL)) != -1) {
                switch (c) {
-               case 'b':
-                       show_binary = 1;
-                       break;
-
                case 'c':
                        show_counters = 1;
                        break;