mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
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 <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
e70deecbf8
commit
c737b7c451
8 changed files with 97 additions and 34 deletions
|
|
@ -2,7 +2,7 @@
|
|||
#define __LINUX_BRIDGE_NETFILTER_H
|
||||
|
||||
#include <uapi/linux/netfilter_bridge.h>
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
enum nf_br_hook_priorities {
|
||||
NF_BR_PRI_FIRST = INT_MIN,
|
||||
|
|
@ -40,6 +40,27 @@ static inline void br_drop_fake_rtable(struct sk_buff *skb)
|
|||
skb_dst_drop(skb);
|
||||
}
|
||||
|
||||
static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->nf_bridge ? skb->nf_bridge->physindev->ifindex : 0;
|
||||
}
|
||||
|
||||
static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->nf_bridge ? skb->nf_bridge->physoutdev->ifindex : 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
#else
|
||||
#define br_drop_fake_rtable(skb) do { } while (0)
|
||||
#endif /* CONFIG_BRIDGE_NETFILTER */
|
||||
|
|
|
|||
Loading…
Reference in a new issue