mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
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
This commit is contained in:
parent
b0c5445bf5
commit
07a637df47
@ -108,7 +108,7 @@ static void ping(const char *host)
|
|||||||
pkt->icmp_type = ICMP_ECHO;
|
pkt->icmp_type = ICMP_ECHO;
|
||||||
pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
|
pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
|
||||||
|
|
||||||
c = sendto(pingsock, packet, sizeof(packet), 0,
|
c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
|
||||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
if (c < 0 || c != sizeof(packet))
|
if (c < 0 || c != sizeof(packet))
|
||||||
@ -202,7 +202,7 @@ static void sendping(int junk)
|
|||||||
{
|
{
|
||||||
struct icmp *pkt;
|
struct icmp *pkt;
|
||||||
int i;
|
int i;
|
||||||
char packet[datalen + sizeof(struct icmp)];
|
char packet[datalen + ICMP_MINLEN];
|
||||||
|
|
||||||
pkt = (struct icmp *) packet;
|
pkt = (struct icmp *) packet;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ static void ping(const char *host)
|
|||||||
setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
|
setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
|
||||||
sizeof(sockopt));
|
sizeof(sockopt));
|
||||||
|
|
||||||
c = sendto(pingsock, packet, sizeof(packet), 0,
|
c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0,
|
||||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6));
|
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6));
|
||||||
|
|
||||||
if (c < 0 || c != sizeof(packet))
|
if (c < 0 || c != sizeof(packet))
|
||||||
@ -204,7 +204,7 @@ static void sendping(int junk)
|
|||||||
{
|
{
|
||||||
struct icmp6_hdr *pkt;
|
struct icmp6_hdr *pkt;
|
||||||
int i;
|
int i;
|
||||||
char packet[datalen + 8];
|
char packet[datalen + sizeof (struct icmp6_hdr)];
|
||||||
|
|
||||||
pkt = (struct icmp6_hdr *) packet;
|
pkt = (struct icmp6_hdr *) packet;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user