diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-10-26 21:21:46 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-10-26 21:21:46 +0000 |
commit | 83a0e50d6b854ee8bb9ee67210f462726ac7603d (patch) | |
tree | 5355879ce372f47f0861d168e1982918526f7b76 /usr.sbin/traceroute6 | |
parent | 3fe9d7b7f62c361ff4db970aebd99e696fbf00ef (diff) |
Only use setsockopt(..SO_RTABLE..) if an alternative rtable is specified
on the command line, this repairs traceroute6 if the -V flag is not given.
ok matthieu@ deraadt@
(Note that traceroute6's source address selection is not yet rdomain-aware,
for now to use another domain with "traceroute -V" requires manually setting
the source address with -s.)
Diffstat (limited to 'usr.sbin/traceroute6')
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 43a9dfadf6d..9123262fd07 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute6.c,v 1.50 2013/10/21 08:47:10 phessler Exp $ */ +/* $OpenBSD: traceroute6.c,v 1.51 2013/10/26 21:21:45 sthen Exp $ */ /* $KAME: traceroute6.c,v 1.63 2002/10/24 12:53:25 itojun Exp $ */ /* @@ -344,7 +344,7 @@ main(int argc, char *argv[]) struct hostent *hp; size_t size; uid_t uid; - u_int rtableid; + int rtableid = -1; const char *errstr; /* @@ -487,7 +487,7 @@ main(int argc, char *argv[]) verbose++; break; case 'V': - rtableid = (unsigned int)strtonum(optarg, 0, + rtableid = (int)strtonum(optarg, 0, RT_TABLEID_MAX, &errstr); if (errstr) errx(1, "rtable value is %s: %s", @@ -625,7 +625,7 @@ main(int argc, char *argv[]) perror("socket(SOCK_DGRAM)"); exit(5); } - if (setsockopt(sndsock, SOL_SOCKET, SO_RTABLE, + if (rtableid >= 0 && setsockopt(sndsock, SOL_SOCKET, SO_RTABLE, &rtableid, sizeof(rtableid)) == -1) err(1, "setsockopt SO_RTABLE"); } |