Index: usr.sbin/traceroute6/traceroute6.c =================================================================== --- usr.sbin/traceroute6/traceroute6.c +++ usr.sbin/traceroute6/traceroute6.c @@ -578,8 +578,6 @@ */ switch (useproto) { case IPPROTO_ICMPV6: - sndsock = rcvsock; - break; case IPPROTO_NONE: case IPPROTO_SCTP: case IPPROTO_TCP: @@ -928,18 +926,23 @@ * namespaces (e.g filesystem) is restricted (see capsicum(4)). * We must connect(2) our socket before this point. */ - - if (caph_enter_casper() < 0) { - fprintf(stderr, "caph_enter_casper: %s\n", strerror(errno)); - exit(1); - } - cap_rights_init(&rights, CAP_SEND, CAP_SETSOCKOPT); if (caph_rights_limit(sndsock, &rights) < 0) { fprintf(stderr, "caph_rights_limit sndsock: %s\n", strerror(errno)); exit(1); } + cap_rights_init(&rights, CAP_RECV); + if (caph_rights_limit(rcvsock, &rights) < 0) { + fprintf(stderr, "caph_rights_limit sndsock: %s\n", + strerror(errno)); + exit(1); + } + + if (caph_enter_casper() < 0) { + fprintf(stderr, "caph_enter_casper: %s\n", strerror(errno)); + exit(1); + } /* * Main loop