me->m = NULL;
me->mflags = 0;
-
- opts = merge_options(opts, me->extra_opts, &me->option_offset);
}
void
iptables_targets = me;
me->t = NULL;
me->tflags = 0;
-
- opts = merge_options(opts, me->extra_opts, &me->option_offset);
}
static void
unsigned char *mask, *mptr;
size = sizeof(struct ipt_entry);
- for (m = iptables_matches; m && m->used; m = m->next)
+ for (m = iptables_matches; m; m = m->next) {
+ if (!m->used)
+ continue;
+
size += IPT_ALIGN(sizeof(struct ipt_entry_match)) + m->size;
+ }
mask = fw_calloc(1, size
+ IPT_ALIGN(sizeof(struct ipt_entry_target))
memset(mask, 0xFF, sizeof(struct ipt_entry));
mptr = mask + sizeof(struct ipt_entry);
- for (m = iptables_matches; m && m->used; m = m->next) {
+ for (m = iptables_matches; m; m = m->next) {
+ if (!m->used)
+ continue;
+
memset(mptr, 0xFF,
IPT_ALIGN(sizeof(struct ipt_entry_match))
+ m->userspacesize);
struct ipt_entry *e;
size = sizeof(struct ipt_entry);
- for (m = matches; m && m->used; m = m->next)
+ for (m = matches; m; m = m->next) {
+ if (!m->used)
+ continue;
+
size += m->m->u.match_size;
+ }
e = fw_malloc(size + target->u.target_size);
*e = *fw;
e->next_offset = size + target->u.target_size;
size = 0;
- for (m = matches; m && m->used; m = m->next) {
+ for (m = matches; m; m = m->next) {
+ if (!m->used)
+ continue;
+
memcpy(e->elems + size, m->m, m->m->u.match_size);
size += m->m->u.match_size;
}
memset(&fw, 0, sizeof(fw));
+ opts = original_opts;
+ global_option_offset = 0;
+
/* re-set optind to 0 in case do_command gets called
* a second time */
optind = 0;
target->t->u.target_size = size;
strcpy(target->t->u.user.name, jumpto);
target->init(target->t, &fw.nfcache);
+ opts = merge_options(opts, target->extra_opts, &target->option_offset);
}
break;
m->m->u.match_size = size;
strcpy(m->m->u.user.name, m->name);
m->init(m->m, &fw.nfcache);
+ opts = merge_options(opts, m->extra_opts, &m->option_offset);
}
break;
argv, invert,
&target->tflags,
&fw, &target->t))) {
- for (m = iptables_matches; m && m->used; m = m->next) {
+ for (m = iptables_matches; m; m = m->next) {
+ if (!m->used)
+ continue;
+
if (m->parse(c - m->option_offset,
argv, invert,
&m->mflags,
invert = FALSE;
}
- for (m = iptables_matches; m && m->used; m = m->next)
+ for (m = iptables_matches; m; m = m->next) {
+ if (!m->used)
+ continue;
+
m->final_check(m->mflags);
+ }
+
if (target)
target->final_check(target->tflags);