netfilter: Convert FWINV<[foo]> macros and uses to NF_INVF
netfilter uses multiple FWINV #defines with identical form that hide a specific structure variable and dereference it with a invflags member. $ git grep "#define FWINV" include/linux/netfilter_bridge/ebtables.h:#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) net/bridge/netfilter/ebtables.c:#define FWINV2(bool, invflg) ((bool) ^ !!(e->invflags & invflg)) net/ipv4/netfilter/arp_tables.c:#define FWINV(bool, invflg) ((bool) ^ !!(arpinfo->invflags & (invflg))) net/ipv4/netfilter/ip_tables.c:#define FWINV(bool, invflg) ((bool) ^ !!(ipinfo->invflags & (invflg))) net/ipv6/netfilter/ip6_tables.c:#define FWINV(bool, invflg) ((bool) ^ !!(ip6info->invflags & (invflg))) net/netfilter/xt_tcpudp.c:#define FWINVTCP(bool, invflg) ((bool) ^ !!(tcpinfo->invflags & (invflg))) Consolidate these macros into a single NF_INVF macro. Miscellanea: o Neaten the alignment around these uses o A few lines are > 80 columns for intelligibility Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
f1504307b9
commit
c37a2dfa67
12 changed files with 144 additions and 138 deletions
|
|
@ -6,6 +6,10 @@
|
|||
#include <linux/static_key.h>
|
||||
#include <uapi/linux/netfilter/x_tables.h>
|
||||
|
||||
/* Test a struct->invflags and a boolean for inequality */
|
||||
#define NF_INVF(ptr, flag, boolean) \
|
||||
((boolean) ^ !!((ptr)->invflags & (flag)))
|
||||
|
||||
/**
|
||||
* struct xt_action_param - parameters for matches/targets
|
||||
*
|
||||
|
|
|
|||
|
|
@ -115,8 +115,6 @@ extern unsigned int ebt_do_table(struct sk_buff *skb,
|
|||
const struct nf_hook_state *state,
|
||||
struct ebt_table *table);
|
||||
|
||||
/* Used in the kernel match() functions */
|
||||
#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg))
|
||||
/* True if the hook mask denotes that the rule is in a base chain,
|
||||
* used in the check() functions */
|
||||
#define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue