summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2015-09-01 19:53:23 +0000
committerflorian <florian@openbsd.org>2015-09-01 19:53:23 +0000
commit3872913e37b5757060806bfa2c5ce94eafe16d80 (patch)
treee5770a857843719febef666289d0ebe3807d7d40
parentTweak some error messages/comments. (diff)
downloadwireguard-openbsd-3872913e37b5757060806bfa2c5ce94eafe16d80.tar.xz
wireguard-openbsd-3872913e37b5757060806bfa2c5ce94eafe16d80.zip
Display the correct source address when using a non-default routing
table. Problem reported on bugs@ and diff from phil AT unita.com.au, thanks! OK phessler
-rw-r--r--sbin/ping6/ping6.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index 16474bf51a3..90ac4eb1ae6 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping6.c,v 1.111 2015/08/31 16:42:33 florian Exp $ */
+/* $OpenBSD: ping6.c,v 1.112 2015/09/01 19:53:23 florian Exp $ */
/* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */
/*
@@ -263,7 +263,7 @@ main(int argc, char *argv[])
double intval;
int mflag = 0;
uid_t uid;
- u_int rtableid;
+ u_int rtableid = 0;
if ((s = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
err(1, "socket");
@@ -710,6 +710,11 @@ main(int argc, char *argv[])
(void *)&hoplimit, sizeof(hoplimit)))
err(1, "UDP setsockopt(IPV6_MULTICAST_HOPS)");
+ if (rtableid > 0 &&
+ setsockopt(dummy, SOL_SOCKET, SO_RTABLE, &rtableid,
+ sizeof(rtableid)) < 0)
+ err(1, "setsockopt(SO_RTABLE)");
+
if (connect(dummy, (struct sockaddr *)&src, len) < 0)
err(1, "UDP connect");