1 --- a/ip6tables-restore.c
2 +++ b/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 @@ -37,6 +40,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'},
28 @@ -52,6 +56,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);
52 int ip6tables_restore_main(int argc, char *argv[])
54 @@ -141,7 +157,7 @@ int main(int argc, char *argv[])
58 - while ((c = getopt_long(argc, argv, "bcvthnM:", options, NULL)) != -1) {
59 + while ((c = getopt_long(argc, argv, "bcvthnlM:", options, NULL)) != -1) {
63 @@ -162,6 +178,9 @@ int main(int argc, char *argv[])
68 + ip6tables_globals.exit_err = catch_exit_error;
71 xtables_modprobe_program = optarg;
73 @@ -440,8 +459,11 @@ int main(int argc, char *argv[])
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);
80 + ret = do_command6(newargc, newargv,
81 + &newargv[2], &handle);
87 --- a/iptables-restore.c
88 +++ b/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 @@ -34,6 +37,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 @@ -52,6 +56,7 @@ static void print_usage(const char *name
119 " [ --table=<TABLE> ]\n"
120 " [ --modprobe=<command>]\n", name);
122 @@ -114,6 +119,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 #ifdef IPTABLES_MULTI
139 iptables_restore_main(int argc, char *argv[])
140 @@ -144,7 +160,7 @@ main(int argc, char *argv[])
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 @@ -165,6 +181,9 @@ main(int argc, char *argv[])
154 + iptables_globals.exit_err = catch_exit_error;
157 xtables_modprobe_program = optarg;
159 @@ -445,8 +464,11 @@ main(int argc, char *argv[])
160 for (a = 0; a < newargc; a++)
161 DEBUGP("argv[%u]: %s\n", a, newargv[a]);
163 - ret = do_command(newargc, newargv,
164 - &newargv[2], &handle);
166 + ret = do_command(newargc, newargv,
167 + &newargv[2], &handle);