summaryrefslogtreecommitdiff
path: root/usr.bin
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
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')
-rw-r--r--usr.bin/nc/nc.110
-rw-r--r--usr.bin/nc/netcat.c28
-rw-r--r--usr.bin/tcpbench/tcpbench.112
-rw-r--r--usr.bin/tcpbench/tcpbench.c36
-rw-r--r--usr.bin/telnet/commands.c10
-rw-r--r--usr.bin/telnet/externs.h4
-rw-r--r--usr.bin/telnet/main.c12
-rw-r--r--usr.bin/telnet/telnet.110
8 files changed, 61 insertions, 61 deletions
diff --git a/usr.bin/nc/nc.1 b/usr.bin/nc/nc.1
index 94a2d43cdbb..fa0f76b9543 100644
--- a/usr.bin/nc/nc.1
+++ b/usr.bin/nc/nc.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: nc.1,v 1.53 2010/02/23 23:00:52 schwarze Exp $
+.\" $OpenBSD: nc.1,v 1.54 2010/07/03 04:44:51 guenther Exp $
.\"
.\" Copyright (c) 1996 David Sacerdote
.\" All rights reserved.
@@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: February 23 2010 $
+.Dd $Mdocdate: July 3 2010 $
.Dt NC 1
.Os
.Sh NAME
@@ -42,7 +42,7 @@
.Op Fl p Ar source_port
.Op Fl s Ar source_ip_address
.Op Fl T Ar ToS
-.Op Fl V Ar rdomain
+.Op Fl V Ar rtable
.Op Fl w Ar timeout
.Op Fl X Ar proxy_protocol
.Oo Xo
@@ -179,8 +179,8 @@ Specifies to use
sockets.
.It Fl u
Use UDP instead of the default option of TCP.
-.It Fl V Ar rdomain
-Set the routing domain.
+.It Fl V Ar rtable
+Set the routing table to be used.
The default is 0.
.It Fl v
Have
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);
diff --git a/usr.bin/tcpbench/tcpbench.1 b/usr.bin/tcpbench/tcpbench.1
index 1474074e81b..7e37ca82624 100644
--- a/usr.bin/tcpbench/tcpbench.1
+++ b/usr.bin/tcpbench/tcpbench.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tcpbench.1,v 1.7 2009/08/13 17:38:28 jmc Exp $
+.\" $OpenBSD: tcpbench.1,v 1.8 2010/07/03 04:44:51 guenther Exp $
.\"
.\" Copyright (c) 2008 Damien Miller <djm@mindrot.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 13 2009 $
+.Dd $Mdocdate: July 3 2010 $
.Os
.Dt TCPBENCH 1
.Sh NAME
@@ -31,7 +31,7 @@
.Op Fl p Ar port
.Op Fl r Ar rate
.Op Fl S Ar space
-.Op Fl V Ar rdomain
+.Op Fl V Ar rtable
.Ar hostname
.Nm
.Bk -words
@@ -42,7 +42,7 @@
.Op Fl p Ar port
.Op Fl r Ar rate
.Op Fl S Ar space
-.Op Fl V Ar rdomain
+.Op Fl V Ar rtable
.Ek
.Sh DESCRIPTION
.Nm
@@ -98,8 +98,8 @@ Place
.Nm
in server mode, where it will listen on all interfaces for incoming
connections.
-.It Fl V Ar rdomain
-Set the routing domain.
+.It Fl V Ar rtable
+Set the routing table to be used.
The default is 0.
.It Fl v
Display verbose output.
diff --git a/usr.bin/tcpbench/tcpbench.c b/usr.bin/tcpbench/tcpbench.c
index 18ff4574a1d..5ae4af080a4 100644
--- a/usr.bin/tcpbench/tcpbench.c
+++ b/usr.bin/tcpbench/tcpbench.c
@@ -56,7 +56,7 @@
sig_atomic_t done = 0;
sig_atomic_t proc_slice = 0;
-static u_int rdomain;
+static u_int rtableid;
static char **kflag;
static size_t Bflag;
static int Sflag;
@@ -137,9 +137,9 @@ usage(void)
fprintf(stderr,
"usage: tcpbench -l\n"
" tcpbench [-v] [-B buf] [-k kvars] [-n connections] [-p port]\n"
- " [-r rate] [-S space] [-V rdomain] hostname\n"
+ " [-r rate] [-S space] [-V rtable] hostname\n"
" tcpbench -s [-v] [-B buf] [-k kvars] [-p port]\n"
- " [-r rate] [-S space] [-V rdomain]\n");
+ " [-r rate] [-S space] [-V rtable]\n");
exit(1);
}
@@ -552,12 +552,12 @@ serverbind(struct pollfd *pfd, nfds_t max_nfds, struct addrinfo *aitop)
warn("socket");
continue;
}
- if (rdomain && ai->ai_family == AF_INET) {
- if (setsockopt(sock, IPPROTO_IP, SO_RDOMAIN,
- &rdomain, sizeof(rdomain)) == -1)
- err(1, "setsockopt SO_RDOMAIN");
- } else if (rdomain)
- warnx("rdomain only supported on AF_INET");
+ if (rtableid && ai->ai_family == AF_INET) {
+ if (setsockopt(sock, IPPROTO_IP, SO_RTABLE,
+ &rtableid, sizeof(rtableid)) == -1)
+ err(1, "setsockopt SO_RTABLE");
+ } else if (rtableid)
+ warnx("rtable only supported on AF_INET");
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
&on, sizeof(on)) == -1)
warn("reuse port");
@@ -757,12 +757,12 @@ clientconnect(struct addrinfo *aitop, struct pollfd *pfd, int nconn)
warn("socket");
continue;
}
- if (rdomain && ai->ai_family == AF_INET) {
- if (setsockopt(sock, IPPROTO_IP, SO_RDOMAIN,
- &rdomain, sizeof(rdomain)) == -1)
- err(1, "setsockopt SO_RDOMAIN");
- } else if (rdomain)
- warnx("rdomain only supported on AF_INET");
+ if (rtableid && ai->ai_family == AF_INET) {
+ if (setsockopt(sock, IPPROTO_IP, SO_RTABLE,
+ &rtableid, sizeof(rtableid)) == -1)
+ err(1, "setsockopt SO_RTABLE");
+ } else if (rtableid)
+ warnx("rtable only supported on AF_INET");
if (Sflag) {
if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
&Sflag, sizeof(Sflag)) == -1)
@@ -891,7 +891,7 @@ main(int argc, char **argv)
int nconn = 1;
Bflag = DEFAULT_BUF;
- Sflag = sflag = vflag = rdomain = 0;
+ Sflag = sflag = vflag = rtableid = 0;
kflag = NULL;
rflag = DEFAULT_STATS_INTERVAL;
@@ -937,10 +937,10 @@ main(int argc, char **argv)
vflag++;
break;
case 'V':
- rdomain = (unsigned int)strtonum(optarg, 0,
+ rtableid = (unsigned int)strtonum(optarg, 0,
RT_TABLEID_MAX, &errstr);
if (errstr)
- errx(1, "rdomain value is %s: %s",
+ errx(1, "rtable value is %s: %s",
errstr, optarg);
break;
case 'n':
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 9b848f5da22..4d3b7e5bab5 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.51 2009/06/05 00:20:46 claudio Exp $ */
+/* $OpenBSD: commands.c,v 1.52 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -2396,10 +2396,10 @@ tn(argc, argv)
if (net < 0)
continue;
- if (rdomain) {
- if (setsockopt(net, IPPROTO_IP, SO_RDOMAIN, &rdomain,
- sizeof(rdomain)) == -1)
- perror("setsockopt (SO_RDOMAIN)");
+ if (rtableid) {
+ if (setsockopt(net, IPPROTO_IP, SO_RTABLE, &rtableid,
+ sizeof(rtableid)) == -1)
+ perror("setsockopt (SO_RTABLE)");
}
if (aliasp) {
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index 8729421c51c..c523ce02c66 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: externs.h,v 1.15 2009/06/05 00:20:46 claudio Exp $ */
+/* $OpenBSD: externs.h,v 1.16 2010/07/03 04:44:51 guenther Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
@@ -108,7 +108,7 @@ extern void (*encrypt_output) (unsigned char *, int);
extern int (*decrypt_input) (int);
#endif
-extern u_int rdomain; /* routing domain to use */
+extern u_int rtableid; /* routing table to use */
/*
* We keep track of each side of the option negotiation.
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index 7c78d6f8c76..e767663f327 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.19 2009/10/27 23:59:44 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.20 2010/07/03 04:44:51 guenther Exp $ */
/* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
/*
@@ -54,7 +54,7 @@ static int default_forward=0;
#endif
int family = AF_UNSPEC;
-u_int rdomain;
+u_int rtableid;
/*
* Initialize variables.
@@ -86,7 +86,7 @@ usage()
# else
"usage: %s [-468acdEFfKLrx] [-b hostalias] [-e escapechar] "
"[-k realm]\n"
- "\t[-l user] [-n tracefile] [-V rdomain] [-X authtype] "
+ "\t[-l user] [-n tracefile] [-V rtable] [-X authtype] "
"[host [port]]\n",
#endif
__progname);
@@ -326,11 +326,11 @@ main(argc, argv)
#endif
break;
case 'V':
- rdomain = (unsigned int)strtonum(optarg, 0,
+ rtableid = (unsigned int)strtonum(optarg, 0,
RT_TABLEID_MAX, &errstr);
if (errstr) {
- fprintf(stderr,
- "%s: Warning: -R ignored, rdomain %s: %s\n",
+ fprintf(stderr, "%s: Warning: "
+ "-V ignored, rtable %s: %s\n",
prompt, errstr, optarg);
}
break;
diff --git a/usr.bin/telnet/telnet.1 b/usr.bin/telnet/telnet.1
index eae86142678..1730369e72c 100644
--- a/usr.bin/telnet/telnet.1
+++ b/usr.bin/telnet/telnet.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: telnet.1,v 1.42 2009/06/05 06:47:12 jmc Exp $
+.\" $OpenBSD: telnet.1,v 1.43 2010/07/03 04:44:51 guenther Exp $
.\" $NetBSD: telnet.1,v 1.5 1996/02/28 21:04:12 thorpej Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
@@ -30,7 +30,7 @@
.\"
.\" from: @(#)telnet.1 8.4 (Berkeley) 2/3/94
.\"
-.Dd $Mdocdate: June 5 2009 $
+.Dd $Mdocdate: July 3 2010 $
.Dt TELNET 1
.Os
.Sh NAME
@@ -47,7 +47,7 @@ protocol
.Op Fl k Ar realm
.Op Fl l Ar user
.Op Fl n Ar tracefile
-.Op Fl V Ar rdomain
+.Op Fl V Ar rtable
.Op Fl X Ar authtype
.Oo
.Ar host
@@ -186,8 +186,8 @@ mode, the escape character is set to the tilde (~) character,
unless modified by the
.Fl e
option.
-.It Fl V Ar rdomain
-Set the routing domain.
+.It Fl V Ar rtable
+Set the routing table to be used.
The default is 0.
.It Fl X Ar authtype
Disables the