]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef __LINUX_BRIDGE_NETFILTER_H |
3 | #define __LINUX_BRIDGE_NETFILTER_H | |
4 | ||
607ca46e | 5 | #include <uapi/linux/netfilter_bridge.h> |
c737b7c4 | 6 | #include <linux/skbuff.h> |
1da177e4 | 7 | |
34666d46 | 8 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
1da177e4 | 9 | |
0c4b51f0 | 10 | int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb); |
ea2d9b41 | 11 | |
a881e963 PHP |
12 | static inline void br_drop_fake_rtable(struct sk_buff *skb) |
13 | { | |
14 | struct dst_entry *dst = skb_dst(skb); | |
15 | ||
16 | if (dst && (dst->flags & DST_FAKE_RTABLE)) | |
17 | skb_dst_drop(skb); | |
18 | } | |
19 | ||
c737b7c4 FW |
20 | static inline int nf_bridge_get_physinif(const struct sk_buff *skb) |
21 | { | |
547c4b54 FW |
22 | struct nf_bridge_info *nf_bridge; |
23 | ||
24 | if (skb->nf_bridge == NULL) | |
25 | return 0; | |
26 | ||
27 | nf_bridge = skb->nf_bridge; | |
28 | return nf_bridge->physindev ? nf_bridge->physindev->ifindex : 0; | |
c737b7c4 FW |
29 | } |
30 | ||
31 | static inline int nf_bridge_get_physoutif(const struct sk_buff *skb) | |
32 | { | |
547c4b54 FW |
33 | struct nf_bridge_info *nf_bridge; |
34 | ||
35 | if (skb->nf_bridge == NULL) | |
36 | return 0; | |
37 | ||
38 | nf_bridge = skb->nf_bridge; | |
39 | return nf_bridge->physoutdev ? nf_bridge->physoutdev->ifindex : 0; | |
c737b7c4 FW |
40 | } |
41 | ||
42 | static inline struct net_device * | |
43 | nf_bridge_get_physindev(const struct sk_buff *skb) | |
44 | { | |
45 | return skb->nf_bridge ? skb->nf_bridge->physindev : NULL; | |
46 | } | |
47 | ||
48 | static inline struct net_device * | |
49 | nf_bridge_get_physoutdev(const struct sk_buff *skb) | |
50 | { | |
51 | return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL; | |
52 | } | |
72b1e5e4 FW |
53 | |
54 | static inline bool nf_bridge_in_prerouting(const struct sk_buff *skb) | |
55 | { | |
56 | return skb->nf_bridge && skb->nf_bridge->in_prerouting; | |
57 | } | |
07317621 | 58 | #else |
a881e963 | 59 | #define br_drop_fake_rtable(skb) do { } while (0) |
72b1e5e4 FW |
60 | static inline bool nf_bridge_in_prerouting(const struct sk_buff *skb) |
61 | { | |
62 | return false; | |
63 | } | |
1da177e4 LT |
64 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
65 | ||
1da177e4 | 66 | #endif |