From 3fdc27aaad9cd644ddaae6f2dba6f13b5e78f27f Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Mon, 27 Apr 2015 21:48:33 +0200 Subject: netfilter: bridge: add helpers for fetching physin/outdev right now we store this in the nf_bridge_info struct, accessible via skb->nf_bridge. This patch prepares removal of this pointer from skb: Instead of using skb->nf_bridge->x, we use helpers to obtain the in/out device (or ifindexes). Followup patches to netfilter will then allow nf_bridge_info to be obtained by a call into the br_netfilter core, rather than keeping a pointer to it in sk_buff. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Jozsef Kadlecsik --- kernel/include/linux/netfilter/ipset/ip_set_compat.h.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'kernel/include/linux/netfilter/ipset/ip_set_compat.h.in') diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in index 5938d8f..02c2a37 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in +++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in @@ -43,6 +43,7 @@ #@HAVE_LIST_LAST_ENTRY@ HAVE_LIST_LAST_ENTRY #@HAVE_LIST_NEXT_ENTRY@ HAVE_LIST_NEXT_ENTRY #@HAVE_ETHER_ADDR_COPY@ HAVE_ETHER_ADDR_COPY +#@HAVE_NF_BRIDGE_GET_PHYSDEV@ HAVE_NF_BRIDGE_GET_PHYSDEV /* Not everything could be moved here. Compatibility stuffs can be found in * xt_set.c, ip_set_core.c, ip_set_getport.c, pfxlen.c too. @@ -209,6 +210,22 @@ static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value) #define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN) #endif +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) +#ifndef HAVE_NF_BRIDGE_GET_PHYSDEV +static inline struct net_device * +nf_bridge_get_physindev(const struct sk_buff *skb) +{ + return skb->nf_bridge ? skb->nf_bridge->physindev : NULL; +} + +static inline struct net_device * +nf_bridge_get_physoutdev(const struct sk_buff *skb) +{ + return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL; +} +#endif +#endif + #ifndef smp_mb__before_atomic #define smp_mb__before_atomic() smp_mb() #define smp_mb__after_atomic() smp_mb() -- cgit v1.2.3