summaryrefslogtreecommitdiff
path: root/sbin/ping
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2016-09-17 09:30:27 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2016-09-17 09:30:27 +0000
commite1b11cec4b2f7fe3ccdd65f8ac6356f246164c89 (patch)
tree89768254dce19606a4d567f9204bb5bbbd35cd86 /sbin/ping
parent91992dc2e747ba5b513cbe9f2991d91690d4f49e (diff)
Introduce AF independent from.
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 0a37e4fdf81..fcff9d60551 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.195 2016/09/17 09:30:00 florian Exp $ */
+/* $OpenBSD: ping.c,v 1.196 2016/09/17 09:30:26 florian Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -224,7 +224,7 @@ main(int argc, char *argv[])
{
struct addrinfo hints, *res;
struct itimerval itimer;
- struct sockaddr *dst;
+ struct sockaddr *from, *dst;
struct sockaddr_in from4, dst4;
socklen_t maxsizelen;
int64_t preload;
@@ -409,6 +409,7 @@ main(int argc, char *argv[])
if (res->ai_addrlen != sizeof(dst4))
errx(1, "size of sockaddr mismatch");
dst = (struct sockaddr *)&dst4;
+ from = (struct sockaddr *)&from4;
break;
case AF_INET6:
default:
@@ -612,8 +613,7 @@ main(int argc, char *argv[])
printf("PING %s (", hostname);
if (0 && (options & F_VERBOSE))
- printf("%s --> ", pr_addr((struct sockaddr *)&from4,
- sizeof(from4)));
+ printf("%s --> ", pr_addr(from, from->sa_len));
printf("%s): %d data bytes\n", pr_addr(dst, dst->sa_len), datalen);
smsghdr.msg_name = dst;