summaryrefslogtreecommitdiff
path: root/usr.bin/tcpbench
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/tcpbench
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/tcpbench')
-rw-r--r--usr.bin/tcpbench/tcpbench.112
-rw-r--r--usr.bin/tcpbench/tcpbench.c36
2 files changed, 24 insertions, 24 deletions
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':