X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=networking%2Fping6.c;h=767aafd2a91b76eb1b791d0e7def276e6005cc8d;hb=59fe8b90890a07c87ec9c2943bae515d5c6d959d;hp=4e55081fba5fc4acdcf6eccead428975529e2c60;hpb=06adf5fb47e7b9847e066d7675f0bc9f35bcc5be;p=oweals%2Fbusybox.git diff --git a/networking/ping6.c b/networking/ping6.c index 4e55081fb..767aafd2a 100644 --- a/networking/ping6.c +++ b/networking/ping6.c @@ -5,19 +5,7 @@ * * Copyright (C) 1999 by Randolph Chung * - * 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: @@ -37,7 +25,6 @@ #include #include #include -#include #include #include @@ -111,7 +98,7 @@ static void ping(const char *host) 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)) @@ -204,7 +191,7 @@ static void sendping(int junk) { struct icmp6_hdr *pkt; int i; - char packet[datalen + 8]; + char packet[datalen + sizeof (struct icmp6_hdr)]; pkt = (struct icmp6_hdr *) packet; @@ -312,7 +299,7 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit 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, @@ -352,12 +339,6 @@ static void ping(const char *host) 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); @@ -393,7 +374,7 @@ static void ping(const char *host) 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);