diff options
Diffstat (limited to 'src/usr.bin/nc/netcat.c')
| -rw-r--r-- | src/usr.bin/nc/netcat.c | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index dfa3a6a25b..2211508c83 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.116 2013/10/21 09:12:55 phessler Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.117 2013/10/26 21:33:29 sthen Exp $ */ | 
| 2 | /* | 2 | /* | 
| 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 
| 4 | * | 4 | * | 
| @@ -87,7 +87,7 @@ int Iflag; /* TCP receive buffer size */ | |||
| 87 | int Oflag; /* TCP send buffer size */ | 87 | int Oflag; /* TCP send buffer size */ | 
| 88 | int Sflag; /* TCP MD5 signature option */ | 88 | int Sflag; /* TCP MD5 signature option */ | 
| 89 | int Tflag = -1; /* IP Type of Service */ | 89 | int Tflag = -1; /* IP Type of Service */ | 
| 90 | u_int rtableid; | 90 | int rtableid = -1; | 
| 91 | 91 | ||
| 92 | int timeout = -1; | 92 | int timeout = -1; | 
| 93 | int family = AF_UNSPEC; | 93 | int family = AF_UNSPEC; | 
| @@ -202,7 +202,7 @@ main(int argc, char *argv[]) | |||
| 202 | uflag = 1; | 202 | uflag = 1; | 
| 203 | break; | 203 | break; | 
| 204 | case 'V': | 204 | case 'V': | 
| 205 | rtableid = (unsigned int)strtonum(optarg, 0, | 205 | rtableid = (int)strtonum(optarg, 0, | 
| 206 | RT_TABLEID_MAX, &errstr); | 206 | RT_TABLEID_MAX, &errstr); | 
| 207 | if (errstr) | 207 | if (errstr) | 
| 208 | errx(1, "rtable %s: %s", errstr, optarg); | 208 | errx(1, "rtable %s: %s", errstr, optarg); | 
| @@ -589,8 +589,8 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) | |||
| 589 | res0->ai_protocol)) < 0) | 589 | res0->ai_protocol)) < 0) | 
| 590 | continue; | 590 | continue; | 
| 591 | 591 | ||
| 592 | if (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid, | 592 | if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, | 
| 593 | sizeof(rtableid)) == -1) | 593 | &rtableid, sizeof(rtableid)) == -1)) | 
| 594 | err(1, "setsockopt SO_RTABLE"); | 594 | err(1, "setsockopt SO_RTABLE"); | 
| 595 | 595 | ||
| 596 | /* Bind to a local port or source address if specified. */ | 596 | /* Bind to a local port or source address if specified. */ | 
| @@ -698,8 +698,8 @@ local_listen(char *host, char *port, struct addrinfo hints) | |||
| 698 | res0->ai_protocol)) < 0) | 698 | res0->ai_protocol)) < 0) | 
| 699 | continue; | 699 | continue; | 
| 700 | 700 | ||
| 701 | if (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid, | 701 | if (rtableid >= 0 && (setsockopt(s, IPPROTO_IP, SO_RTABLE, | 
| 702 | sizeof(rtableid)) == -1) | 702 | &rtableid, sizeof(rtableid)) == -1)) | 
| 703 | err(1, "setsockopt SO_RTABLE"); | 703 | err(1, "setsockopt SO_RTABLE"); | 
| 704 | 704 | ||
| 705 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); | 705 | ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); | 
