]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv6/ip6_output.c
ipv6: allow to send packet after receiving ICMPv6 Too Big message with MTU field...
[net-next-2.6.git] / net / ipv6 / ip6_output.c
index 1a5fe9ad1947945315404346daf5e2de97fbee12..75d5ef830097fc99cbd7e0ccd36452ff45a6f806 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/tcp.h>
 #include <linux/route.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 
 #include <linux/netfilter.h>
 #include <linux/netfilter_ipv6.h>
@@ -107,7 +108,7 @@ static int ip6_dev_loopback_xmit(struct sk_buff *newskb)
        newskb->ip_summed = CHECKSUM_UNNECESSARY;
        WARN_ON(!skb_dst(newskb));
 
-       netif_rx(newskb);
+       netif_rx_ni(newskb);
        return 0;
 }
 
@@ -402,6 +403,7 @@ int ip6_forward(struct sk_buff *skb)
        struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct inet6_skb_parm *opt = IP6CB(skb);
        struct net *net = dev_net(dst->dev);
+       u32 mtu;
 
        if (net->ipv6.devconf_all->forwarding == 0)
                goto error;
@@ -508,10 +510,14 @@ int ip6_forward(struct sk_buff *skb)
                }
        }
 
-       if (skb->len > dst_mtu(dst)) {
+       mtu = dst_mtu(dst);
+       if (mtu < IPV6_MIN_MTU)
+               mtu = IPV6_MIN_MTU;
+
+       if (skb->len > mtu) {
                /* Again, force OUTPUT device used as source address */
                skb->dev = dst->dev;
-               icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst));
+               icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
                IP6_INC_STATS_BH(net,
                                 ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS);
                IP6_INC_STATS_BH(net,
@@ -621,10 +627,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
        mtu = ip6_skb_dst_mtu(skb);
 
        /* We must not fragment if the socket is set to force MTU discovery
-        * or if the skb it not generated by a local socket.  (This last
-        * check should be redundant, but it's free.)
+        * or if the skb it not generated by a local socket.
         */
-       if (!skb->local_df) {
+       if (!skb->local_df && skb->len > mtu) {
                skb->dev = skb_dst(skb)->dev;
                icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
                IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),