aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-10-01 03:07:22 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2020-10-01 03:07:22 +0200
commit4a0eb0370c4df8ee01973b50bb460560532b79f1 (patch)
treece2324f97b05ae50355961d47dea6cd003a4fc05 /networking
parentaaa0709e7b39d0dc22ac92443a86c84eaff58679 (diff)
downloadbusybox-4a0eb0370c4df8ee01973b50bb460560532b79f1.tar.gz
gcc-9.x warning fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/ping.c4
-rw-r--r--networking/traceroute.c2
-rw-r--r--networking/udhcp/d6_dhcpc.c2
-rw-r--r--networking/udhcp/d6_packet.c2
-rw-r--r--networking/udhcp/dhcpc.c4
-rw-r--r--networking/udhcp/packet.c4
6 files changed, 9 insertions, 9 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 47b6ab1b2..5f7e5b9b5 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -217,7 +217,7 @@ static void ping4(len_and_sockaddr *lsa)
/*memset(pkt, 0, sizeof(G.packet)); already is */
pkt->icmp_type = ICMP_ECHO;
pkt->icmp_id = G.myid;
- pkt->icmp_cksum = inet_cksum((uint16_t *) pkt, sizeof(G.packet));
+ pkt->icmp_cksum = inet_cksum(pkt, sizeof(G.packet));
xsendto(pingsock, G.packet, DEFDATALEN + ICMP_MINLEN, &lsa->u.sa, lsa->len);
@@ -529,7 +529,7 @@ static void sendping4(int junk UNUSED_PARAM)
/* No hton: we'll read it back on the same machine */
*(uint32_t*)&pkt->icmp_dun = G.cur_us = monotonic_us();
- pkt->icmp_cksum = inet_cksum((uint16_t *) pkt, datalen + ICMP_MINLEN);
+ pkt->icmp_cksum = inet_cksum(pkt, datalen + ICMP_MINLEN);
sendping_tail(sendping4, ICMP_MINLEN);
}
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 5068f654b..1c4dc3e4a 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -468,7 +468,7 @@ send_probe(int seq, int ttl)
/* Always calculate checksum for icmp packets */
outicmp->icmp_cksum = 0;
outicmp->icmp_cksum = inet_cksum(
- (uint16_t *)outicmp,
+ outicmp,
((char*)outip + packlen) - (char*)outicmp
);
if (outicmp->icmp_cksum == 0)
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index fc2d672b7..ac8af91d3 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -947,7 +947,7 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6, struct d6_pac
// packet.ip.tot_len = packet.udp.len; /* yes, this is needed */
// check = packet.udp.check;
// packet.udp.check = 0;
-// if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
+// if (check && check != inet_cksum(&packet, bytes)) {
// log1("packet with bad UDP checksum received, ignoring");
// return -2;
// }
diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c
index 446497e15..167a813e3 100644
--- a/networking/udhcp/d6_packet.c
+++ b/networking/udhcp/d6_packet.c
@@ -103,7 +103,7 @@ int FAST_FUNC d6_send_raw_packet(
*/
packet.ip6.ip6_hlim = IPPROTO_UDP;
packet.udp.check = inet_cksum(
- (uint16_t *)&packet + 2,
+ (uint8_t *)&packet + 4,
offsetof(struct ip6_udp_d6_packet, data) - 4 + d6_pkt_size
);
/* fix 'hop limit' and 'next header' after UDP checksumming */
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index e13eb3f9f..66aa38c20 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -935,7 +935,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
/* verify IP checksum */
check = packet.ip.check;
packet.ip.check = 0;
- if (check != inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip))) {
+ if (check != inet_cksum(&packet.ip, sizeof(packet.ip))) {
log1s("bad IP header checksum, ignoring");
return -2;
}
@@ -960,7 +960,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
packet.ip.tot_len = packet.udp.len; /* yes, this is needed */
check = packet.udp.check;
packet.udp.check = 0;
- if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
+ if (check && check != inet_cksum(&packet, bytes)) {
log1s("packet with bad UDP checksum received, ignoring");
return -2;
}
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 6d4375237..51374646d 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -164,14 +164,14 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
packet.udp.len = htons(UDP_DHCP_SIZE - padding);
/* for UDP checksumming, ip.len is set to UDP packet len */
packet.ip.tot_len = packet.udp.len;
- packet.udp.check = inet_cksum((uint16_t *)&packet,
+ packet.udp.check = inet_cksum(&packet,
IP_UDP_DHCP_SIZE - padding);
/* but for sending, it is set to IP packet len */
packet.ip.tot_len = htons(IP_UDP_DHCP_SIZE - padding);
packet.ip.ihl = sizeof(packet.ip) >> 2;
packet.ip.version = IPVERSION;
packet.ip.ttl = IPDEFTTL;
- packet.ip.check = inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip));
+ packet.ip.check = inet_cksum(&packet.ip, sizeof(packet.ip));
udhcp_dump_packet(dhcp_pkt);
result = sendto(fd, &packet, IP_UDP_DHCP_SIZE - padding, /*flags:*/ 0,