diff options
| -rw-r--r-- | include/net/ip.h | 1 | ||||
| -rw-r--r-- | include/net/ipv6.h | 1 | ||||
| -rw-r--r-- | net/ipv4/netfilter/nf_defrag_ipv4.c | 21 | ||||
| -rw-r--r-- | net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 6 |
4 files changed, 25 insertions, 4 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index e6b9d12d5f62..85108cfbb1ae 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -337,6 +337,7 @@ enum ip_defrag_users { | |||
| 337 | IP_DEFRAG_CALL_RA_CHAIN, | 337 | IP_DEFRAG_CALL_RA_CHAIN, |
| 338 | IP_DEFRAG_CONNTRACK_IN, | 338 | IP_DEFRAG_CONNTRACK_IN, |
| 339 | IP_DEFRAG_CONNTRACK_OUT, | 339 | IP_DEFRAG_CONNTRACK_OUT, |
| 340 | IP_DEFRAG_CONNTRACK_BRIDGE_IN, | ||
| 340 | IP_DEFRAG_VS_IN, | 341 | IP_DEFRAG_VS_IN, |
| 341 | IP_DEFRAG_VS_OUT, | 342 | IP_DEFRAG_VS_OUT, |
| 342 | IP_DEFRAG_VS_FWD | 343 | IP_DEFRAG_VS_FWD |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index d6916035bcea..ccab5946c830 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -354,6 +354,7 @@ enum ip6_defrag_users { | |||
| 354 | IP6_DEFRAG_LOCAL_DELIVER, | 354 | IP6_DEFRAG_LOCAL_DELIVER, |
| 355 | IP6_DEFRAG_CONNTRACK_IN, | 355 | IP6_DEFRAG_CONNTRACK_IN, |
| 356 | IP6_DEFRAG_CONNTRACK_OUT, | 356 | IP6_DEFRAG_CONNTRACK_OUT, |
| 357 | IP6_DEFRAG_CONNTRACK_BRIDGE_IN, | ||
| 357 | }; | 358 | }; |
| 358 | 359 | ||
| 359 | struct ip6_create_arg { | 360 | struct ip6_create_arg { |
diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c index fa2d6b6fc3e5..331ead3ebd1b 100644 --- a/net/ipv4/netfilter/nf_defrag_ipv4.c +++ b/net/ipv4/netfilter/nf_defrag_ipv4.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <net/route.h> | 14 | #include <net/route.h> |
| 15 | #include <net/ip.h> | 15 | #include <net/ip.h> |
| 16 | 16 | ||
| 17 | #include <linux/netfilter_bridge.h> | ||
| 17 | #include <linux/netfilter_ipv4.h> | 18 | #include <linux/netfilter_ipv4.h> |
| 18 | #include <net/netfilter/ipv4/nf_defrag_ipv4.h> | 19 | #include <net/netfilter/ipv4/nf_defrag_ipv4.h> |
| 19 | 20 | ||
| @@ -34,6 +35,20 @@ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user) | |||
| 34 | return err; | 35 | return err; |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 38 | static enum ip_defrag_users nf_ct_defrag_user(unsigned int hooknum, | ||
| 39 | struct sk_buff *skb) | ||
| 40 | { | ||
| 41 | #ifdef CONFIG_BRIDGE_NETFILTER | ||
| 42 | if (skb->nf_bridge && | ||
| 43 | skb->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING) | ||
| 44 | return IP_DEFRAG_CONNTRACK_BRIDGE_IN; | ||
| 45 | #endif | ||
| 46 | if (hooknum == NF_INET_PRE_ROUTING) | ||
| 47 | return IP_DEFRAG_CONNTRACK_IN; | ||
| 48 | else | ||
| 49 | return IP_DEFRAG_CONNTRACK_OUT; | ||
| 50 | } | ||
| 51 | |||
| 37 | static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, | 52 | static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, |
| 38 | struct sk_buff *skb, | 53 | struct sk_buff *skb, |
| 39 | const struct net_device *in, | 54 | const struct net_device *in, |
| @@ -50,10 +65,8 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, | |||
| 50 | #endif | 65 | #endif |
| 51 | /* Gather fragments. */ | 66 | /* Gather fragments. */ |
| 52 | if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { | 67 | if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { |
| 53 | if (nf_ct_ipv4_gather_frags(skb, | 68 | enum ip_defrag_users user = nf_ct_defrag_user(hooknum, skb); |
| 54 | hooknum == NF_INET_PRE_ROUTING ? | 69 | if (nf_ct_ipv4_gather_frags(skb, user)) |
| 55 | IP_DEFRAG_CONNTRACK_IN : | ||
| 56 | IP_DEFRAG_CONNTRACK_OUT)) | ||
| 57 | return NF_STOLEN; | 70 | return NF_STOLEN; |
| 58 | } | 71 | } |
| 59 | return NF_ACCEPT; | 72 | return NF_ACCEPT; |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index c0a82fe78321..0956ebabbff2 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <net/ipv6.h> | 20 | #include <net/ipv6.h> |
| 21 | #include <net/inet_frag.h> | 21 | #include <net/inet_frag.h> |
| 22 | 22 | ||
| 23 | #include <linux/netfilter_bridge.h> | ||
| 23 | #include <linux/netfilter_ipv6.h> | 24 | #include <linux/netfilter_ipv6.h> |
| 24 | #include <net/netfilter/nf_conntrack.h> | 25 | #include <net/netfilter/nf_conntrack.h> |
| 25 | #include <net/netfilter/nf_conntrack_helper.h> | 26 | #include <net/netfilter/nf_conntrack_helper.h> |
| @@ -190,6 +191,11 @@ out: | |||
| 190 | static enum ip6_defrag_users nf_ct6_defrag_user(unsigned int hooknum, | 191 | static enum ip6_defrag_users nf_ct6_defrag_user(unsigned int hooknum, |
| 191 | struct sk_buff *skb) | 192 | struct sk_buff *skb) |
| 192 | { | 193 | { |
| 194 | #ifdef CONFIG_BRIDGE_NETFILTER | ||
| 195 | if (skb->nf_bridge && | ||
| 196 | skb->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING) | ||
| 197 | return IP6_DEFRAG_CONNTRACK_BRIDGE_IN; | ||
| 198 | #endif | ||
| 193 | if (hooknum == NF_INET_PRE_ROUTING) | 199 | if (hooknum == NF_INET_PRE_ROUTING) |
| 194 | return IP6_DEFRAG_CONNTRACK_IN; | 200 | return IP6_DEFRAG_CONNTRACK_IN; |
| 195 | else | 201 | else |
