From 29b1d97764d1849651388d870565b3fa815a0bd8 Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Thu, 1 Mar 2018 13:03:11 +0200 Subject: xtables: Introduce and use common function to parse val[/mask] arguments There are a couple of places in both core and extensions where arguments in the form of val[/mask] is parsed (see XTTYPE_MARKMASK32). In some cases symbolic name might be used which is mapped in code to numeric value. Introduce common function to handle both cases where value given is either val[/mask] or symbolic name. Signed-off-by: Serhey Popovych Signed-off-by: Florian Westphal --- include/xtables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/xtables.h b/include/xtables.h index e9bc3b7d..47129483 100644 --- a/include/xtables.h +++ b/include/xtables.h @@ -537,6 +537,17 @@ extern void xtables_save_string(const char *value); extern void xtables_print_num(uint64_t number, unsigned int format); +extern void xtables_parse_val_mask(struct xt_option_call *cb, + unsigned int *val, unsigned int *mask, + const struct xtables_lmap *lmap); + +static inline void xtables_parse_mark_mask(struct xt_option_call *cb, + unsigned int *mark, + unsigned int *mask) +{ + xtables_parse_val_mask(cb, mark, mask, NULL); +} + #if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS) # ifdef _INIT # undef _init -- cgit v1.2.3