summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2015-09-01 19:53:24 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2015-09-01 19:53:24 +0000
commit6518bfc2799a968dce85f0c7b71dbf02b10dbc91 (patch)
tree4331b8fc0c703521a49a656539380bbe1b6f869d /sbin
parent8a29dae00168cbce656189384f82621ca8ab6310 (diff)
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
Diffstat (limited to 'sbin')
-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");