version 1.141, 2015/11/01 01:05:31 |
version 1.142, 2015/11/12 20:33:52 |
|
|
argv += optind; |
argv += optind; |
|
|
if (rtableid >= 0) { |
if (rtableid >= 0) { |
/* |
if (setrtable(rtableid) == -1) |
* XXX No pledge if doing rtable manipulation! |
err(1, "setrtable"); |
* XXX the routing table stuff is dangerous and can't be pledged. |
|
* XXX rtable should really have a better interface than sockopt |
|
*/ |
|
} |
} |
else if (family == AF_UNIX) { |
if (family == AF_UNIX) { |
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) |
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) |
err(1, "pledge"); |
err(1, "pledge"); |
} |
} |
|
|
SOCK_NONBLOCK, res0->ai_protocol)) < 0) |
SOCK_NONBLOCK, res0->ai_protocol)) < 0) |
continue; |
continue; |
|
|
if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, |
|
&rtableid, sizeof(rtableid)) == -1)) |
|
err(1, "setsockopt SO_RTABLE"); |
|
|
|
/* Bind to a local port or source address if specified. */ |
/* Bind to a local port or source address if specified. */ |
if (sflag || pflag) { |
if (sflag || pflag) { |
struct addrinfo ahints, *ares; |
struct addrinfo ahints, *ares; |
|
|
if ((s = socket(res0->ai_family, res0->ai_socktype, |
if ((s = socket(res0->ai_family, res0->ai_socktype, |
res0->ai_protocol)) < 0) |
res0->ai_protocol)) < 0) |
continue; |
continue; |
|
|
if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, |
|
&rtableid, sizeof(rtableid)) == -1)) |
|
err(1, "setsockopt SO_RTABLE"); |
|
|
|
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); |
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); |
if (ret == -1) |
if (ret == -1) |