printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / netfilter_bridge.h
blob743475ca7e9d5132f48ee78c46b485e1018a08b3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_BRIDGE_NETFILTER_H
3 #define __LINUX_BRIDGE_NETFILTER_H
5 #include <uapi/linux/netfilter_bridge.h>
6 #include <linux/skbuff.h>
8 struct nf_bridge_frag_data {
9 char mac[ETH_HLEN];
10 bool vlan_present;
11 u16 vlan_tci;
12 __be16 vlan_proto;
15 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
17 int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
19 static inline void br_drop_fake_rtable(struct sk_buff *skb)
21 struct dst_entry *dst = skb_dst(skb);
23 if (dst && (dst->flags & DST_FAKE_RTABLE))
24 skb_dst_drop(skb);
27 static inline struct nf_bridge_info *
28 nf_bridge_info_get(const struct sk_buff *skb)
30 return skb_ext_find(skb, SKB_EXT_BRIDGE_NF);
33 static inline bool nf_bridge_info_exists(const struct sk_buff *skb)
35 return skb_ext_exist(skb, SKB_EXT_BRIDGE_NF);
38 static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
40 const struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
42 if (!nf_bridge)
43 return 0;
45 return nf_bridge->physinif;
48 static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
50 const struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
52 if (!nf_bridge)
53 return 0;
55 return nf_bridge->physoutdev ? nf_bridge->physoutdev->ifindex : 0;
58 static inline struct net_device *
59 nf_bridge_get_physindev(const struct sk_buff *skb, struct net *net)
61 const struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
63 return nf_bridge ? dev_get_by_index_rcu(net, nf_bridge->physinif) : NULL;
66 static inline struct net_device *
67 nf_bridge_get_physoutdev(const struct sk_buff *skb)
69 const struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
71 return nf_bridge ? nf_bridge->physoutdev : NULL;
74 static inline bool nf_bridge_in_prerouting(const struct sk_buff *skb)
76 const struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
78 return nf_bridge && nf_bridge->in_prerouting;
80 #else
81 #define br_drop_fake_rtable(skb) do { } while (0)
82 static inline bool nf_bridge_in_prerouting(const struct sk_buff *skb)
84 return false;
86 #endif /* CONFIG_BRIDGE_NETFILTER */
88 #endif