summaryrefslogtreecommitdiffstats
path: root/iptables/xtables.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-09-24 19:25:23 +0200
committerFlorian Westphal <fw@strlen.de>2018-09-25 16:26:26 +0200
commit7373297262eef6754570a5cb05c18332c801370f (patch)
treebfa36e8424603c82b4fff1919ea5296c7937f49f /iptables/xtables.c
parenta76ba54e2833761c46fd57cbe2486cbc38686717 (diff)
Combine command_match() implementations
This merges the basically identical implementations of command_match() from xtables, iptables and ip6tables into one. The only required adjustment was to make use of xt_params instead of the different *_globals objects. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xtables.c')
-rw-r--r--iptables/xtables.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/iptables/xtables.c b/iptables/xtables.c
index d6afada9..423be37f 100644
--- a/iptables/xtables.c
+++ b/iptables/xtables.c
@@ -644,42 +644,6 @@ static void command_jump(struct iptables_command_state *cs)
xtables_error(OTHER_PROBLEM, "can't alloc memory!");
}
-static void command_match(struct iptables_command_state *cs)
-{
- struct xtables_match *m;
- size_t size;
-
- if (cs->invert)
- xtables_error(PARAMETER_PROBLEM,
- "unexpected ! flag before --match");
-
- m = xtables_find_match(optarg, XTF_LOAD_MUST_SUCCEED, &cs->matches);
- size = XT_ALIGN(sizeof(struct xt_entry_match)) + m->size;
- m->m = xtables_calloc(1, size);
- m->m->u.match_size = size;
- if (m->real_name == NULL) {
- strcpy(m->m->u.user.name, m->name);
- } else {
- strcpy(m->m->u.user.name, m->real_name);
- if (!(m->ext_flags & XTABLES_EXT_ALIAS))
- fprintf(stderr, "Notice: the %s match is converted into %s match "
- "in rule listing and saving.\n", m->name, m->real_name);
- }
- m->m->u.user.revision = m->revision;
- xs_init_match(m);
- if (m == m->next)
- return;
- /* Merge options for non-cloned matches */
- if (m->x6_options != NULL)
- opts = xtables_options_xfrm(xtables_globals.orig_opts, opts,
- m->x6_options, &m->option_offset);
- else if (m->extra_opts != NULL)
- opts = xtables_merge_options(xtables_globals.orig_opts, opts,
- m->extra_opts, &m->option_offset);
- if (opts == NULL)
- xtables_error(OTHER_PROBLEM, "can't alloc memory!");
-}
-
void do_parse(struct nft_handle *h, int argc, char *argv[],
struct nft_xt_cmd_parse *p, struct iptables_command_state *cs,
struct xtables_args *args)