diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-01 17:28:11 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-01 17:28:11 +0000 |
commit | f161810e07c30c16a63fcaeed5f5f66d6ae0eb5c (patch) | |
tree | 3e25824c7d40b1aa4128605f8633e078e0d735ff | |
parent | 6c922ce0762a1fd6cbb999ac8c22862e0e992754 (diff) | |
download | busybox-w32-f161810e07c30c16a63fcaeed5f5f66d6ae0eb5c.tar.gz busybox-w32-f161810e07c30c16a63fcaeed5f5f66d6ae0eb5c.tar.bz2 busybox-w32-f161810e07c30c16a63fcaeed5f5f66d6ae0eb5c.zip |
Patch from KRONSTORFER Horst to Fix a size mismatch in ping, such as the 56/84
mismatch inthe following example:
# ping -c 1 172.16.2.1
PING 172.16.2.1 (172.16.2.1): 56 data bytes
84 bytes from 172.16.2.1: icmp_seq=0 ttl=64 time=0.2 ms
git-svn-id: svn://busybox.net/trunk/busybox@14722 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | networking/ping.c | 4 | ||||
-rw-r--r-- | networking/ping6.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/networking/ping.c b/networking/ping.c index d33cb358f..7fe52ab39 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -108,7 +108,7 @@ static void ping(const char *host) | |||
108 | pkt->icmp_type = ICMP_ECHO; | 108 | pkt->icmp_type = ICMP_ECHO; |
109 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); | 109 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); |
110 | 110 | ||
111 | c = sendto(pingsock, packet, sizeof(packet), 0, | 111 | c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0, |
112 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); | 112 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); |
113 | 113 | ||
114 | if (c < 0 || c != sizeof(packet)) | 114 | if (c < 0 || c != sizeof(packet)) |
@@ -202,7 +202,7 @@ static void sendping(int junk) | |||
202 | { | 202 | { |
203 | struct icmp *pkt; | 203 | struct icmp *pkt; |
204 | int i; | 204 | int i; |
205 | char packet[datalen + sizeof(struct icmp)]; | 205 | char packet[datalen + ICMP_MINLEN]; |
206 | 206 | ||
207 | pkt = (struct icmp *) packet; | 207 | pkt = (struct icmp *) packet; |
208 | 208 | ||
diff --git a/networking/ping6.c b/networking/ping6.c index 4e55081fb..3f632e060 100644 --- a/networking/ping6.c +++ b/networking/ping6.c | |||
@@ -111,7 +111,7 @@ static void ping(const char *host) | |||
111 | setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt, | 111 | setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt, |
112 | sizeof(sockopt)); | 112 | sizeof(sockopt)); |
113 | 113 | ||
114 | c = sendto(pingsock, packet, sizeof(packet), 0, | 114 | c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0, |
115 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6)); | 115 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6)); |
116 | 116 | ||
117 | if (c < 0 || c != sizeof(packet)) | 117 | if (c < 0 || c != sizeof(packet)) |
@@ -204,7 +204,7 @@ static void sendping(int junk) | |||
204 | { | 204 | { |
205 | struct icmp6_hdr *pkt; | 205 | struct icmp6_hdr *pkt; |
206 | int i; | 206 | int i; |
207 | char packet[datalen + 8]; | 207 | char packet[datalen + sizeof (struct icmp6_hdr)]; |
208 | 208 | ||
209 | pkt = (struct icmp6_hdr *) packet; | 209 | pkt = (struct icmp6_hdr *) packet; |
210 | 210 | ||