else if (m->extra_opts != NULL)
opts = xtables_merge_options(xt_params->orig_opts, opts,
m->extra_opts, &m->option_offset);
+ else
+ return;
+
if (opts == NULL)
xtables_error(OTHER_PROBLEM, "can't alloc memory!");
xt_params->opts = opts;
opts = xtables_options_xfrm(xt_params->orig_opts, opts,
cs->target->x6_options,
&cs->target->option_offset);
- else
+ else if (cs->target->extra_opts != NULL)
opts = xtables_merge_options(xt_params->orig_opts, opts,
cs->target->extra_opts,
&cs->target->option_offset);
+ else
+ return;
+
if (opts == NULL)
xtables_error(OTHER_PROBLEM, "can't alloc memory!");
xt_params->opts = opts;
demand-load a protocol. */
opterr = 0;
- xt_params->opts = xt_params->orig_opts;
while ((cs->c = getopt_long(argc, argv,
optstring_lookup(afinfo->family),
- xt_params->opts, NULL)) != -1) {
+ xt_params->opts ?: xt_params->orig_opts,
+ NULL)) != -1) {
switch (cs->c) {
/*
* Command selection
xs_init_match(m);
if (m->x6_options != NULL)
- opts = xtables_options_xfrm(opts, NULL,
+ opts = xtables_options_xfrm(xt_params->orig_opts, opts,
m->x6_options, &m->option_offset);
else if (m->extra_opts != NULL)
- opts = xtables_merge_options(opts, NULL,
+ opts = xtables_merge_options(xt_params->orig_opts, opts,
m->extra_opts, &m->option_offset);
+ else
+ return;
+
if (opts == NULL)
xtables_error(OTHER_PROBLEM, "Can't alloc memory");
xt_params->opts = opts;
xs_init_target(watcher);
if (watcher->x6_options != NULL)
- opts = xtables_options_xfrm(opts, NULL, watcher->x6_options,
+ opts = xtables_options_xfrm(xt_params->orig_opts, opts,
+ watcher->x6_options,
&watcher->option_offset);
else if (watcher->extra_opts != NULL)
- opts = xtables_merge_options(opts, NULL, watcher->extra_opts,
+ opts = xtables_merge_options(xt_params->orig_opts, opts,
+ watcher->extra_opts,
&watcher->option_offset);
+ else
+ return;
+
if (opts == NULL)
xtables_error(OTHER_PROBLEM, "Can't alloc memory");
xt_params->opts = opts;
static void ebt_load_match_extensions(void)
{
- xt_params->opts = ebt_original_options;
ebt_load_match("802_3");
ebt_load_match("arp");
ebt_load_match("ip");
ebt_load_watcher("log");
ebt_load_watcher("nflog");
-
- /* assign them back so do_parse() may
- * reset opts to orig_opts upon each call */
- xt_params->orig_opts = xt_params->opts;
}
void ebt_add_match(struct xtables_match *m,
void nft_fini_eb(struct nft_handle *h)
{
- struct option *opts = xt_params->opts;
struct xtables_match *match;
struct xtables_target *target;
free(target->t);
}
- if (opts != ebt_original_options)
- free(opts);
+ free(xt_params->opts);
nft_fini(h);
xtables_fini();