hopefully fix ping bugs introduced in [6443]
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 4 Mar 2007 14:36:34 +0000 (14:36 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 4 Mar 2007 14:36:34 +0000 (14:36 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6505 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/busybox/patches/450-truncated_ping_results.patch

index 30e8670..f60a1a9 100644 (file)
@@ -5,7 +5,7 @@
        struct icmp *pkt;
        int pingsock, c;
 -      char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
        struct icmp *pkt;
        int pingsock, c;
 -      char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
-+      char packet[datalen + MAXIPLEN + MAXICMPLEN];
++      char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
  
        pingsock = create_icmp_socket();
  
  
        pingsock = create_icmp_socket();
  
                           (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
  
        if (c < 0) {
                           (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
  
        if (c < 0) {
-@@ -257,8 +257,8 @@
-       gettimeofday(&tv, NULL);
--      /* discard if too short */
--      if (sz < (datalen + ICMP_MINLEN))
-+      /* discard if too short / long */
-+      if (sz < (datalen + ICMP_MINLEN) || sz > (MAXICMPLEN))
-               return;
-       /* check IP header */
 @@ -274,6 +274,10 @@
                ++nreceived;
                tp = (struct timeval *) icmppkt->icmp_data;
 @@ -274,6 +274,10 @@
                ++nreceived;
                tp = (struct timeval *) icmppkt->icmp_data;