*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* This version of ping is adapted from the ping in netkit-base 0.10,
* which is:
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/file.h>
-#include <sys/time.h>
#include <sys/times.h>
#include <signal.h>
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;
return;
printf("%d bytes from %s: icmp6_seq=%u", sz,
- inet_ntop(AF_INET6, (struct in_addr6 *) &pingaddr.sin6_addr,
+ inet_ntop(AF_INET6, &pingaddr.sin6_addr,
buf, sizeof(buf)),
icmppkt->icmp6_seq);
printf(" ttl=%d time=%lu.%lu ms", hoplimit,
struct icmp6_filter filt;
if (!(options & O_VERBOSE)) {
ICMP6_FILTER_SETBLOCKALL(&filt);
-#if 0
- if ((options & F_FQDN) || (options & F_FQDNOLD) ||
- (options & F_NODEADDR) || (options & F_SUPTYPES))
- ICMP6_FILTER_SETPASS(ICMP6_NI_REPLY, &filt);
- else
-#endif
ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filt);
} else {
ICMP6_FILTER_SETPASSALL(&filt);
printf("PING %s (%s): %d data bytes\n",
hostent->h_name,
- inet_ntop(AF_INET6, (struct in_addr6 *) &pingaddr.sin6_addr,
+ inet_ntop(AF_INET6, &pingaddr.sin6_addr,
buf, sizeof(buf)),
datalen);