Update of /cvsroot/ipac-ng/ipac-ng/agents/iptables
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15485/ipac-ng/agents/iptables
Modified Files:
iptables.c
Log Message:
Fixed compatibility with iptables up to 1.4.21
Index: iptables.c
===================================================================
RCS file: /cvsroot/ipac-ng/ipac-ng/agents/iptables/iptables.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- iptables.c 25 Sep 2011 23:12:24 -0000 1.10
+++ iptables.c 4 Mar 2015 21:58:18 -0000 1.11
@@ -73,6 +73,11 @@
#define IPT_ALIGN XT_ALIGN
#endif
+enum {
+ XT_OPTION_OFFSET_SCALE = 256,
+};
+
+
static struct option original_opts[] = {
{.name = "append", .has_arg = 1, .val = 'A'},
{.name = "delete", .has_arg = 1, .val = 'D'},
@@ -990,8 +995,12 @@
if (m->init != NULL)
m->init(m->m);
#if XTABLES_VERSION_CODE > 5
- opts = xtables_merge_options(iptables_globals.orig_opts,
- opts, m->extra_opts, &m->option_offset);
+ if (m->x6_options != NULL)
+ opts = xtables_options_xfrm(iptables_globals.orig_opts, opts,
+ m->x6_options, &m->option_offset);
+ else if (m->extra_opts != NULL)
+ opts = xtables_merge_options(iptables_globals.orig_opts, opts,
+ m->extra_opts, &m->option_offset);
#else
opts = xtables_merge_options(opts, m->extra_opts,
&m->option_offset);
@@ -1010,27 +1019,29 @@
printf("Bad argument `%s'\n", optarg);
exit(1);
- default:
- for (matchp = matches; matchp; matchp = matchp->next) {
- if (matchp->completed)
- continue;
- if (matchp->match->parse(c - matchp->match->option_offset,
- d->extension, invert,
- &matchp->match->mflags,
- &fw,
- &matchp->match->m))
+ default:
+ for (matchp = matches; matchp; matchp = matchp->next) {
+ m = matchp->match;
+
+ if (matchp->completed ||
+ (m->x6_parse == NULL && m->parse == NULL))
+ continue;
+ if (c < matchp->match->option_offset ||
+ c >= matchp->match->option_offset + XT_OPTION_OFFSET_SCALE)
+ continue;
+ xtables_option_mpcall(c, d->extension, invert, m, &fw);
break;
- }
- break;
+ }
+ break;
}
}
}
for (matchp = matches; matchp; matchp = matchp->next)
- if (matchp->match->final_check != NULL)
- matchp->match->final_check(matchp->match->mflags);
-
- if (target != NULL && target->final_check != NULL)
- target->final_check(target->tflags);
+ xtables_option_mfcall(matchp->match);
+
+ if (target != NULL)
+ xtables_option_tfcall(target);
+
*e = generate_entry(&fw, matches, target->t);
if (!handle) if (!(handle = iptc_init("filter")))
|