diff options
Diffstat (limited to 'src/usr.bin/nc/netcat.c')
-rw-r--r-- | src/usr.bin/nc/netcat.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 9e2b7e9eb7..8860bac824 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: netcat.c,v 1.141 2015/11/01 01:05:31 deraadt Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.142 2015/11/12 20:33:52 benno Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
@@ -311,13 +311,10 @@ main(int argc, char *argv[]) | |||
311 | argv += optind; | 311 | argv += optind; |
312 | 312 | ||
313 | if (rtableid >= 0) { | 313 | if (rtableid >= 0) { |
314 | /* | 314 | if (setrtable(rtableid) == -1) |
315 | * XXX No pledge if doing rtable manipulation! | 315 | err(1, "setrtable"); |
316 | * XXX the routing table stuff is dangerous and can't be pledged. | ||
317 | * XXX rtable should really have a better interface than sockopt | ||
318 | */ | ||
319 | } | 316 | } |
320 | else if (family == AF_UNIX) { | 317 | if (family == AF_UNIX) { |
321 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) | 318 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) |
322 | err(1, "pledge"); | 319 | err(1, "pledge"); |
323 | } | 320 | } |
@@ -809,10 +806,6 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) | |||
809 | SOCK_NONBLOCK, res0->ai_protocol)) < 0) | 806 | SOCK_NONBLOCK, res0->ai_protocol)) < 0) |
810 | continue; | 807 | continue; |
811 | 808 | ||
812 | if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, | ||
813 | &rtableid, sizeof(rtableid)) == -1)) | ||
814 | err(1, "setsockopt SO_RTABLE"); | ||
815 | |||
816 | /* Bind to a local port or source address if specified. */ | 809 | /* Bind to a local port or source address if specified. */ |
817 | if (sflag || pflag) { | 810 | if (sflag || pflag) { |
818 | struct addrinfo ahints, *ares; | 811 | struct addrinfo ahints, *ares; |
@@ -909,10 +902,6 @@ local_listen(char *host, char *port, struct addrinfo hints) | |||
909 | res0->ai_protocol)) < 0) | 902 | res0->ai_protocol)) < 0) |
910 | continue; | 903 | continue; |
911 | 904 | ||
912 | if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, | ||
913 | &rtableid, sizeof(rtableid)) == -1)) | ||
914 | err(1, "setsockopt SO_RTABLE"); | ||
915 | |||
916 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); | 905 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); |
917 | if (ret == -1) | 906 | if (ret == -1) |
918 | err(1, NULL); | 907 | err(1, NULL); |