git: 400ce6248be9 - main - fibs_multibind_test: Explicitly cast the checksum value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 08 Feb 2025 16:05:46 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=400ce6248be986d52b3944c1ed01db3b26243454
commit 400ce6248be986d52b3944c1ed01db3b26243454
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-02-08 14:42:49 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-02-08 16:05:37 +0000
fibs_multibind_test: Explicitly cast the checksum value
Otherwise gcc warns about the (intentionall) truncated value and raises
an error.
Fixes: 7034563f8ef3 ("tests: Add some FIB multibind test cases")
---
tests/sys/netinet/fibs_multibind_test.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/sys/netinet/fibs_multibind_test.c b/tests/sys/netinet/fibs_multibind_test.c
index c62e8abdf81b..61ebf83c56ef 100644
--- a/tests/sys/netinet/fibs_multibind_test.c
+++ b/tests/sys/netinet/fibs_multibind_test.c
@@ -418,7 +418,7 @@ ping(int s, const struct sockaddr *sa, socklen_t salen)
memset(&icmp, 0, sizeof(icmp));
icmp.icmp.icmp_type = ICMP_ECHO;
icmp.icmp.icmp_code = 0;
- icmp.icmp.icmp_cksum = htons(~(ICMP_ECHO << 8));
+ icmp.icmp.icmp_cksum = htons((unsigned short)~(ICMP_ECHO << 8));
n = sendto(s, &icmp, sizeof(icmp), 0, sa, salen);
ATF_REQUIRE_MSG(n == (ssize_t)sizeof(icmp), "sendto failed: %s",
strerror(errno));
@@ -438,7 +438,8 @@ ping6(int s, const struct sockaddr *sa, socklen_t salen)
memset(&icmp6, 0, sizeof(icmp6));
icmp6.icmp6.icmp6_type = ICMP6_ECHO_REQUEST;
icmp6.icmp6.icmp6_code = 0;
- icmp6.icmp6.icmp6_cksum = htons(~(ICMP6_ECHO_REQUEST << 8));
+ icmp6.icmp6.icmp6_cksum =
+ htons((unsigned short)~(ICMP6_ECHO_REQUEST << 8));
n = sendto(s, &icmp6, sizeof(icmp6), 0, sa, salen);
ATF_REQUIRE_MSG(n == (ssize_t)sizeof(icmp6), "sendto failed: %s",
strerror(errno));