diff options
| -rw-r--r-- | include/linux/netfilter_bridge.h | 2 | ||||
| -rw-r--r-- | include/linux/skbuff.h | 12 | ||||
| -rw-r--r-- | include/net/neighbour.h | 2 | ||||
| -rw-r--r-- | include/net/netfilter/ipv4/nf_reject.h | 2 | ||||
| -rw-r--r-- | include/net/netfilter/ipv6/nf_reject.h | 2 | ||||
| -rw-r--r-- | net/Kconfig | 7 | ||||
| -rw-r--r-- | net/bridge/Makefile | 5 | ||||
| -rw-r--r-- | net/bridge/br.c | 14 | ||||
| -rw-r--r-- | net/bridge/br_device.c | 4 | ||||
| -rw-r--r-- | net/bridge/br_forward.c | 2 | ||||
| -rw-r--r-- | net/bridge/br_input.c | 1 | ||||
| -rw-r--r-- | net/bridge/br_netfilter.c | 88 | ||||
| -rw-r--r-- | net/bridge/br_netlink.c | 2 | ||||
| -rw-r--r-- | net/bridge/br_nf_core.c | 96 | ||||
| -rw-r--r-- | net/bridge/br_private.h | 12 | ||||
| -rw-r--r-- | net/bridge/br_sysfs_br.c | 4 |
16 files changed, 151 insertions, 104 deletions
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index fe996d59de64..c755e4971fa3 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
| @@ -15,7 +15,7 @@ enum nf_br_hook_priorities { | |||
| 15 | NF_BR_PRI_LAST = INT_MAX, | 15 | NF_BR_PRI_LAST = INT_MAX, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | #ifdef CONFIG_BRIDGE_NETFILTER | 18 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 19 | 19 | ||
| 20 | #define BRNF_PKT_TYPE 0x01 | 20 | #define BRNF_PKT_TYPE 0x01 |
| 21 | #define BRNF_BRIDGED_DNAT 0x02 | 21 | #define BRNF_BRIDGED_DNAT 0x02 |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 07c9fdd0c126..c4ff43f84573 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -156,7 +156,7 @@ struct nf_conntrack { | |||
| 156 | }; | 156 | }; |
| 157 | #endif | 157 | #endif |
| 158 | 158 | ||
| 159 | #ifdef CONFIG_BRIDGE_NETFILTER | 159 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 160 | struct nf_bridge_info { | 160 | struct nf_bridge_info { |
| 161 | atomic_t use; | 161 | atomic_t use; |
| 162 | unsigned int mask; | 162 | unsigned int mask; |
| @@ -560,7 +560,7 @@ struct sk_buff { | |||
| 560 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 560 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 561 | struct nf_conntrack *nfct; | 561 | struct nf_conntrack *nfct; |
| 562 | #endif | 562 | #endif |
| 563 | #ifdef CONFIG_BRIDGE_NETFILTER | 563 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 564 | struct nf_bridge_info *nf_bridge; | 564 | struct nf_bridge_info *nf_bridge; |
| 565 | #endif | 565 | #endif |
| 566 | 566 | ||
| @@ -2977,7 +2977,7 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct) | |||
| 2977 | atomic_inc(&nfct->use); | 2977 | atomic_inc(&nfct->use); |
| 2978 | } | 2978 | } |
| 2979 | #endif | 2979 | #endif |
| 2980 | #ifdef CONFIG_BRIDGE_NETFILTER | 2980 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 2981 | static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) | 2981 | static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) |
| 2982 | { | 2982 | { |
| 2983 | if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) | 2983 | if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) |
| @@ -2995,7 +2995,7 @@ static inline void nf_reset(struct sk_buff *skb) | |||
| 2995 | nf_conntrack_put(skb->nfct); | 2995 | nf_conntrack_put(skb->nfct); |
| 2996 | skb->nfct = NULL; | 2996 | skb->nfct = NULL; |
| 2997 | #endif | 2997 | #endif |
| 2998 | #ifdef CONFIG_BRIDGE_NETFILTER | 2998 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 2999 | nf_bridge_put(skb->nf_bridge); | 2999 | nf_bridge_put(skb->nf_bridge); |
| 3000 | skb->nf_bridge = NULL; | 3000 | skb->nf_bridge = NULL; |
| 3001 | #endif | 3001 | #endif |
| @@ -3016,7 +3016,7 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) | |||
| 3016 | nf_conntrack_get(src->nfct); | 3016 | nf_conntrack_get(src->nfct); |
| 3017 | dst->nfctinfo = src->nfctinfo; | 3017 | dst->nfctinfo = src->nfctinfo; |
| 3018 | #endif | 3018 | #endif |
| 3019 | #ifdef CONFIG_BRIDGE_NETFILTER | 3019 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 3020 | dst->nf_bridge = src->nf_bridge; | 3020 | dst->nf_bridge = src->nf_bridge; |
| 3021 | nf_bridge_get(src->nf_bridge); | 3021 | nf_bridge_get(src->nf_bridge); |
| 3022 | #endif | 3022 | #endif |
| @@ -3030,7 +3030,7 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src) | |||
| 3030 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 3030 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 3031 | nf_conntrack_put(dst->nfct); | 3031 | nf_conntrack_put(dst->nfct); |
| 3032 | #endif | 3032 | #endif |
| 3033 | #ifdef CONFIG_BRIDGE_NETFILTER | 3033 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 3034 | nf_bridge_put(dst->nf_bridge); | 3034 | nf_bridge_put(dst->nf_bridge); |
| 3035 | #endif | 3035 | #endif |
| 3036 | __nf_copy(dst, src); | 3036 | __nf_copy(dst, src); |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 47f425464f84..f60558d0254c 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -373,7 +373,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | |||
| 373 | return 0; | 373 | return 0; |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | #ifdef CONFIG_BRIDGE_NETFILTER | 376 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 377 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) | 377 | static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) |
| 378 | { | 378 | { |
| 379 | unsigned int seq, hh_alen; | 379 | unsigned int seq, hh_alen; |
diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h index 931fbf812171..f713b5a31d62 100644 --- a/include/net/netfilter/ipv4/nf_reject.h +++ b/include/net/netfilter/ipv4/nf_reject.h | |||
| @@ -98,7 +98,7 @@ static void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
| 98 | 98 | ||
| 99 | nf_ct_attach(nskb, oldskb); | 99 | nf_ct_attach(nskb, oldskb); |
| 100 | 100 | ||
| 101 | #ifdef CONFIG_BRIDGE_NETFILTER | 101 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 102 | /* If we use ip_local_out for bridged traffic, the MAC source on | 102 | /* If we use ip_local_out for bridged traffic, the MAC source on |
| 103 | * the RST will be ours, instead of the destination's. This confuses | 103 | * the RST will be ours, instead of the destination's. This confuses |
| 104 | * some routers/firewalls, and they drop the packet. So we need to | 104 | * some routers/firewalls, and they drop the packet. So we need to |
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h index 710d17ed70b4..7a10cfcd8e33 100644 --- a/include/net/netfilter/ipv6/nf_reject.h +++ b/include/net/netfilter/ipv6/nf_reject.h | |||
| @@ -147,7 +147,7 @@ static void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | |||
| 147 | 147 | ||
| 148 | nf_ct_attach(nskb, oldskb); | 148 | nf_ct_attach(nskb, oldskb); |
| 149 | 149 | ||
| 150 | #ifdef CONFIG_BRIDGE_NETFILTER | 150 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) |
| 151 | /* If we use ip6_local_out for bridged traffic, the MAC source on | 151 | /* If we use ip6_local_out for bridged traffic, the MAC source on |
| 152 | * the RST will be ours, instead of the destination's. This confuses | 152 | * the RST will be ours, instead of the destination's. This confuses |
| 153 | * some routers/firewalls, and they drop the packet. So we need to | 153 | * some routers/firewalls, and they drop the packet. So we need to |
diff --git a/net/Kconfig b/net/Kconfig index 4051fdfa4367..dc5d700d05e7 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
| @@ -176,10 +176,11 @@ config NETFILTER_ADVANCED | |||
| 176 | If unsure, say Y. | 176 | If unsure, say Y. |
| 177 | 177 | ||
| 178 | config BRIDGE_NETFILTER | 178 | config BRIDGE_NETFILTER |
| 179 | bool "Bridged IP/ARP packets filtering" | 179 | tristate "Bridged IP/ARP packets filtering" |
| 180 | depends on BRIDGE && NETFILTER && INET | 180 | depends on (BRIDGE || BRIDGE=n) |
| 181 | depends on NETFILTER && INET | ||
| 181 | depends on NETFILTER_ADVANCED | 182 | depends on NETFILTER_ADVANCED |
| 182 | default y | 183 | default m |
| 183 | ---help--- | 184 | ---help--- |
| 184 | Enabling this option will let arptables resp. iptables see bridged | 185 | Enabling this option will let arptables resp. iptables see bridged |
| 185 | ARP resp. IP traffic. If you want a bridging firewall, you probably | 186 | ARP resp. IP traffic. If you want a bridging firewall, you probably |
diff --git a/net/bridge/Makefile b/net/bridge/Makefile index 8590b942bffa..5e3eac5dc8b9 100644 --- a/net/bridge/Makefile +++ b/net/bridge/Makefile | |||
| @@ -6,11 +6,12 @@ obj-$(CONFIG_BRIDGE) += bridge.o | |||
| 6 | 6 | ||
| 7 | bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ | 7 | bridge-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ |
| 8 | br_ioctl.o br_stp.o br_stp_bpdu.o \ | 8 | br_ioctl.o br_stp.o br_stp_bpdu.o \ |
| 9 | br_stp_if.o br_stp_timer.o br_netlink.o | 9 | br_stp_if.o br_stp_timer.o br_netlink.o \ |
| 10 | br_nf_core.o | ||
| 10 | 11 | ||
| 11 | bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o | 12 | bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o |
| 12 | 13 | ||
| 13 | bridge-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o | 14 | obj-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o |
| 14 | 15 | ||
| 15 | bridge-$(CONFIG_BRIDGE_IGMP_SNOOPING) += br_multicast.o br_mdb.o | 16 | bridge-$(CONFIG_BRIDGE_IGMP_SNOOPING) += br_multicast.o br_mdb.o |
| 16 | 17 | ||
diff --git a/net/bridge/br.c b/net/bridge/br.c index 1a755a1e5410..44425aff7cba 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c | |||
| @@ -161,7 +161,7 @@ static int __init br_init(void) | |||
| 161 | if (err) | 161 | if (err) |
| 162 | goto err_out1; | 162 | goto err_out1; |
| 163 | 163 | ||
| 164 | err = br_netfilter_init(); | 164 | err = br_nf_core_init(); |
| 165 | if (err) | 165 | if (err) |
| 166 | goto err_out2; | 166 | goto err_out2; |
| 167 | 167 | ||
| @@ -179,11 +179,16 @@ static int __init br_init(void) | |||
| 179 | br_fdb_test_addr_hook = br_fdb_test_addr; | ||
