Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __LINUX_BRIDGE_NETFILTER_H |
2 | #define __LINUX_BRIDGE_NETFILTER_H | |
3 | ||
607ca46e | 4 | #include <uapi/linux/netfilter_bridge.h> |
c737b7c4 | 5 | #include <linux/skbuff.h> |
1da177e4 LT |
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 | ||
34666d46 | 18 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
1da177e4 | 19 | |
1da177e4 | 20 | #define BRNF_BRIDGED_DNAT 0x02 |
ea2d9b41 | 21 | #define BRNF_NF_BRIDGE_PREROUTING 0x08 |
1da177e4 | 22 | |
7026b1dd | 23 | int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb); |
ea2d9b41 | 24 | |
a881e963 PHP |
25 | static inline void br_drop_fake_rtable(struct sk_buff *skb) |
26 | { | |
27 | struct dst_entry *dst = skb_dst(skb); | |
28 | ||
29 | if (dst && (dst->flags & DST_FAKE_RTABLE)) | |
30 | skb_dst_drop(skb); | |
31 | } | |
32 | ||
c737b7c4 FW |
33 | static inline int nf_bridge_get_physinif(const struct sk_buff *skb) |
34 | { | |
547c4b54 FW |
35 | struct nf_bridge_info *nf_bridge; |
36 | ||
37 | if (skb->nf_bridge == NULL) | |
38 | return 0; | |
39 | ||
40 | nf_bridge = skb->nf_bridge; | |
41 | return nf_bridge->physindev ? nf_bridge->physindev->ifindex : 0; | |
c737b7c4 FW |
42 | } |
43 | ||
44 | static inline int nf_bridge_get_physoutif(const struct sk_buff *skb) | |
45 | { | |
547c4b54 FW |
46 | struct nf_bridge_info *nf_bridge; |
47 | ||
48 | if (skb->nf_bridge == NULL) | |
49 | return 0; | |
50 | ||
51 | nf_bridge = skb->nf_bridge; | |
52 | return nf_bridge->physoutdev ? nf_bridge->physoutdev->ifindex : 0; | |
c737b7c4 FW |
53 | } |
54 | ||
55 | static inline struct net_device * | |
56 | nf_bridge_get_physindev(const struct sk_buff *skb) | |
57 | { | |
58 | return skb->nf_bridge ? skb->nf_bridge->physindev : NULL; | |
59 | } | |
60 | ||
61 | static inline struct net_device * | |
62 | nf_bridge_get_physoutdev(const struct sk_buff *skb) | |
63 | { | |
64 | return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL; | |
65 | } | |
07317621 | 66 | #else |
a881e963 | 67 | #define br_drop_fake_rtable(skb) do { } while (0) |
1da177e4 LT |
68 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
69 | ||
1da177e4 | 70 | #endif |