From 9f075031a1973fc967cd90de96dc2e87696a2181 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 24 Sep 2018 19:25:24 +0200 Subject: Combine parse_target() and command_jump() implementations Merge these two functions from xtables, iptables, ip6tables and arptables. Both functions were basically identical in the first three, only the last one required a bit more attention. To eliminate access to 'invflags' in variant-specific location, move the call to set_option() into callers. This is actually consistent with parsing of other options in them. As with command_match(), use xt_params instead of the different *_globals objects to refer to 'opts' and 'orig_opts'. It was necessary to rename parse_target() as it otherwise clashes with a static function of same name in libxt_SET. In arptables, the maximum allowed target name is a bit larger, so introduce xtables_globals.target_maxnamelen defining the value. It is used in the shared xt_parse_target() implementation. Implementation of command_jump() in arptables diverted from the others for no obvious reason. The call to parse_target() was done outside of it and a pointer to cs->arp was passed but not used inside. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- include/xtables.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/xtables.h b/include/xtables.h index bf169b08..fd9e6c33 100644 --- a/include/xtables.h +++ b/include/xtables.h @@ -424,6 +424,7 @@ struct xtables_globals struct option *opts; void (*exit_err)(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3))); int (*compat_rev)(const char *name, uint8_t rev, int opt); + size_t target_maxnamelen; }; #define XT_GETOPT_TABLEEND {.name = NULL, .has_arg = false} -- cgit v1.2.3