Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping6 should be using htons() to convert from a host by...



details:   https://anonhg.NetBSD.org/src/rev/feeb495b0986
branches:  trunk
changeset: 520384:feeb495b0986
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Wed Jan 09 12:30:15 2002 +0000

description:
should be using htons() to convert from a host byte order into a network
byte order, not ntohs().

diffstat:

 sbin/ping6/ping6.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r 634de9768f83 -r feeb495b0986 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Wed Jan 09 05:23:07 2002 +0000
+++ b/sbin/ping6/ping6.c        Wed Jan 09 12:30:15 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping6.c,v 1.38 2001/11/02 05:33:21 lukem Exp $ */
+/*     $NetBSD: ping6.c,v 1.39 2002/01/09 12:30:15 darrenr Exp $       */
 /*     $KAME: ping6.c,v 1.129 2001/06/22 13:16:02 itojun Exp $ */
 
 /*
@@ -81,7 +81,7 @@
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.38 2001/11/02 05:33:21 lukem Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.39 2002/01/09 12:30:15 darrenr Exp $");
 #endif
 #endif
 
@@ -1224,7 +1224,7 @@
 
                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));
@@ -1239,7 +1239,7 @@
 
                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;
@@ -1251,7 +1251,7 @@
 
                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));
@@ -1266,14 +1266,14 @@
 
                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)
                        (void)gettimeofday((struct timeval *)
                                           &outpack[ICMP6ECHOLEN], NULL);



Home | Main Index | Thread Index | Old Index