1 #ifndef __LINUX_BRIDGE_NETFILTER_H
2 #define __LINUX_BRIDGE_NETFILTER_H
4 #include <uapi/linux/netfilter_bridge.h>
7 enum nf_br_hook_priorities {
8 NF_BR_PRI_FIRST = INT_MIN,
9 NF_BR_PRI_NAT_DST_BRIDGED = -300,
10 NF_BR_PRI_FILTER_BRIDGED = -200,
12 NF_BR_PRI_NAT_DST_OTHER = 100,
13 NF_BR_PRI_FILTER_OTHER = 200,
14 NF_BR_PRI_NAT_SRC = 300,
15 NF_BR_PRI_LAST = INT_MAX,
18 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
20 #define BRNF_PKT_TYPE 0x01
21 #define BRNF_BRIDGED_DNAT 0x02
22 #define BRNF_NF_BRIDGE_PREROUTING 0x08
23 #define BRNF_8021Q 0x10
24 #define BRNF_PPPoE 0x20
26 static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
28 switch (skb->protocol) {
29 case __cpu_to_be16(ETH_P_8021Q):
31 case __cpu_to_be16(ETH_P_PPP_SES):
32 return PPPOE_SES_HLEN;
38 static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
40 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
41 return PPPOE_SES_HLEN;
45 int br_handle_frame_finish(struct sk_buff *skb);
47 /* This is called by the IP fragmenting code and it ensures there is
48 * enough room for the encapsulating header (if there is one). */
49 static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
52 return nf_bridge_encap_header_len(skb);
56 static inline void br_drop_fake_rtable(struct sk_buff *skb)
58 struct dst_entry *dst = skb_dst(skb);
60 if (dst && (dst->flags & DST_FAKE_RTABLE))
65 #define nf_bridge_pad(skb) (0)
66 #define br_drop_fake_rtable(skb) do { } while (0)
67 #endif /* CONFIG_BRIDGE_NETFILTER */