1 --- a/iptables/ip6tables-restore.c
2 +++ b/iptables/ip6tables-restore.c
11 #include "libiptc/libip6tc.h"
13 #define DEBUGP(x, args...)
17 static int binary = 0, counters = 0, verbose = 0, noflush = 0;
19 /* Keeping track of external matches and targets. */
20 @@ -35,6 +38,7 @@ static const struct option options[] = {
21 {.name = "test", .has_arg = false, .val = 't'},
22 {.name = "help", .has_arg = false, .val = 'h'},
23 {.name = "noflush", .has_arg = false, .val = 'n'},
24 + {.name = "lenient", .has_arg = false, .val = 'l'},
25 {.name = "modprobe", .has_arg = true, .val = 'M'},
26 {.name = "table", .has_arg = true, .val = 'T'},
28 @@ -51,6 +55,7 @@ static void print_usage(const char *name
33 " [ --modprobe=<command>]\n", name);
36 @@ -114,6 +119,17 @@ static void free_argv(void) {
40 +static void catch_exit_error(enum xtables_exittype status, const char *msg, ...)
43 + fprintf(stderr, "line %d: ", line);
44 + va_start(args, msg);
45 + vfprintf(stderr, msg, args);
47 + fprintf(stderr, "\n");
48 + longjmp(jmp, status);
51 static void add_param_to_argv(char *parsestart)
53 int quote_open = 0, escaped = 0, param_len = 0;
54 @@ -204,7 +220,7 @@ int ip6tables_restore_main(int argc, cha
58 - while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) {
59 + while ((c = getopt_long(argc, argv, "bcvthnlM:T:", options, NULL)) != -1) {
63 @@ -225,6 +241,9 @@ int ip6tables_restore_main(int argc, cha
68 + ip6tables_globals.exit_err = catch_exit_error;
71 xtables_modprobe_program = optarg;
73 @@ -437,8 +456,11 @@ int ip6tables_restore_main(int argc, cha
74 for (a = 0; a < newargc; a++)
75 DEBUGP("argv[%u]: %s\n", a, newargv[a]);
77 - ret = do_command6(newargc, newargv,
78 - &newargv[2], &handle, true);
80 + ret = do_command6(newargc, newargv,
81 + &newargv[2], &handle, true);
87 --- a/iptables/iptables-restore.c
88 +++ b/iptables/iptables-restore.c
97 #include "libiptc/libiptc.h"
99 #define DEBUGP(x, args...)
103 static int binary = 0, counters = 0, verbose = 0, noflush = 0;
105 /* Keeping track of external matches and targets. */
106 @@ -32,6 +35,7 @@ static const struct option options[] = {
107 {.name = "test", .has_arg = false, .val = 't'},
108 {.name = "help", .has_arg = false, .val = 'h'},
109 {.name = "noflush", .has_arg = false, .val = 'n'},
110 + {.name = "lenient", .has_arg = false, .val = 'l'},
111 {.name = "modprobe", .has_arg = true, .val = 'M'},
112 {.name = "table", .has_arg = true, .val = 'T'},
114 @@ -50,6 +54,7 @@ static void print_usage(const char *name
119 " [ --table=<TABLE> ]\n"
120 " [ --modprobe=<command>]\n", name);
122 @@ -113,6 +118,17 @@ static void free_argv(void) {
126 +static void catch_exit_error(enum xtables_exittype status, const char *msg, ...)
129 + fprintf(stderr, "line %d: ", line);
130 + va_start(args, msg);
131 + vfprintf(stderr, msg, args);
133 + fprintf(stderr, "\n");
134 + longjmp(jmp, status);
137 static void add_param_to_argv(char *parsestart)
139 int quote_open = 0, escaped = 0, param_len = 0;
140 @@ -204,7 +220,7 @@ iptables_restore_main(int argc, char *ar
144 - while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) {
145 + while ((c = getopt_long(argc, argv, "bcvthnlM:T:", options, NULL)) != -1) {
149 @@ -225,6 +241,9 @@ iptables_restore_main(int argc, char *ar
154 + iptables_globals.exit_err = catch_exit_error;
157 xtables_modprobe_program = optarg;
159 @@ -437,8 +456,11 @@ iptables_restore_main(int argc, char *ar
160 for (a = 0; a < newargc; a++)
161 DEBUGP("argv[%u]: %s\n", a, newargv[a]);
163 - ret = do_command4(newargc, newargv,
164 - &newargv[2], &handle, true);
166 + ret = do_command4(newargc, newargv,
167 + &newargv[2], &handle, true);