Source-Changes-HG archive

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

[src/trunk]: src/sbin/ping6 make sure to clear ni_flags field on -w.



details:   https://anonhg.NetBSD.org/src/rev/d06dd2a789b9
branches:  trunk
changeset: 487486:d06dd2a789b9
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Jun 08 13:56:22 2000 +0000

description:
make sure to clear ni_flags field on -w.

diffstat:

 sbin/ping6/ping6.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 63b5440dc7a4 -r d06dd2a789b9 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Thu Jun 08 13:55:46 2000 +0000
+++ b/sbin/ping6/ping6.c        Thu Jun 08 13:56:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping6.c,v 1.13 2000/02/28 13:50:04 itojun Exp $        */
+/*     $NetBSD: ping6.c,v 1.14 2000/06/08 13:56:22 itojun Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -80,7 +80,7 @@
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.13 2000/02/28 13:50:04 itojun Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.14 2000/06/08 13:56:22 itojun Exp $");
 #endif
 #endif
 
@@ -936,6 +936,7 @@
        int i, cc;
 
        icp = (struct icmp6_hdr *)outpack;
+       memset(icp, 0, sizeof(*icp));
        icp->icmp6_code = 0;
        icp->icmp6_cksum = 0;
        icp->icmp6_seq = ntransmitted++;                /* htons later */
@@ -948,7 +949,8 @@
                icp->icmp6_type = ICMP6_NI_QUERY;
                /* code field is always 0 */
                /* XXX: overwrite icmp6_id */
-               icp->icmp6_data16[0] = htons(NI_QTYPE_FQDN);
+               ((struct icmp6_nodeinfo *)icp)->ni_qtype = htons(NI_QTYPE_FQDN);
+               ((struct icmp6_nodeinfo *)icp)->ni_flags = htons(0);
                if (timing)
                        (void)gettimeofday((struct timeval *)
                                           &outpack[ICMP6ECHOLEN], NULL);
@@ -958,7 +960,9 @@
                icp->icmp6_type = ICMP6_NI_QUERY;
                /* code field is always 0 */
                /* XXX: overwrite icmp6_id */
-               icp->icmp6_data16[0] = htons(NI_QTYPE_NODEADDR);
+               ((struct icmp6_nodeinfo *)icp)->ni_qtype =
+                   htons(NI_QTYPE_NODEADDR);
+               ((struct icmp6_nodeinfo *)icp)->ni_flags = htons(0);
                if (timing)
                        (void)gettimeofday((struct timeval *)
                                           &outpack[ICMP6ECHOLEN], NULL);



Home | Main Index | Thread Index | Old Index