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
This commit is contained in:
asomers 2019-08-13 16:22:43 +00:00
parent c2eb452161
commit 433fadf2ac

View File

@ -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;