diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-01-24 14:07:42 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-01-24 14:07:42 +0000 |
commit | 6a64d6b8cdd5afad793cae3b9408c853aa0e11d2 (patch) | |
tree | 9bd5757ccdea88313795be47f3ba919c8b1701e7 | |
parent | eb9ed2ef547cb7c44aab023f537ce9f041f534d1 (diff) |
Tell traceroute6 to choose source address based on correct routing
table.
From dhill, tweeks by me.
OK benno
-rw-r--r-- | usr.sbin/traceroute/traceroute.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index 093bedee6d8..6b0909fbd71 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.150 2017/01/13 18:00:10 florian Exp $ */ +/* $OpenBSD: traceroute.c,v 1.151 2017/01/24 14:07:41 florian Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /* @@ -330,7 +330,7 @@ main(int argc, char *argv[]) long l; uid_t ouid, uid; gid_t gid; - u_int rtableid; + u_int rtableid = 0; socklen_t len; rcvsock4 = rcvsock6 = sndsock4 = sndsock6 = -1; @@ -772,6 +772,10 @@ main(int argc, char *argv[]) nxt.sin6_port = htons(DUMMY_PORT); if ((dummy = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) err(1, "socket"); + if (rtableid > 0 && + setsockopt(dummy, SOL_SOCKET, SO_RTABLE, &rtableid, + sizeof(rtableid)) < 0) + err(1, "setsockopt(SO_RTABLE)"); if (connect(dummy, (struct sockaddr *)&nxt, nxt.sin6_len) < 0) err(1, "connect"); |