[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    =?UTF-8?B?W1BhdGNoXSBGaXggcGluZyBhY2NlcHRpbmcgb25seSBzYW1lIHNpemVkIHBh?= =?UTF-8?B?Y2tldHM=?=
From:       Миша Завёрткин <misha.zavertkin () mail ! ru>
Date:       2024-04-17 10:34:52
Message-ID: 1713350091.66360385 () f457 ! i ! mail ! ru
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]


Now ping expects response packets same size as sent. But 8.8.8.8 limit packet size. \
This makes «ping -s 89 8.8.8.8» to fail  
The patch removes datalen from discarding short packages and makes calculating header \
length correct  
diff --git a/networking/ping.c b/networking/ping.c
index b7e6955a9..ecf9c569e 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -696,7 +696,7 @@ static int unpack4(char *buf, int sz, struct sockaddr_in *from)
     int hlen;
 
     /* discard if too short */
-    if (sz < (datalen + ICMP_MINLEN))
+    if (sz < (sizeof(struct iphdr) + ICMP_MINLEN))
         return 0;
 
     /* check IP header */
@@ -732,7 +732,7 @@ static int unpack6(char *packet, int sz, struct sockaddr_in6 \
*from, int hoplimit  char buf[INET6_ADDRSTRLEN];
 
     /* discard if too short */
-    if (sz < (datalen + sizeof(struct icmp6_hdr)))
+    if (sz < sizeof(struct icmp6_hdr))
         return 0;
 
     icmppkt = (struct icmp6_hdr *) packet;
 
 
 


[Attachment #5 (text/html)]


<HTML><BODY><div class="js-helper js-readmsg-msg"><div \
id="style_17110083330068374109_BODY"><div class="cl_360781"><div><div>Now ping \
expects response packets same size as sent. But 8.8.8.8 limit packet size. This makes \
«ping -s 89 8.8.8.8 »&nbsp;to fail</div><div>&nbsp;</div><div>The patch removes \
datalen from discarding short packages and makes calculating header length \
correct</div><div>&nbsp;</div><div>diff --git a/networking/ping.c \
b/networking/ping.c</div><div>index b7e6955a9..ecf9c569e 100644</div><div>--- \
a/networking/ping.c</div><div>+++ b/networking/ping.c</div><div>@@ -696,7 +696,7 @@ \
static int unpack4(char *buf, int sz, struct sockaddr_in \
*from)</div><div>&nbsp;&nbsp;&nbsp; &nbsp;int \
hlen;</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; &nbsp;/* discard if too short \
*/</div><div>-&nbsp;&nbsp; &nbsp;if (sz &lt; (datalen + \
ICMP_MINLEN))</div><div>+&nbsp;&nbsp; &nbsp;if (sz &lt; (sizeof(struct iphdr) + \
ICMP_MINLEN))</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return \
0;</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; &nbsp;/* check IP header \
*/</div><div>@@ -732,7 +732,7 @@ static int unpack6(char *packet, int sz, struct \
sockaddr_in6 *from, int hoplimit</div><div>&nbsp;&nbsp;&nbsp; &nbsp;char \
buf[INET6_ADDRSTRLEN];</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; &nbsp;/* discard \
if too short */</div><div>-&nbsp;&nbsp; &nbsp;if (sz &lt; (datalen + sizeof(struct \
icmp6_hdr)))</div><div>+&nbsp;&nbsp; &nbsp;if (sz &lt; sizeof(struct \
icmp6_hdr))</div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return \
0;</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp; &nbsp;icmppkt = (struct icmp6_hdr *) \
packet;</div></div><div>&nbsp;</div></div></div></div><div>&nbsp;<div>&nbsp;</div></div></BODY></HTML>




_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic