#include <libiptc/libip6tc.h>
#include <xtables.h>
+#include <setjmp.h>
+
#include "options.h"
/* xtables interface */
{ NULL }
};
+
+static jmp_buf fw3_ipt_error_jmp;
+
+static __attribute__((noreturn))
+void fw3_ipt_error_handler(enum xtables_exittype status,
+ const char *fmt, ...)
+{
+ va_list args;
+
+ fprintf(stderr, " ! Exception: ");
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+
+ longjmp(fw3_ipt_error_jmp, status);
+}
+
static struct xtables_globals xtg = {
.option_offset = 0,
.program_version = "4",
.orig_opts = base_opts,
+ .exit_err = fw3_ipt_error_handler,
#if XTABLES_VERSION_CODE > 10
.compat_rev = xtables_compatible_revision,
#endif
.option_offset = 0,
.program_version = "6",
.orig_opts = base_opts,
+ .exit_err = fw3_ipt_error_handler,
#if XTABLES_VERSION_CODE > 10
.compat_rev = xtables_compatible_revision,
#endif
struct xtables_target *et;
struct xtables_globals *g;
+ enum xtables_exittype status;
+
int i, optc;
bool inv = false;
char buf[32];
optind = 0;
opterr = 0;
+ status = setjmp(fw3_ipt_error_jmp);
+
+ if (status > 0)
+ {
+ info(" ! Skipping due to previous exception (code %u)", status);
+ goto free;
+ }
+
set_rule_tag(r);
while ((optc = getopt_long(r->argc, r->argv, "-:m:j:", g->opts,