? tcpbench ? tcpbench.1.manlint Index: tcpbench.1 =================================================================== RCS file: /cvs/src/usr.bin/tcpbench/tcpbench.1,v retrieving revision 1.19 diff -u -p -r1.19 tcpbench.1 --- tcpbench.1 26 Feb 2014 20:56:11 -0000 1.19 +++ tcpbench.1 18 Aug 2014 14:03:35 -0000 @@ -24,7 +24,7 @@ .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 @@ -39,7 +39,7 @@ .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 @@ -75,6 +75,14 @@ option. .Pp The options are as follows: .Bl -tag -width Ds +.It Fl 4 +Force +.Nm +to use IPv4 addresses. +.It Fl 6 +Force +.Nm +to use IPv6 addresses. .It Fl B Ar buf Specify the size of the internal read/write buffer used by .Nm . Index: tcpbench.c =================================================================== RCS file: /cvs/src/usr.bin/tcpbench/tcpbench.c,v retrieving revision 1.41 diff -u -p -r1.41 tcpbench.c --- tcpbench.c 25 Dec 2013 01:46:00 -0000 1.41 +++ tcpbench.c 18 Aug 2014 14:03:35 -0000 @@ -180,10 +180,10 @@ usage(void) { 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); } @@ -997,6 +997,7 @@ main(int argc, char **argv) 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; @@ -1015,8 +1016,14 @@ main(int argc, char **argv) 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; @@ -1124,6 +1131,7 @@ main(int argc, char **argv) } bzero(&hints, sizeof(hints)); + hints.ai_family = family; if (UDP_MODE) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP;