aboutsummaryrefslogtreecommitdiff
path: root/sbin/ping6
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2019-08-13 16:22:43 +0000
committerAlan Somers <asomers@FreeBSD.org>2019-08-13 16:22:43 +0000
commit354c349080db476ae286d39137e06af2c9815458 (patch)
treeefdbcf89062f56dbda2ead9ec9e2c3f78d35aec4 /sbin/ping6
parentdbee856affb7bf88124b61a6595ba39282c0ce43 (diff)
Consistently use the byteorder functions in the correct direction
Though ntohs and htons are functionally identical, they have different meanings.Using the correct one helps to document the code. Submitted by: Ján Sučan <sucanjan@gmail.com> MFC after: 2 weeks Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21219
Notes
Notes: svn path=/head/; revision=350993
Diffstat (limited to 'sbin/ping6')
-rw-r--r--sbin/ping6/ping6.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index dc303f0b8902..0c4b4aa4b61b 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -1324,7 +1324,7 @@ pinger(void)
memcpy(nip->icmp6_ni_nonce, nonce,
sizeof(nip->icmp6_ni_nonce));
- *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq);
+ *(u_int16_t *)nip->icmp6_ni_nonce = htons(seq);
memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr,
sizeof(dst.sin6_addr));
@@ -1339,7 +1339,7 @@ pinger(void)
memcpy(nip->icmp6_ni_nonce, nonce,
sizeof(nip->icmp6_ni_nonce));
- *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq);
+ *(u_int16_t *)nip->icmp6_ni_nonce = htons(seq);
cc = ICMP6_NIQLEN;
datalen = 0;
@@ -1351,7 +1351,7 @@ pinger(void)
memcpy(nip->icmp6_ni_nonce, nonce,
sizeof(nip->icmp6_ni_nonce));
- *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq);
+ *(u_int16_t *)nip->icmp6_ni_nonce = htons(seq);
memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr,
sizeof(dst.sin6_addr));
@@ -1366,14 +1366,14 @@ pinger(void)
memcpy(nip->icmp6_ni_nonce, nonce,
sizeof(nip->icmp6_ni_nonce));
- *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq);
+ *(u_int16_t *)nip->icmp6_ni_nonce = htons(seq);
cc = ICMP6_NIQLEN;
datalen = 0;
} else {
icp->icmp6_type = ICMP6_ECHO_REQUEST;
icp->icmp6_code = 0;
icp->icmp6_id = htons(ident);
- icp->icmp6_seq = ntohs(seq);
+ icp->icmp6_seq = htons(seq);
if (timing) {
struct timeval tv;
struct tv32 *tv32;