pkt->icmp_type = ICMP_ECHO;
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));
if (c < 0 || c != sizeof(packet))
{
struct icmp *pkt;
int i;
- char packet[datalen + sizeof(struct icmp)];
+ char packet[datalen + ICMP_MINLEN];
pkt = (struct icmp *) packet;
setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &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));
if (c < 0 || c != sizeof(packet))
{
struct icmp6_hdr *pkt;
int i;
- char packet[datalen + 8];
+ char packet[datalen + sizeof (struct icmp6_hdr)];
pkt = (struct icmp6_hdr *) packet;