]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
netfilter: bridge-netfilter: fix refragmenting IP traffic encapsulated in PPPoE traffic
authorBart De Schuymer <bdschuym@pandora.be>
Tue, 20 Apr 2010 14:22:01 +0000 (16:22 +0200)
committerPatrick McHardy <kaber@trash.net>
Tue, 20 Apr 2010 14:22:01 +0000 (16:22 +0200)
The MTU for IP traffic encapsulated inside PPPoE traffic is smaller
than the MTU of the Ethernet device (1500). Connection tracking
gathers all IP packets and sometimes will refragment them in
ip_fragment(). We then need to subtract the length of the
encapsulating header from the mtu used in ip_fragment(). The check in
br_nf_dev_queue_xmit() which determines if ip_fragment() has to be
called is also updated for the PPPoE-encapsulated packets.
nf_bridge_copy_header() is also updated to make sure the PPPoE data
length field has the correct value.

Signed-off-by: Bart De Schuymer <bdschuym@pandora.be>
Signed-off-by: Patrick McHardy <kaber@trash.net>
include/linux/netfilter_bridge.h
net/bridge/br_netfilter.c
net/ipv4/ip_output.c

index ea0e44b90432393e6caf07ed97f86e4a9c308d65..0ddd161f3b060c2e2ec0d665c1ddc719213443f7 100644 (file)
@@ -68,6 +68,13 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
        }
 }
 
+static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
+{
+       if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
+               return PPPOE_SES_HLEN;
+       return 0;
+}
+
 extern int br_handle_frame_finish(struct sk_buff *skb);
 /* Only used in br_device.c */
 static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
index 6b80ebc37667982942cf9fb0ddd166c2b85b84af..93f80fefa496f862eb12d6bb82af285d9e9e3e1f 100644 (file)
@@ -745,7 +745,7 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb,
 static int br_nf_dev_queue_xmit(struct sk_buff *skb)
 {
        if (skb->nfct != NULL && skb->protocol == htons(ETH_P_IP) &&
-           skb->len > skb->dev->mtu &&
+           skb->len + nf_bridge_mtu_reduction(skb) > skb->dev->mtu &&
            !skb_is_gso(skb))
                return ip_fragment(skb, br_dev_queue_push_xmit);
        else
index b0b2e3059f1150817bdddba024b54ff34b1012c3..d979710684b24b28b6e2cd232e0cff6f7661f7e4 100644 (file)
@@ -469,6 +469,10 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 
        hlen = iph->ihl * 4;
        mtu = dst_mtu(&rt->u.dst) - hlen;       /* Size of data space */
+#ifdef CONFIG_BRIDGE_NETFILTER
+       if (skb->nf_bridge)
+               mtu -= nf_bridge_mtu_reduction(skb);
+#endif
        IPCB(skb)->flags |= IPSKB_FRAG_COMPLETE;
 
        /* When frag_list is given, use it. First, check its validity: