1 --- a/networking/ping.c
2 +++ b/networking/ping.c
3 @@ -79,6 +79,7 @@ static int in_cksum(unsigned short *buf,
7 +static unsigned datalen = DEFDATALEN;
9 static void noresp(int ign UNUSED_PARAM)
11 @@ -91,7 +92,7 @@ static void ping4(len_and_sockaddr *lsa)
12 struct sockaddr_in pingaddr;
15 - char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
16 + char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
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));
24 - c = xsendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN,
25 + c = xsendto(pingsock, packet, datalen + ICMP_MINLEN,
26 (struct sockaddr *) &pingaddr, sizeof(pingaddr));
28 /* listen for replies */
29 @@ -135,7 +136,7 @@ static void ping6(len_and_sockaddr *lsa)
30 struct icmp6_hdr *pkt;
33 - char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
34 + char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
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));
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));
46 /* listen for replies */