summaryrefslogtreecommitdiff
path: root/sbin/ping6/ping6.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-06-08 13:58:22 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-06-08 13:58:22 +0000
commitcfb7a7be9f4d822e385e260998e7e97bb3cc7b73 (patch)
treee21febbe2f21a91e0002e46b619b94c47cfa4875 /sbin/ping6/ping6.c
parent45c45fb593ea38f7b4ae687117f044398765ca17 (diff)
make sure to clear ni_flags on ping6 -w.
Diffstat (limited to 'sbin/ping6/ping6.c')
-rw-r--r--sbin/ping6/ping6.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index a09efa05116..7c03a18aaa1 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping6.c,v 1.5 2000/03/23 11:26:18 hugh Exp $ */
+/* $OpenBSD: ping6.c,v 1.6 2000/06/08 13:58:21 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -944,6 +944,7 @@ pinger()
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 */
@@ -956,7 +957,8 @@ pinger()
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);
@@ -966,7 +968,9 @@ pinger()
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);