diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2014-10-05 00:00:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-07 15:12:44 -0400 |
commit | 93fdd47e52f3f869a437319db9da1ea409acc07e (patch) | |
tree | ff0bf4593b59fbe837bbe74f659e44cf5817db17 /net | |
parent | 88b09a6d958af6c458acf055ee2eb5bc9564efda (diff) |
bridge: Save frag_max_size between PRE_ROUTING and POST_ROUTING
As we may defragment the packet in IPv4 PRE_ROUTING and refragment
it after POST_ROUTING we should save the value of frag_max_size.
This is still very wrong as the bridge is supposed to leave the
packets intact, meaning that the right thing to do is to use the
original frag_list for fragmentation.
Unfortunately we don't currently guarantee that the frag_list is
left untouched throughout netfilter so until this changes this is
the best we can do.
There is also a spot in FORWARD where it appears that we can
forward a packet without going through fragmentation, mark it
so that we can fix it later.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_netfilter.c | 11 | ||||
-rw-r--r-- | net/bridge/br_private.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index a615264cf01a..4063898cf8aa 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -404,6 +404,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) | |||
404 | ETH_HLEN-ETH_ALEN); | 404 | ETH_HLEN-ETH_ALEN); |
405 | /* tell br_dev_xmit to continue with forwarding */ | 405 | /* tell br_dev_xmit to continue with forwarding */ |
406 | nf_bridge->mask |= BRNF_BRIDGED_DNAT; | 406 | nf_bridge->mask |= BRNF_BRIDGED_DNAT; |
407 | /* FIXME Need to refragment */ | ||
407 | ret = neigh->output(neigh, skb); | 408 | ret = neigh->output(neigh, skb); |
408 | } | 409 | } |
409 | neigh_release(neigh); | 410 | neigh_release(neigh); |
@@ -459,6 +460,10 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb) | |||
459 | struct nf_bridge_info *nf_bridge = skb->nf_bridge; | 460 | struct nf_bridge_info *nf_bridge = skb->nf_bridge; |
460 | struct rtable *rt; | 461 | struct rtable *rt; |
461 | int err; | 462 | int err; |
463 | int frag_max_size; | ||
464 | |||
465 | frag_max_size = IPCB(skb)->frag_max_size; | ||
466 | BR_INPUT_SKB_CB(skb)->frag_max_size = frag_max_size; | ||
462 | 467 | ||
463 | if (nf_bridge->mask & BRNF_PKT_TYPE) { | 468 | if (nf_bridge->mask & BRNF_PKT_TYPE) { |
464 | skb->pkt_type = PACKET_OTHERHOST; | 469 | skb->pkt_type = PACKET_OTHERHOST; |
@@ -863,13 +868,19 @@ static unsigned int br_nf_forward_arp(const struct nf_hook_ops *ops, | |||
863 | static int br_nf_dev_queue_xmit(struct sk_buff *skb) | 868 | static int br_nf_dev_queue_xmit(struct sk_buff *skb) |
864 | { | 869 | { |
865 | int ret; | 870 | int ret; |
871 | int frag_max_size; | ||
866 | 872 | ||
873 | /* This is wrong! We should preserve the original fragment | ||
874 | * boundaries by preserving frag_list rather than refragmenting. | ||
875 | */ | ||
867 | if (skb->protocol == htons(ETH_P_IP) && | 876 | if (skb->protocol == htons(ETH_P_IP) && |
868 | skb->len + nf_bridge_mtu_reduction(skb) > skb->dev->mtu && | 877 | skb->len + nf_bridge_mtu_reduction(skb) > skb->dev->mtu && |
869 | !skb_is_gso(skb)) { | 878 | !skb_is_gso(skb)) { |
879 | frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; | ||
870 | if (br_parse_ip_options(skb)) | 880 | if (br_parse_ip_options(skb)) |
871 | /* Drop invalid packet */ | 881 | /* Drop invalid packet */ |
872 | return NF_DROP; | 882 | return NF_DROP; |
883 | IPCB(skb)->frag_max_size = frag_max_size; | ||
873 | ret = ip_fragment(skb, br_dev_queue_push_xmit); | 884 | ret = ip_fragment(skb, br_dev_queue_push_xmit); |
874 | } else | 885 | } else |
875 | ret = br_dev_queue_push_xmit(skb); | 886 | ret = br_dev_queue_push_xmit(skb); |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index b6c04cbcfdc5..2398369c6dda 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -305,10 +305,14 @@ struct net_bridge | |||
305 | 305 | ||
306 | struct br_input_skb_cb { | 306 | struct br_input_skb_cb { |
307 | struct net_device *brdev; | 307 | struct net_device *brdev; |
308 | |||
308 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING | 309 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING |
309 | int igmp; | 310 | int igmp; |
310 | int mrouters_only; | 311 | int mrouters_only; |
311 | #endif | 312 | #endif |
313 | |||
314 | u16 frag_max_size; | ||
315 | |||
312 | #ifdef CONFIG_BRIDGE_VLAN_FILTERING | 316 | #ifdef CONFIG_BRIDGE_VLAN_FILTERING |
313 | bool vlan_filtered; | 317 | bool vlan_filtered; |
314 | #endif | 318 | #endif |