netfilter: bridge: start splitting mask into public/private chunks
[deliverable/linux.git] / include / linux / netfilter_bridge.h
1 #ifndef __LINUX_BRIDGE_NETFILTER_H
2 #define __LINUX_BRIDGE_NETFILTER_H
3
4 #include <uapi/linux/netfilter_bridge.h>
5 #include <linux/skbuff.h>
6
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,
11 NF_BR_PRI_BRNF = 0,
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,
16 };
17
18 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19
20 #define BRNF_PKT_TYPE 0x01
21 #define BRNF_BRIDGED_DNAT 0x02
22 #define BRNF_NF_BRIDGE_PREROUTING 0x08
23
24 static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
25 {
26 if (skb->nf_bridge->orig_proto == BRNF_PROTO_PPPOE)
27 return PPPOE_SES_HLEN;
28 return 0;
29 }
30
31 int br_handle_frame_finish(struct sk_buff *skb);
32
33 static inline void br_drop_fake_rtable(struct sk_buff *skb)
34 {
35 struct dst_entry *dst = skb_dst(skb);
36
37 if (dst && (dst->flags & DST_FAKE_RTABLE))
38 skb_dst_drop(skb);
39 }
40
41 static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
42 {
43 return skb->nf_bridge ? skb->nf_bridge->physindev->ifindex : 0;
44 }
45
46 static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
47 {
48 return skb->nf_bridge ? skb->nf_bridge->physoutdev->ifindex : 0;
49 }
50
51 static inline struct net_device *
52 nf_bridge_get_physindev(const struct sk_buff *skb)
53 {
54 return skb->nf_bridge ? skb->nf_bridge->physindev : NULL;
55 }
56
57 static inline struct net_device *
58 nf_bridge_get_physoutdev(const struct sk_buff *skb)
59 {
60 return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL;
61 }
62 #else
63 #define br_drop_fake_rtable(skb) do { } while (0)
64 #endif /* CONFIG_BRIDGE_NETFILTER */
65
66 #endif
This page took 0.035898 seconds and 5 git commands to generate.