Bugzilla – Attachment 1320 Details for
Bug 1332
Add ability to set TCP rcvbuf size
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
This adds a ReceiveBufferSize option to ssh(1)
openssh-4.6p1-rcvbuf.diff (text/plain), 5.02 KB, created by
Iain Morgan
on 2007-07-06 07:32:10 AEST
(
hide
)
Description:
This adds a ReceiveBufferSize option to ssh(1)
Filename:
MIME Type:
Creator:
Iain Morgan
Created:
2007-07-06 07:32:10 AEST
Size:
5.02 KB
patch
obsolete
>diff -Nur openssh-4.6p1/readconf.c openssh-4.6p1+rcvbuf/readconf.c >--- openssh-4.6p1/readconf.c Mon Feb 19 03:12:54 2007 >+++ openssh-4.6p1+rcvbuf/readconf.c Sun Jul 1 21:01:43 2007 >@@ -130,6 +130,7 @@ > oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, > oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, > oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, >+ oReceiveBufferSize, > oDeprecated, oUnsupported > } OpCodes; > >@@ -226,6 +227,7 @@ > { "tunneldevice", oTunnelDevice }, > { "localcommand", oLocalCommand }, > { "permitlocalcommand", oPermitLocalCommand }, >+ { "receivebuffersize", oReceiveBufferSize }, > { NULL, oBadOption } > }; > >@@ -915,6 +917,39 @@ > intptr = &options->permit_local_command; > goto parse_flag; > >+ case oReceiveBufferSize: >+ intptr = &options->receive_buffer_size; >+ arg = strdelim(&s); >+ if (!arg || *arg == '\0') >+ fatal("%.200s line %d: Missing argument.", filename, linenum); >+ if (arg[0] < '0' || arg[0] > '9') >+ fatal("%.200s line %d: Bad number.", filename, linenum); >+ orig = val64 = strtoll(arg, &endofnumber, 10); >+ if (arg == endofnumber) >+ fatal("%.200s line %d: Bad number.", filename, linenum); >+ switch (toupper(*endofnumber)) { >+ case '\0': >+ scale = 1; >+ break; >+ case 'K': >+ scale = 1<<10; >+ break; >+ case 'M': >+ scale = 1<<20; >+ break; >+ default: >+ fatal("%.200s line %d: Invalid ReceiveBufferSize suffix", >+ filename, linenum); >+ } >+ val64 *= scale; >+ /* detect integer wrap and too-large limits */ >+ if ((val64 / scale) != orig || val64 > INT_MAX) >+ fatal("%.200s line %d: ReceiveBufferSize too large", >+ filename, linenum); >+ if (*activep && *intptr == -1) >+ *intptr = (int)val64; >+ break; >+ > case oDeprecated: > debug("%s line %d: Deprecated option \"%s\"", > filename, linenum, keyword); >@@ -1065,6 +1100,7 @@ > options->tun_remote = -1; > options->local_command = NULL; > options->permit_local_command = -1; >+ options->receive_buffer_size = -1; > } > > /* >@@ -1199,12 +1235,15 @@ > options->tun_remote = SSH_TUNID_ANY; > if (options->permit_local_command == -1) > options->permit_local_command = 0; >+ if (options->receive_buffer_size == -1) >+ options->receive_buffer_size = 0; > /* options->local_command should not be set by default */ > /* options->proxy_command should not be set by default */ > /* options->user will be set in the main program if appropriate */ > /* options->hostname will be set in the main program if appropriate */ > /* options->host_key_alias should not be set by default */ > /* options->preferred_authentications will be set in ssh */ >+ /* options->receive_buffer_size should not be set by default */ > } > > /* >diff -Nur openssh-4.6p1/readconf.h openssh-4.6p1+rcvbuf/readconf.h >--- openssh-4.6p1/readconf.h Fri Aug 4 19:39:40 2006 >+++ openssh-4.6p1+rcvbuf/readconf.h Sat Jun 30 22:22:24 2007 >@@ -120,6 +120,7 @@ > > char *local_command; > int permit_local_command; >+ int receive_buffer_size; > > } Options; > >diff -Nur openssh-4.6p1/ssh.1 openssh-4.6p1+rcvbuf/ssh.1 >--- openssh-4.6p1/ssh.1 Thu Jan 4 21:25:46 2007 >+++ openssh-4.6p1+rcvbuf/ssh.1 Sun Jul 1 00:43:52 2007 >@@ -479,6 +479,7 @@ > .It Protocol > .It ProxyCommand > .It PubkeyAuthentication >+.It ReceiveBufferSize > .It RekeyLimit > .It RemoteForward > .It RhostsRSAAuthentication >diff -Nur openssh-4.6p1/ssh_config.5 openssh-4.6p1+rcvbuf/ssh_config.5 >--- openssh-4.6p1/ssh_config.5 Mon Feb 19 03:08:18 2007 >+++ openssh-4.6p1+rcvbuf/ssh_config.5 Sun Jul 1 20:45:10 2007 >@@ -753,6 +753,16 @@ > The default is > .Dq yes . > This option applies to protocol version 2 only. >+.It Cm ReceiveBufferSize >+Specifies the requested size for the TCP receive buffer. >+The argument is the number of bytes, with an optional suffix of >+.Sq K >+or >+.Sq M >+to indicate Kilobytes or Megabytes, respectively. >+If the requested value is less than the current TCP receive buffer, >+the buffer is unchanged. >+The default value is zero. > .It Cm RekeyLimit > Specifies the maximum amount of data that may be transmitted before the > session key is renegotiated. >diff -Nur openssh-4.6p1/sshconnect.c openssh-4.6p1+rcvbuf/sshconnect.c >--- openssh-4.6p1/sshconnect.c Mon Oct 23 10:02:24 2006 >+++ openssh-4.6p1+rcvbuf/sshconnect.c Sat Jun 30 23:02:21 2007 >@@ -304,6 +304,8 @@ > int gaierr; > int on = 1; > int sock = -1, attempt; >+ int rcvbuf = INT_MAX; >+ socklen_t size = sizeof(rcvbuf); > char ntop[NI_MAXHOST], strport[NI_MAXSERV]; > struct addrinfo hints, *ai, *aitop; > >@@ -383,6 +385,18 @@ > setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, > sizeof(on)) < 0) > error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno)); >+ >+ /* Conditionally set SO_RCVBUF if requested. */ >+ getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &rcvbuf, &size); >+ if (rcvbuf < options.receive_buffer_size) { >+ rcvbuf = options.receive_buffer_size; >+ if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)&rcvbuf, >+ sizeof(rcvbuf)) < 0) { >+ error("setsockopt SO_RCVBUF: %.100s", strerror(errno)); >+ } else { >+ debug("Set TCP receive buffer to %d bytes", rcvbuf); >+ } >+ } > > /* Set the connection. */ > packet_set_connection(sock, sock);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1332
: 1320