2013-03-05 20:51:57 +00:00
|
|
|
Index: iptables-1.4.18/iptables/ip6tables-restore.c
|
|
|
|
===================================================================
|
|
|
|
--- iptables-1.4.18.orig/iptables/ip6tables-restore.c 2013-03-05 16:37:31.000000000 +0100
|
|
|
|
+++ iptables-1.4.18/iptables/ip6tables-restore.c 2013-03-05 16:42:57.475249794 +0100
|
|
|
|
@@ -14,6 +14,8 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
+#include <stdarg.h>
|
|
|
|
+#include <setjmp.h>
|
|
|
|
#include "ip6tables.h"
|
|
|
|
#include "xtables.h"
|
|
|
|
#include "libiptc/libip6tc.h"
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -25,6 +27,7 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
#define DEBUGP(x, args...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+static jmp_buf jmp;
|
|
|
|
static int binary = 0, counters = 0, verbose = 0, noflush = 0;
|
|
|
|
|
|
|
|
/* Keeping track of external matches and targets. */
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -35,6 +38,7 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
{.name = "test", .has_arg = false, .val = 't'},
|
|
|
|
{.name = "help", .has_arg = false, .val = 'h'},
|
|
|
|
{.name = "noflush", .has_arg = false, .val = 'n'},
|
|
|
|
+ {.name = "lenient", .has_arg = false, .val = 'l'},
|
|
|
|
{.name = "modprobe", .has_arg = true, .val = 'M'},
|
2013-03-05 20:51:57 +00:00
|
|
|
{.name = "table", .has_arg = true, .val = 'T'},
|
2013-02-11 21:58:42 +00:00
|
|
|
{NULL},
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -51,6 +55,7 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
" [ --test ]\n"
|
|
|
|
" [ --help ]\n"
|
|
|
|
" [ --noflush ]\n"
|
|
|
|
+ " [ --lenient ]\n"
|
|
|
|
" [ --modprobe=<command>]\n", name);
|
|
|
|
|
|
|
|
exit(1);
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -114,6 +119,17 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
free(newargv[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void catch_exit_error(enum xtables_exittype status, const char *msg, ...)
|
|
|
|
+{
|
|
|
|
+ va_list args;
|
|
|
|
+ fprintf(stderr, "line %d: ", line);
|
|
|
|
+ va_start(args, msg);
|
|
|
|
+ vfprintf(stderr, msg, args);
|
|
|
|
+ va_end(args);
|
|
|
|
+ fprintf(stderr, "\n");
|
|
|
|
+ longjmp(jmp, status);
|
|
|
|
+}
|
|
|
|
+
|
2013-03-05 20:51:57 +00:00
|
|
|
static void add_param_to_argv(char *parsestart)
|
|
|
|
{
|
|
|
|
int quote_open = 0, escaped = 0, param_len = 0;
|
|
|
|
@@ -204,7 +220,7 @@
|
|
|
|
init_extensions6();
|
2013-02-11 21:58:42 +00:00
|
|
|
#endif
|
|
|
|
|
2013-03-05 20:51:57 +00:00
|
|
|
- while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) {
|
|
|
|
+ while ((c = getopt_long(argc, argv, "bcvthnlM:T:", options, NULL)) != -1) {
|
2013-02-11 21:58:42 +00:00
|
|
|
switch (c) {
|
|
|
|
case 'b':
|
|
|
|
binary = 1;
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -225,6 +241,9 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
case 'n':
|
|
|
|
noflush = 1;
|
|
|
|
break;
|
|
|
|
+ case 'l':
|
|
|
|
+ ip6tables_globals.exit_err = catch_exit_error;
|
|
|
|
+ break;
|
|
|
|
case 'M':
|
|
|
|
xtables_modprobe_program = optarg;
|
|
|
|
break;
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -437,8 +456,11 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
for (a = 0; a < newargc; a++)
|
|
|
|
DEBUGP("argv[%u]: %s\n", a, newargv[a]);
|
|
|
|
|
|
|
|
- ret = do_command6(newargc, newargv,
|
|
|
|
- &newargv[2], &handle);
|
|
|
|
+ if (!setjmp(jmp))
|
|
|
|
+ ret = do_command6(newargc, newargv,
|
|
|
|
+ &newargv[2], &handle);
|
|
|
|
+ else
|
|
|
|
+ ret = 1;
|
|
|
|
|
|
|
|
free_argv();
|
|
|
|
fflush(stdout);
|
2013-03-05 20:51:57 +00:00
|
|
|
Index: iptables-1.4.18/iptables/iptables-restore.c
|
|
|
|
===================================================================
|
|
|
|
--- iptables-1.4.18.orig/iptables/iptables-restore.c 2013-03-05 16:37:31.000000000 +0100
|
|
|
|
+++ iptables-1.4.18/iptables/iptables-restore.c 2013-03-05 16:44:56.303247355 +0100
|
|
|
|
@@ -11,6 +11,8 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
+#include <stdarg.h>
|
|
|
|
+#include <setjmp.h>
|
|
|
|
#include "iptables.h"
|
|
|
|
#include "xtables.h"
|
|
|
|
#include "libiptc/libiptc.h"
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -22,6 +24,7 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
#define DEBUGP(x, args...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+static jmp_buf jmp;
|
|
|
|
static int binary = 0, counters = 0, verbose = 0, noflush = 0;
|
|
|
|
|
|
|
|
/* Keeping track of external matches and targets. */
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -32,6 +35,7 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
{.name = "test", .has_arg = false, .val = 't'},
|
|
|
|
{.name = "help", .has_arg = false, .val = 'h'},
|
|
|
|
{.name = "noflush", .has_arg = false, .val = 'n'},
|
|
|
|
+ {.name = "lenient", .has_arg = false, .val = 'l'},
|
|
|
|
{.name = "modprobe", .has_arg = true, .val = 'M'},
|
|
|
|
{.name = "table", .has_arg = true, .val = 'T'},
|
|
|
|
{NULL},
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -50,6 +54,7 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
" [ --test ]\n"
|
|
|
|
" [ --help ]\n"
|
|
|
|
" [ --noflush ]\n"
|
|
|
|
+ " [ --lenient ]\n"
|
|
|
|
" [ --table=<TABLE> ]\n"
|
|
|
|
" [ --modprobe=<command>]\n", name);
|
|
|
|
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -113,6 +118,17 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
free(newargv[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void catch_exit_error(enum xtables_exittype status, const char *msg, ...)
|
|
|
|
+{
|
|
|
|
+ va_list args;
|
|
|
|
+ fprintf(stderr, "line %d: ", line);
|
|
|
|
+ va_start(args, msg);
|
|
|
|
+ vfprintf(stderr, msg, args);
|
|
|
|
+ va_end(args);
|
|
|
|
+ fprintf(stderr, "\n");
|
|
|
|
+ longjmp(jmp, status);
|
|
|
|
+}
|
|
|
|
+
|
2013-03-05 20:51:57 +00:00
|
|
|
static void add_param_to_argv(char *parsestart)
|
|
|
|
{
|
|
|
|
int quote_open = 0, escaped = 0, param_len = 0;
|
|
|
|
@@ -204,7 +220,7 @@
|
|
|
|
init_extensions4();
|
2013-02-11 21:58:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
- while ((c = getopt_long(argc, argv, "bcvthnM:T:", options, NULL)) != -1) {
|
|
|
|
+ while ((c = getopt_long(argc, argv, "bcvthnlM:T:", options, NULL)) != -1) {
|
|
|
|
switch (c) {
|
|
|
|
case 'b':
|
|
|
|
binary = 1;
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -225,6 +241,9 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
case 'n':
|
|
|
|
noflush = 1;
|
|
|
|
break;
|
|
|
|
+ case 'l':
|
|
|
|
+ iptables_globals.exit_err = catch_exit_error;
|
|
|
|
+ break;
|
|
|
|
case 'M':
|
|
|
|
xtables_modprobe_program = optarg;
|
|
|
|
break;
|
2013-03-05 20:51:57 +00:00
|
|
|
@@ -437,8 +456,11 @@
|
2013-02-11 21:58:42 +00:00
|
|
|
for (a = 0; a < newargc; a++)
|
|
|
|
DEBUGP("argv[%u]: %s\n", a, newargv[a]);
|
|
|
|
|
2013-03-05 20:51:57 +00:00
|
|
|
- ret = do_command4(newargc, newargv,
|
2013-02-11 21:58:42 +00:00
|
|
|
- &newargv[2], &handle);
|
|
|
|
+ if (!setjmp(jmp))
|
2013-03-05 20:51:57 +00:00
|
|
|
+ ret = do_command4(newargc, newargv,
|
2013-02-11 21:58:42 +00:00
|
|
|
+ &newargv[2], &handle);
|
|
|
|
+ else
|
|
|
|
+ ret = 1;
|
|
|
|
|
|
|
|
free_argv();
|
|
|
|
fflush(stdout);
|