From 9dc50b5b8e4416219c700331c6e301d840f6e55d Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 16 Nov 2020 17:20:57 +0100 Subject: xshared: Merge invflags handling code Join invflags handling between iptables, ip6tables, xtables and arptables. Ebtables still has its own code which differs quite a bit. In order to use a shared set_option() routine, iptables and ip6tables need to provide a local 'invflags' variable which is 16bits wide. Signed-off-by: Phil Sutter --- iptables/xtables-arp.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'iptables/xtables-arp.c') diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c index 4a89ae95..4a351f0c 100644 --- a/iptables/xtables-arp.c +++ b/iptables/xtables-arp.c @@ -105,29 +105,6 @@ struct xtables_globals arptables_globals = { .compat_rev = nft_compatible_revision, }; -/* index relates to bit of each OPT_* value */ -static int inverse_for_options[] = -{ -/* -n */ 0, -/* -s */ IPT_INV_SRCIP, -/* -d */ IPT_INV_DSTIP, -/* -p */ 0, -/* -j */ 0, -/* -v */ 0, -/* -x */ 0, -/* -i */ IPT_INV_VIA_IN, -/* -o */ IPT_INV_VIA_OUT, -/*--line*/ 0, -/* -c */ 0, -/* -f */ 0, -/* 2 */ IPT_INV_SRCDEVADDR, -/* 3 */ IPT_INV_TGTDEVADDR, -/* -l */ IPT_INV_ARPHLN, -/* 4 */ IPT_INV_ARPOP, -/* 5 */ IPT_INV_ARPHRD, -/* 6 */ IPT_INV_PROTO, -}; - /***********************************************/ /* ARPTABLES SPECIFIC NEW FUNCTIONS ADDED HERE */ /***********************************************/ @@ -298,27 +275,6 @@ check_inverse(const char option[], int *invert, int *optidx, int argc) return false; } -static void -set_option(unsigned int *options, unsigned int option, u_int16_t *invflg, - int invert) -{ - if (*options & option) - xtables_error(PARAMETER_PROBLEM, "multiple -%c flags not allowed", - opt2char(option)); - *options |= option; - - if (invert) { - unsigned int i; - for (i = 0; 1 << i != option; i++); - - if (!inverse_for_options[i]) - xtables_error(PARAMETER_PROBLEM, - "cannot have ! before -%c", - opt2char(option)); - *invflg |= inverse_for_options[i]; - } -} - static int list_entries(struct nft_handle *h, const char *chain, const char *table, int rulenum, int verbose, int numeric, int expanded, -- cgit v1.2.3