blob: 5fc0a0fe244b47ee691b62292314082d0d038dde [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __LINUX_BRIDGE_NETFILTER_H
2#define __LINUX_BRIDGE_NETFILTER_H
3
David Howells607ca462012-10-13 10:46:48 +01004#include <uapi/linux/netfilter_bridge.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
7enum 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
Pablo Neira Ayuso34666d42014-09-18 11:29:03 +020018#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02
Bart De Schuymerea2d9b42010-04-15 12:14:51 +020022#define BRNF_NF_BRIDGE_PREROUTING 0x08
Bart De Schuymere179e632010-04-15 12:26:39 +020023#define BRNF_8021Q 0x10
24#define BRNF_PPPoE 0x20
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Bart De Schuymer6c79bf02010-04-20 16:22:01 +020026static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
27{
28 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
29 return PPPOE_SES_HLEN;
30 return 0;
31}
32
David Miller7026b1d2015-04-05 22:19:04 -040033int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb);
Bart De Schuymerea2d9b42010-04-15 12:14:51 +020034
Peter Huang (Peng)a881e962012-04-19 20:12:51 +000035static inline void br_drop_fake_rtable(struct sk_buff *skb)
36{
37 struct dst_entry *dst = skb_dst(skb);
38
39 if (dst && (dst->flags & DST_FAKE_RTABLE))
40 skb_dst_drop(skb);
41}
42
Stephen Hemminger073176212006-08-29 17:48:17 -070043#else
Peter Huang (Peng)a881e962012-04-19 20:12:51 +000044#define br_drop_fake_rtable(skb) do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#endif /* CONFIG_BRIDGE_NETFILTER */
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#endif