summaryrefslogtreecommitdiff
path: root/usr.bin/nc/netcat.c
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-07-03 04:44:53 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-07-03 04:44:53 +0000
commit1df4f9d5fc0dabecca2ff9680db469442a1cfc73 (patch)
treef1096c33d9ee94872dc2030b23f093a1335185a3 /usr.bin/nc/netcat.c
parenta5a38a4c5ed836aeac420d462a2319bc2732aab9 (diff)
Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!) to rtables and not just rdomains. This changes the name of the system calls, socket option, and ioctl. After building with this you should remove the files /usr/share/man/cat2/[gs]etrdomain.0. Since this removes the existing [gs]etrdomain() system calls, the libc major is bumped. Written by claudio@, criticized^Wcritiqued by me
Diffstat (limited to 'usr.bin/nc/netcat.c')
-rw-r--r--usr.bin/nc/netcat.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index df68805bd9d..e471182b2ad 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.97 2010/04/20 07:28:28 nicm Exp $ */
+/* $OpenBSD: netcat.c,v 1.98 2010/07/03 04:44:51 guenther Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
*
@@ -84,7 +84,7 @@ int Iflag; /* TCP receive buffer size */
int Oflag; /* TCP send buffer size */
int Sflag; /* TCP MD5 signature option */
int Tflag = -1; /* IP Type of Service */
-u_int rdomain;
+u_int rtableid;
int timeout = -1;
int family = AF_UNSPEC;
@@ -189,10 +189,10 @@ main(int argc, char *argv[])
uflag = 1;
break;
case 'V':
- rdomain = (unsigned int)strtonum(optarg, 0,
+ rtableid = (unsigned int)strtonum(optarg, 0,
RT_TABLEID_MAX, &errstr);
if (errstr)
- errx(1, "rdomain %s: %s", errstr, optarg);
+ errx(1, "rtable %s: %s", errstr, optarg);
break;
case 'v':
vflag = 1;
@@ -507,10 +507,10 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
res0->ai_protocol)) < 0)
continue;
- if (rdomain) {
- if (setsockopt(s, IPPROTO_IP, SO_RDOMAIN, &rdomain,
- sizeof(rdomain)) == -1)
- err(1, "setsockopt SO_RDOMAIN");
+ if (rtableid) {
+ if (setsockopt(s, IPPROTO_IP, SO_RTABLE, &rtableid,
+ sizeof(rtableid)) == -1)
+ err(1, "setsockopt SO_RTABLE");
}
/* Bind to a local port or source address if specified. */
@@ -581,10 +581,10 @@ local_listen(char *host, char *port, struct addrinfo hints)
res0->ai_protocol)) < 0)
continue;
- if (rdomain) {
- if (setsockopt(s, IPPROTO_IP, SO_RDOMAIN, &rdomain,
- sizeof(rdomain)) == -1)
- err(1, "setsockopt SO_RDOMAIN");
+ if (rtableid) {
+ if (setsockopt(s, IPPROTO_IP, SO_RTABLE, &rtableid,
+ sizeof(rtableid)) == -1)
+ err(1, "setsockopt SO_RTABLE");
}
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
@@ -871,7 +871,7 @@ help(void)
\t-t Answer TELNET negotiation\n\
\t-U Use UNIX domain socket\n\
\t-u UDP mode\n\
- \t-V rdomain Specify alternate routing domain\n\
+ \t-V rtable Specify alternate routing table\n\
\t-v Verbose\n\
\t-w secs\t Timeout for connects and final net reads\n\
\t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\
@@ -887,7 +887,7 @@ usage(int ret)
fprintf(stderr,
"usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n"
"\t [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n"
- "\t [-V rdomain] [-w timeout] [-X proxy_protocol]\n"
+ "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n"
"\t [-x proxy_address[:port]] [hostname] [port]\n");
if (ret)
exit(1);