Root/package/busybox/patches/460-truncated_ping_results.patch

1--- a/networking/ping.c
2+++ b/networking/ping.c
3@@ -79,6 +79,7 @@ static int in_cksum(unsigned short *buf,
4 /* simple version */
5 
6 static char *hostname;
7+static unsigned datalen = DEFDATALEN;
8 
9 static void noresp(int ign UNUSED_PARAM)
10 {
11@@ -91,7 +92,7 @@ static void ping4(len_and_sockaddr *lsa)
12     struct sockaddr_in pingaddr;
13     struct icmp *pkt;
14     int pingsock, c;
15- char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
16+ char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
17 
18     pingsock = create_icmp_socket();
19     pingaddr = lsa->u.sin;
20@@ -101,7 +102,7 @@ static void ping4(len_and_sockaddr *lsa)
21     pkt->icmp_type = ICMP_ECHO;
22     pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
23 
24- c = xsendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN,
25+ c = xsendto(pingsock, packet, datalen + ICMP_MINLEN,
26                (struct sockaddr *) &pingaddr, sizeof(pingaddr));
27 
28     /* listen for replies */
29@@ -135,7 +136,7 @@ static void ping6(len_and_sockaddr *lsa)
30     struct icmp6_hdr *pkt;
31     int pingsock, c;
32     int sockopt;
33- char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
34+ char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
35 
36     pingsock = create_icmp6_socket();
37     pingaddr = lsa->u.sin6;
38@@ -147,7 +148,7 @@ static void ping6(len_and_sockaddr *lsa)
39     sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
40     setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
41 
42- c = xsendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr),
43+ c = xsendto(pingsock, packet, datalen + sizeof (struct icmp6_hdr),
44                (struct sockaddr *) &pingaddr, sizeof(pingaddr));
45 
46     /* listen for replies */
47

Archive Download this file



interactive