summaryrefslogtreecommitdiff
path: root/networking/ping6.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-22 14:12:08 +0000
committerDenis Vlasenko2007-01-22 14:12:08 +0000
commit703e20235aa0624d3ff4335c1e86edaa6e21efe2 (patch)
tree49e8451efad93b75c0be74ee553d3b3f8c04a25d /networking/ping6.c
parent6cd2d2bcba37a13d0d73326dd7bca64bbccce4f8 (diff)
downloadbusybox-703e20235aa0624d3ff4335c1e86edaa6e21efe2.zip
busybox-703e20235aa0624d3ff4335c1e86edaa6e21efe2.tar.gz
cleanups: unnecessary casts, unified const_1, eliminate cross-.c file
prototypes (heresy!), add spaces in places like "flags&NETSTAT_CONNECTED", removed unused #defines, #ifdef -> #if, use uint32_t for ipv4 addrs.
Diffstat (limited to 'networking/ping6.c')
-rw-r--r--networking/ping6.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/networking/ping6.c b/networking/ping6.c
index dec3b42..a92387e 100644
--- a/networking/ping6.c
+++ b/networking/ping6.c
@@ -77,8 +77,7 @@ static void ping(const char *host)
pkt->icmp6_type = ICMP6_ECHO_REQUEST;
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
- setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
- sizeof(sockopt));
+ setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0,
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6));
@@ -312,6 +311,7 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit
fflush(stdout);
}
+extern int BUG_bad_offsetof_icmp6_cksum(void);
static void ping(const char *host)
{
char packet[datalen + MAXIPLEN + MAXICMPLEN];
@@ -353,18 +353,15 @@ static void ping(const char *host)
/* set recv buf for broadcast pings */
sockopt = 48 * 1024; /* explain why 48k? */
- setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, (char *) &sockopt,
- sizeof(sockopt));
+ setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt));
- sockopt = 2; /* iputils-ss020927 does this */
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
- setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
- sizeof(sockopt));
+ if (offsetof(struct icmp6_hdr, icmp6_cksum) != 2)
+ BUG_bad_offsetof_icmp6_cksum();
+ setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
/* request ttl info to be returned in ancillary data */
- sockopt = 1;
- setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, (char *) &sockopt,
- sizeof(sockopt));
+ setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, &const_int_1, sizeof(const_int_1));
if (if_index)
pingaddr.sin6_scope_id = if_index;