summaryrefslogtreecommitdiff
path: root/sbin/ping6
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2016-09-11 18:01:25 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2016-09-11 18:01:25 +0000
commit3eb459fb3b463b3952d5fa3e6bb74722541d132d (patch)
tree0606761b307de5a99a88cd94cd01f7095c0560d9 /sbin/ping6
parent04e96b772cc03b764d7d00274ec2f7dcac8790a4 (diff)
Move smsghdr initialization into main, another step towards AF
independent pinger().
Diffstat (limited to 'sbin/ping6')
-rw-r--r--sbin/ping6/ping6.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index 09eafdb2994..94db42b70aa 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping6.c,v 1.170 2016/09/11 17:59:12 florian Exp $ */
+/* $OpenBSD: ping6.c,v 1.171 2016/09/11 18:01:24 florian Exp $ */
/* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */
/*
@@ -630,6 +630,12 @@ main(int argc, char *argv[])
printf("%s): %d data bytes\n", pr_addr((struct sockaddr *)&dst,
sizeof(dst)), datalen);
+ smsghdr.msg_name = &dst;
+ smsghdr.msg_namelen = sizeof(dst);
+ smsgiov.iov_base = (caddr_t)outpack;
+ smsghdr.msg_iov = &smsgiov;
+ smsghdr.msg_iovlen = 1;
+
while (preload--) /* Fire off them quickies. */
pinger();
@@ -842,12 +848,7 @@ pinger(void)
}
cc = ICMP6ECHOLEN + datalen;
- smsghdr.msg_name = &dst;
- smsghdr.msg_namelen = sizeof(dst);
- smsgiov.iov_base = (caddr_t)outpack;
smsgiov.iov_len = cc;
- smsghdr.msg_iov = &smsgiov;
- smsghdr.msg_iovlen = 1;
i = sendmsg(s, &smsghdr, 0);