]> err.no Git - linux-2.6/blobdiff - net/ipv4/icmp.c
tcp: TCP connection times out if ICMP frag needed is delayed
[linux-2.6] / net / ipv4 / icmp.c
index efc7cbe759c9785f6e7939d3269732701835fb7f..87397351ddace424de5f0341482b408cdfaaf363 100644 (file)
@@ -578,7 +578,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
                }
 
                if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET))
-                       goto ende;
+                       goto relookup_failed;
 
                if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL)
                        err = __ip_route_output_key(net, &rt2, &fl);
@@ -588,7 +588,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
 
                        fl2.fl4_dst = fl.fl4_src;
                        if (ip_route_output_key(net, &rt2, &fl2))
-                               goto ende;
+                               goto relookup_failed;
 
                        /* Ugh! */
                        odst = skb_in->dst;
@@ -601,21 +601,23 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
                }
 
                if (err)
-                       goto ende;
+                       goto relookup_failed;
 
                err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL,
                                  XFRM_LOOKUP_ICMP);
-               if (err == -ENOENT) {
+               switch (err) {
+               case 0:
+                       dst_release(&rt->u.dst);
+                       rt = rt2;
+                       break;
+               case -EPERM:
+                       goto ende;
+               default:
+relookup_failed:
                        if (!rt)
                                goto out_unlock;
-                       goto route_done;
+                       break;
                }
-
-               dst_release(&rt->u.dst);
-               rt = rt2;
-
-               if (err)
-                       goto out_unlock;
        }
 
 route_done:
@@ -683,19 +685,20 @@ static void icmp_unreach(struct sk_buff *skb)
                        break;
                case ICMP_FRAG_NEEDED:
                        if (ipv4_config.no_pmtu_disc) {
-                               LIMIT_NETDEBUG(KERN_INFO "ICMP: %u.%u.%u.%u: "
+                               LIMIT_NETDEBUG(KERN_INFO "ICMP: " NIPQUAD_FMT ": "
                                                         "fragmentation needed "
                                                         "and DF set.\n",
                                               NIPQUAD(iph->daddr));
                        } else {
                                info = ip_rt_frag_needed(net, iph,
-                                                    ntohs(icmph->un.frag.mtu));
+                                                        ntohs(icmph->un.frag.mtu),
+                                                        skb->dev);
                                if (!info)
                                        goto out;
                        }
                        break;
                case ICMP_SR_FAILED:
-                       LIMIT_NETDEBUG(KERN_INFO "ICMP: %u.%u.%u.%u: Source "
+                       LIMIT_NETDEBUG(KERN_INFO "ICMP: " NIPQUAD_FMT ": Source "
                                                 "Route Failed.\n",
                                       NIPQUAD(iph->daddr));
                        break;
@@ -728,9 +731,9 @@ static void icmp_unreach(struct sk_buff *skb)
        if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses &&
            inet_addr_type(net, iph->daddr) == RTN_BROADCAST) {
                if (net_ratelimit())
-                       printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP "
+                       printk(KERN_WARNING NIPQUAD_FMT " sent an invalid ICMP "
                                            "type %u, code %u "
-                                           "error to a broadcast: %u.%u.%u.%u on %s\n",
+                                           "error to a broadcast: " NIPQUAD_FMT " on %s\n",
                               NIPQUAD(ip_hdr(skb)->saddr),
                               icmph->type, icmph->code,
                               NIPQUAD(iph->daddr),
@@ -845,7 +848,7 @@ static void icmp_echo(struct sk_buff *skb)
  */
 static void icmp_timestamp(struct sk_buff *skb)
 {
-       struct timeval tv;
+       struct timespec tv;
        struct icmp_bxm icmp_param;
        /*
         *      Too short.
@@ -856,9 +859,9 @@ static void icmp_timestamp(struct sk_buff *skb)
        /*
         *      Fill in the current time as ms since midnight UT:
         */
-       do_gettimeofday(&tv);
-       icmp_param.data.times[1] = htonl((tv.tv_sec % 86400) * 1000 +
-                                        tv.tv_usec / 1000);
+       getnstimeofday(&tv);
+       icmp_param.data.times[1] = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC +
+                                        tv.tv_nsec / NSEC_PER_MSEC);
        icmp_param.data.times[2] = icmp_param.data.times[1];
        if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
                BUG();
@@ -951,8 +954,8 @@ static void icmp_address_reply(struct sk_buff *skb)
                                break;
                }
                if (!ifa && net_ratelimit()) {
-                       printk(KERN_INFO "Wrong address mask %u.%u.%u.%u from "
-                                        "%s/%u.%u.%u.%u\n",
+                       printk(KERN_INFO "Wrong address mask " NIPQUAD_FMT " from "
+                                        "%s/" NIPQUAD_FMT "\n",
                               NIPQUAD(*mp), dev->name, NIPQUAD(rt->rt_src));
                }
        }
@@ -1142,7 +1145,7 @@ static void __net_exit icmp_sk_exit(struct net *net)
        net->ipv4.icmp_sk = NULL;
 }
 
-int __net_init icmp_sk_init(struct net *net)
+static int __net_init icmp_sk_init(struct net *net)
 {
        int i, err;