-.\" $OpenBSD: tcpbench.1,v 1.19 2014/02/26 20:56:11 claudio Exp $
+.\" $OpenBSD: tcpbench.1,v 1.20 2014/08/19 03:28:53 dlg Exp $
.\"
.\" Copyright (c) 2008 Damien Miller <djm@mindrot.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 26 2014 $
+.Dd $Mdocdate: August 19 2014 $
.Dt TCPBENCH 1
.Os
.Sh NAME
.Nm
.Fl l
.Nm
-.Op Fl uv
+.Op Fl 46uv
.Op Fl B Ar buf
.Op Fl b Ar addr
.Op Fl k Ar kvars
.Nm
.Bk -words
.Fl s
-.Op Fl uv
+.Op Fl 46uv
.Op Fl B Ar buf
.Op Fl k Ar kvars
.Op Fl p Ar port
.Pp
The options are as follows:
.Bl -tag -width Ds
+.It Fl 4
+Forces
+.Nm
+to use IPv4 addresses only.
+.It Fl 6
+Forces
+.Nm
+to use IPv6 addresses only.
.It Fl B Ar buf
Specify the size of the internal read/write buffer used by
.Nm .
{
fprintf(stderr,
"usage: tcpbench -l\n"
- " tcpbench [-uv] [-B buf] [-b addr] [-k kvars] [-n connections]\n"
+ " tcpbench [-46uv] [-B buf] [-b addr] [-k kvars] [-n connections]\n"
" [-p port] [-r interval] [-S space] [-T toskeyword]\n"
" [-t secs] [-V rtable] hostname\n"
- " tcpbench -s [-uv] [-B buf] [-k kvars] [-p port]\n"
+ " tcpbench -s [-46uv] [-B buf] [-k kvars] [-p port]\n"
" [-r interval] [-S space] [-T toskeyword] [-V rtable]\n");
exit(1);
}
const char *errstr;
struct rlimit rl;
int ch, herr, nconn;
+ int family = PF_UNSPEC;
struct nlist nl[] = { { "_tcbtable" }, { "" } };
const char *host = NULL, *port = DEFAULT_PORT, *srcbind = NULL;
struct event ev_sigint, ev_sigterm, ev_sighup, ev_progtimer;
aib = NULL;
secs = 0;
- while ((ch = getopt(argc, argv, "b:B:hlk:n:p:r:sS:t:T:uvV:")) != -1) {
+ while ((ch = getopt(argc, argv, "46b:B:hlk:n:p:r:sS:t:T:uvV:")) != -1) {
switch (ch) {
+ case '4':
+ family = PF_INET;
+ break;
+ case '6':
+ family = PF_INET6;
+ break;
case 'b':
srcbind = optarg;
break;
}
bzero(&hints, sizeof(hints));
+ hints.ai_family = family;
if (UDP_MODE) {
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;