diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/nc/nc.1 | 10 | ||||
| -rw-r--r-- | src/usr.bin/nc/netcat.c | 33 |
2 files changed, 38 insertions, 5 deletions
diff --git a/src/usr.bin/nc/nc.1 b/src/usr.bin/nc/nc.1 index 441ef32198..9e32ad97c6 100644 --- a/src/usr.bin/nc/nc.1 +++ b/src/usr.bin/nc/nc.1 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: nc.1,v 1.45 2007/05/31 19:20:13 jmc Exp $ | 1 | .\" $OpenBSD: nc.1,v 1.46 2008/05/06 05:47:39 djm Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 1996 David Sacerdote | 3 | .\" Copyright (c) 1996 David Sacerdote |
| 4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
| @@ -25,7 +25,7 @@ | |||
| 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | .\" | 27 | .\" |
| 28 | .Dd $Mdocdate: May 31 2007 $ | 28 | .Dd $Mdocdate: May 6 2008 $ |
| 29 | .Dt NC 1 | 29 | .Dt NC 1 |
| 30 | .Os | 30 | .Os |
| 31 | .Sh NAME | 31 | .Sh NAME |
| @@ -35,7 +35,9 @@ | |||
| 35 | .Nm nc | 35 | .Nm nc |
| 36 | .Bk -words | 36 | .Bk -words |
| 37 | .Op Fl 46DdhklnrStUuvz | 37 | .Op Fl 46DdhklnrStUuvz |
| 38 | .Op Fl I Ar receive_buffer_len | ||
| 38 | .Op Fl i Ar interval | 39 | .Op Fl i Ar interval |
| 40 | .Op Fl O Ar send_buffer_len | ||
| 39 | .Op Fl P Ar proxy_username | 41 | .Op Fl P Ar proxy_username |
| 40 | .Op Fl p Ar source_port | 42 | .Op Fl p Ar source_port |
| 41 | .Op Fl s Ar source_ip_address | 43 | .Op Fl s Ar source_ip_address |
| @@ -101,6 +103,8 @@ Do not attempt to read from stdin. | |||
| 101 | Prints out | 103 | Prints out |
| 102 | .Nm | 104 | .Nm |
| 103 | help. | 105 | help. |
| 106 | .It Fl I Ar receive_buffer_len | ||
| 107 | Specifies the size of the TCP receive buffer. | ||
| 104 | .It Fl i Ar interval | 108 | .It Fl i Ar interval |
| 105 | Specifies a delay time interval between lines of text sent and received. | 109 | Specifies a delay time interval between lines of text sent and received. |
| 106 | Also causes a delay time between connections to multiple ports. | 110 | Also causes a delay time between connections to multiple ports. |
| @@ -118,6 +122,8 @@ Used to specify that | |||
| 118 | should listen for an incoming connection rather than initiate a | 122 | should listen for an incoming connection rather than initiate a |
| 119 | connection to a remote host. | 123 | connection to a remote host. |
| 120 | It is an error to use this option in conjunction with the | 124 | It is an error to use this option in conjunction with the |
| 125 | .It Fl O Ar send_buffer_len | ||
| 126 | Specifies the size of the TCP send buffer. | ||
| 121 | .Fl p , | 127 | .Fl p , |
| 122 | .Fl s , | 128 | .Fl s , |
| 123 | or | 129 | or |
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 1c671f2e75..4228326bdd 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: netcat.c,v 1.89 2007/02/20 14:11:17 jmc Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.90 2008/05/06 05:47:39 djm Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
| 4 | * | 4 | * |
| @@ -80,6 +80,8 @@ int vflag; /* Verbosity */ | |||
| 80 | int xflag; /* Socks proxy */ | 80 | int xflag; /* Socks proxy */ |
| 81 | int zflag; /* Port Scan Flag */ | 81 | int zflag; /* Port Scan Flag */ |
| 82 | int Dflag; /* sodebug */ | 82 | int Dflag; /* sodebug */ |
| 83 | int Iflag; /* TCP receive buffer size */ | ||
| 84 | int Oflag; /* TCP send buffer size */ | ||
| 83 | int Sflag; /* TCP MD5 signature option */ | 85 | int Sflag; /* TCP MD5 signature option */ |
| 84 | int Tflag = -1; /* IP Type of Service */ | 86 | int Tflag = -1; /* IP Type of Service */ |
| 85 | 87 | ||
| @@ -123,7 +125,7 @@ main(int argc, char *argv[]) | |||
| 123 | sv = NULL; | 125 | sv = NULL; |
| 124 | 126 | ||
| 125 | while ((ch = getopt(argc, argv, | 127 | while ((ch = getopt(argc, argv, |
| 126 | "46Ddhi:jklnP:p:rSs:tT:Uuvw:X:x:z")) != -1) { | 128 | "46DdhI:i:jklnO:P:p:rSs:tT:Uuvw:X:x:z")) != -1) { |
| 127 | switch (ch) { | 129 | switch (ch) { |
| 128 | case '4': | 130 | case '4': |
| 129 | family = AF_INET; | 131 | family = AF_INET; |
| @@ -205,6 +207,18 @@ main(int argc, char *argv[]) | |||
| 205 | case 'D': | 207 | case 'D': |
| 206 | Dflag = 1; | 208 | Dflag = 1; |
| 207 | break; | 209 | break; |
| 210 | case 'I': | ||
| 211 | Iflag = strtonum(optarg, 1, 65536 << 14, &errstr); | ||
| 212 | if (errstr != NULL) | ||
| 213 | errx(1, "TCP receive window %s: %s", | ||
| 214 | errstr, optarg); | ||
| 215 | break; | ||
| 216 | case 'O': | ||
| 217 | Oflag = strtonum(optarg, 1, 65536 << 14, &errstr); | ||
| 218 | if (errstr != NULL) | ||
| 219 | errx(1, "TCP send window %s: %s", | ||
| 220 | errstr, optarg); | ||
| 221 | break; | ||
| 208 | case 'S': | 222 | case 'S': |
| 209 | Sflag = 1; | 223 | Sflag = 1; |
| 210 | break; | 224 | break; |
| @@ -781,6 +795,16 @@ set_common_sockopts(int s) | |||
| 781 | &Tflag, sizeof(Tflag)) == -1) | 795 | &Tflag, sizeof(Tflag)) == -1) |
| 782 | err(1, "set IP ToS"); | 796 | err(1, "set IP ToS"); |
| 783 | } | 797 | } |
| 798 | if (Iflag) { | ||
| 799 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, | ||
| 800 | &Iflag, sizeof(Iflag)) == -1) | ||
| 801 | err(1, "set TCP receive buffer size"); | ||
| 802 | } | ||
| 803 | if (Oflag) { | ||
| 804 | if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, | ||
| 805 | &Oflag, sizeof(Oflag)) == -1) | ||
| 806 | err(1, "set TCP send buffer size"); | ||
| 807 | } | ||
| 784 | } | 808 | } |
| 785 | 809 | ||
| 786 | int | 810 | int |
| @@ -810,10 +834,12 @@ help(void) | |||
| 810 | \t-D Enable the debug socket option\n\ | 834 | \t-D Enable the debug socket option\n\ |
| 811 | \t-d Detach from stdin\n\ | 835 | \t-d Detach from stdin\n\ |
| 812 | \t-h This help text\n\ | 836 | \t-h This help text\n\ |
| 837 | \t-I length TCP receive buffer length\n\ | ||
| 813 | \t-i secs\t Delay interval for lines sent, ports scanned\n\ | 838 | \t-i secs\t Delay interval for lines sent, ports scanned\n\ |
| 814 | \t-k Keep inbound sockets open for multiple connects\n\ | 839 | \t-k Keep inbound sockets open for multiple connects\n\ |
| 815 | \t-l Listen mode, for inbound connects\n\ | 840 | \t-l Listen mode, for inbound connects\n\ |
| 816 | \t-n Suppress name/port resolutions\n\ | 841 | \t-n Suppress name/port resolutions\n\ |
| 842 | \t-O length TCP send buffer length\n\ | ||
| 817 | \t-P proxyuser\tUsername for proxy authentication\n\ | 843 | \t-P proxyuser\tUsername for proxy authentication\n\ |
| 818 | \t-p port\t Specify local port for remote connects\n\ | 844 | \t-p port\t Specify local port for remote connects\n\ |
| 819 | \t-r Randomize remote ports\n\ | 845 | \t-r Randomize remote ports\n\ |
| @@ -835,7 +861,8 @@ help(void) | |||
| 835 | void | 861 | void |
| 836 | usage(int ret) | 862 | usage(int ret) |
| 837 | { | 863 | { |
| 838 | fprintf(stderr, "usage: nc [-46DdhklnrStUuvz] [-i interval] [-P proxy_username] [-p source_port]\n"); | 864 | fprintf(stderr, "usage: nc [-46DdhklnrStUuvz] [-I receive_buffer_len] [-i interval]\n"); |
| 865 | fprintf(stderr, "\t [-O send_buffer_len] [-P proxy_username] [-p source_port]\n"); | ||
| 839 | fprintf(stderr, "\t [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]\n"); | 866 | fprintf(stderr, "\t [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]\n"); |
| 840 | fprintf(stderr, "\t [-x proxy_address[:port]] [hostname] [port[s]]\n"); | 867 | fprintf(stderr, "\t [-x proxy_address[:port]] [hostname] [port[s]]\n"); |
| 841 | if (ret) | 868 | if (ret) |
