]> git.pld-linux.org Git - packages/openssh.git/blob - openssh-4.3p1-hpn11.patch
- original from http://www.psc.edu/networking/projects/hpn-ssh/openssh-4.3p1-hpn11...
[packages/openssh.git] / openssh-4.3p1-hpn11.patch
1 diff -r -u -p1 openssh-4.3p1/buffer.c patch/buffer.c
2 --- openssh-4.3p1/buffer.c      2005-03-14 07:22:26.000000000 -0500
3 +++ patch/buffer.c      2006-02-01 10:26:10.000000000 -0500
4 @@ -109,3 +109,3 @@ restart:
5         newlen = buffer->alloc + len + 32768;
6 -       if (newlen > BUFFER_MAX_LEN)
7 +       if (newlen > BUFFER_MAX_HPN_LEN)
8                 fatal("buffer_append_space: alloc %u not supported",
9 diff -r -u -p1 openssh-4.3p1/buffer.h patch/buffer.h
10 --- openssh-4.3p1/buffer.h      2005-03-14 07:22:26.000000000 -0500
11 +++ patch/buffer.h      2006-02-01 10:26:10.000000000 -0500
12 @@ -27,2 +27,3 @@ typedef struct {
13  #define        BUFFER_MAX_LEN          0xa00000
14 +#define BUFFER_MAX_HPN_LEN     (2<<29)-1
15  
16 diff -r -u -p1 openssh-4.3p1/channels.c patch/channels.c
17 --- openssh-4.3p1/channels.c    2006-01-31 05:47:15.000000000 -0500
18 +++ patch/channels.c    2006-02-01 10:26:10.000000000 -0500
19 @@ -290,2 +290,3 @@ channel_new(char *ctype, int type, int r
20         c->local_maxpacket = maxpack;
21 +       c->dynamic_window = 0;
22         c->remote_id = -1;
23 @@ -750,5 +751,5 @@ channel_pre_open(Channel *c, fd_set * re
24         u_int limit = compat20 ? c->remote_window : packet_get_maxsize();
25 -
26 +       
27         /* check buffer limits */
28 -       limit = MIN(limit, (BUFFER_MAX_LEN - BUFFER_MAX_CHUNK - CHAN_RBUF));
29 +       limit = MIN(limit, (BUFFER_MAX_HPN_LEN - BUFFER_MAX_CHUNK - CHAN_RBUF));
30  
31 @@ -1617,5 +1618,20 @@ channel_check_window(Channel *c)
32             c->local_consumed > 0) {
33 +               u_int32_t tcpwinsz = 0;
34 +               socklen_t optsz = sizeof(tcpwinsz);
35 +               int ret = -1;
36 +               u_int32_t addition = 0;
37 +               if (c->dynamic_window) {
38 +                       ret = getsockopt(packet_get_connection_in(), 
39 +                               SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
40 +                       if ((ret == 0) && tcpwinsz > BUFFER_MAX_HPN_LEN) 
41 +                               tcpwinsz = BUFFER_MAX_HPN_LEN;
42 +               }
43 +               if (c->dynamic_window && (ret == 0) && 
44 +                   (tcpwinsz > c->local_window_max)) {
45 +                       addition = tcpwinsz - c->local_window_max;
46 +                       c->local_window_max += addition;
47 +               }
48                 packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
49                 packet_put_int(c->remote_id);
50 -               packet_put_int(c->local_consumed);
51 +               packet_put_int(c->local_consumed + addition);
52                 packet_send();
53 @@ -1624,3 +1640,3 @@ channel_check_window(Channel *c)
54                     c->local_consumed);
55 -               c->local_window += c->local_consumed;
56 +               c->local_window += c->local_consumed + addition;
57                 c->local_consumed = 0;
58 diff -r -u -p1 openssh-4.3p1/channels.h patch/channels.h
59 --- openssh-4.3p1/channels.h    2005-12-31 00:22:32.000000000 -0500
60 +++ patch/channels.h    2006-02-01 10:26:10.000000000 -0500
61 @@ -102,2 +102,3 @@ struct Channel {
62         u_int   local_maxpacket;
63 +       int     dynamic_window;
64         int     extended_usage;
65 @@ -126,7 +127,7 @@ struct Channel {
66  #define CHAN_SES_PACKET_DEFAULT        (32*1024)
67 -#define CHAN_SES_WINDOW_DEFAULT        (4*CHAN_SES_PACKET_DEFAULT)
68 +#define CHAN_SES_WINDOW_DEFAULT        (0xa00000/2)
69  #define CHAN_TCP_PACKET_DEFAULT        (32*1024)
70 -#define CHAN_TCP_WINDOW_DEFAULT        (4*CHAN_TCP_PACKET_DEFAULT)
71 +#define CHAN_TCP_WINDOW_DEFAULT        (0xa00000/2)
72  #define CHAN_X11_PACKET_DEFAULT        (16*1024)
73 -#define CHAN_X11_WINDOW_DEFAULT        (4*CHAN_X11_PACKET_DEFAULT)
74 +#define CHAN_X11_WINDOW_DEFAULT        (0xa00000/2)
75  
76 diff -r -u -p1 openssh-4.3p1/compat.c patch/compat.c
77 --- openssh-4.3p1/compat.c      2005-03-01 05:24:33.000000000 -0500
78 +++ patch/compat.c      2006-02-01 10:26:10.000000000 -0500
79 @@ -164,2 +164,10 @@ compat_datafellows(const char *version)
80                         datafellows = check[i].bugs;
81 +                       /* Check to see if the remote side is OpenSSH and not HPN */
82 +                       if(strstr(version,"OpenSSH") != NULL)
83 +                       {
84 +                               if (strstr(version,"hpn") == NULL)
85 +                               {
86 +                                       datafellows |= SSH_BUG_LARGEWINDOW;
87 +                               }
88 +                       }
89                         return;
90 diff -r -u -p1 openssh-4.3p1/compat.h patch/compat.h
91 --- openssh-4.3p1/compat.h      2005-03-01 05:24:33.000000000 -0500
92 +++ patch/compat.h      2006-02-01 10:26:10.000000000 -0500
93 @@ -58,2 +58,3 @@
94  #define SSH_OLD_FORWARD_ADDR   0x01000000
95 +#define SSH_BUG_LARGEWINDOW     0x02000000
96  
97 diff -r -u -p1 openssh-4.3p1/readconf.h patch/readconf.h
98 --- openssh-4.3p1/readconf.h    2005-12-13 03:29:02.000000000 -0500
99 +++ patch/readconf.h    2006-02-01 10:26:11.000000000 -0500
100 @@ -59,2 +59,3 @@ typedef struct {
101         int     tcp_keep_alive; /* Set SO_KEEPALIVE. */
102 +        int     tcp_rcv_buf; /* user switch to set tcp recv buffer */
103         LogLevel log_level;     /* Level for logging. */
104 diff -r -u -p1 openssh-4.3p1/scp.c patch/scp.c
105 --- openssh-4.3p1/scp.c 2006-01-31 06:11:38.000000000 -0500
106 +++ patch/scp.c 2006-02-01 07:04:50.000000000 -0500
107 @@ -280,3 +280,3 @@ main(int argc, char **argv)
108         fflag = tflag = 0;
109 -       while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1)
110 +       while ((ch = getopt(argc, argv, "dfl:pR:rtvBCc:i:P:q1246S:o:F:w:")) != -1)
111                 switch (ch) {
112 @@ -341,2 +341,5 @@ main(int argc, char **argv)
113                         break;
114 +               case 'R':
115 +                 addargs(&args, "-r%s", optarg);
116 +                 break;
117                 default:
118 @@ -555,3 +558,3 @@ source(int argc, char **argv)
119         int fd = -1, haderr, indx;
120 -       char *last, *name, buf[2048];
121 +       char *last, *name, buf[16384];
122         int len;
123 @@ -782,3 +785,3 @@ sink(int argc, char **argv)
124         int setimes, targisdir, wrerrno = 0;
125 -       char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
126 +       char ch, *cp, *np, *targ, *why, *vect[1], buf[16384];
127         struct timeval tv[2];
128 @@ -943,3 +946,3 @@ bad:                        run_err("%s: %s", np, strerror(er
129                 (void) atomicio(vwrite, remout, "", 1);
130 -               if ((bp = allocbuf(&buffer, ofd, 4096)) == NULL) {
131 +               if ((bp = allocbuf(&buffer, ofd, sizeof(buf))) == NULL) {
132                         (void) close(ofd);
133 @@ -953,4 +956,4 @@ bad:                        run_err("%s: %s", np, strerror(er
134                         start_progress_meter(curfile, size, &statbytes);
135 -               for (count = i = 0; i < size; i += 4096) {
136 -                       amt = 4096;
137 +               for (count = i = 0; i < size; i += sizeof(buf)) {
138 +                       amt = sizeof(buf);
139                         if (i + amt > size)
140 @@ -971,3 +974,3 @@ bad:                        run_err("%s: %s", np, strerror(er
141                         if (limit_rate)
142 -                               bwlimit(4096);
143 +                               bwlimit(sizeof(buf));
144  
145 @@ -1086,4 +1089,4 @@ usage(void)
146         (void) fprintf(stderr,
147 -           "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
148 -           "           [-l limit] [-o ssh_option] [-P port] [-S program]\n"
149 +           "usage: scp [-1246BCpqrRv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
150 +           "           [-l limit] [-o ssh_option] [-P port] [-R buffer size] [-S program]\n"
151             "           [[user@]host1:]file1 [...] [[user@]host2:]file2\n");
152 diff -r -u -p1 openssh-4.3p1/serverloop.c patch/serverloop.c
153 --- openssh-4.3p1/serverloop.c  2005-12-31 00:33:37.000000000 -0500
154 +++ patch/serverloop.c  2006-02-01 10:26:11.000000000 -0500
155 @@ -977,2 +977,4 @@ server_request_session(void)
156             0, "server-session", 1);
157 +       if (!(datafellows & SSH_BUG_LARGEWINDOW))
158 +               c->dynamic_window = 1;
159         if (session_open(the_authctxt, c->self) != 1) {
160 diff -r -u -p1 openssh-4.3p1/ssh.c patch/ssh.c
161 --- openssh-4.3p1/ssh.c 2005-12-31 00:33:37.000000000 -0500
162 +++ patch/ssh.c 2006-02-01 07:02:41.000000000 -0500
163 @@ -159,3 +159,3 @@ usage(void)
164         fprintf(stderr,
165 -"usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]\n"
166 +"usage: ssh [-1246AaCfgkMNnqRrsTtVvXxY] [-b bind_address] [-c cipher_spec]\n"
167  "           [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
168 @@ -165,2 +165,3 @@ usage(void)
169  "           [-w tunnel:tunnel] [user@]hostname [command]\n"
170 +"           [-r receive buffer size]\n"
171         );
172 @@ -244,5 +245,8 @@ main(int ac, char **av)
173  
174 +        /* need to set options.tcp_rcv_buf to 0 */
175 +        options.tcp_rcv_buf = 0;
176
177  again:
178         while ((opt = getopt(ac, av,
179 -           "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:L:MNO:PR:S:TVw:XY")) != -1) {
180 +           "1246ab:c:e:fgi:kl:m:no:p:qr:stvxACD:F:I:L:MNO:PR:S:TVw:XY")) != -1) {
181                 switch (opt) {
182 @@ -497,2 +501,5 @@ again:
183                         break;
184 +               case 'r':
185 +                       options.tcp_rcv_buf = atoi(optarg) * 1024;
186 +                       break;
187                 default:
188 @@ -1132,2 +1139,3 @@ ssh_session2_open(void)
189         if (tty_flag) {
190 +               window = 4*CHAN_SES_PACKET_DEFAULT;
191                 window >>= 1;
192 @@ -1139,3 +1147,5 @@ ssh_session2_open(void)
193             "client-session", /*nonblock*/0);
194 -
195 +       if (!tty_flag && (!(datafellows & SSH_BUG_LARGEWINDOW))) {
196 +               c->dynamic_window = 1;
197 +       }
198         debug3("ssh_session2_open: channel_new: %d", c->self);
199 Only in patch: ssh.c.rej
200 diff -r -u -p1 openssh-4.3p1/sshconnect.c patch/sshconnect.c
201 --- openssh-4.3p1/sshconnect.c  2005-12-13 03:29:03.000000000 -0500
202 +++ patch/sshconnect.c  2006-02-01 10:26:11.000000000 -0500
203 @@ -168,2 +168,25 @@ ssh_create_socket(int privileged, struct
204                         debug("Allocated local port %d.", p);
205 +
206 +               
207 +               /* tuning needs to happen after the socket is */
208 +               /* created but before the connection happens */
209 +               /* so winscale is negotiated properly -cjr */
210 +               
211 +               /* Set tcp receive buffer if requested */
212 +               if (options.tcp_rcv_buf) 
213 +                 {
214 +                   if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, 
215 +                                  (void *)&options.tcp_rcv_buf, 
216 +                                  sizeof(options.tcp_rcv_buf)) >= 0)
217 +                     {             
218 +                       debug("setsockopt SO_RCVBUF: %.100s", strerror(errno));
219 +                     } 
220 +                   else 
221 +                     {
222 +                       /* coudln't set the socket size to use spec. */
223 +                       /* should default to system param and continue */
224 +                       /* warn the user though - cjr */
225 +                       error("Couldn't set socket receive buffer as requested. Continuing anyway.");
226 +                     }
227 +                 }
228                 return sock;
229 @@ -173,4 +196,26 @@ ssh_create_socket(int privileged, struct
230                 error("socket: %.100s", strerror(errno));
231 -
232 -       /* Bind the socket to an alternative local IP address */
233 +       
234 +       /* tuning needs to happen after the socket is */
235 +       /* created but before the connection happens */
236 +       /* so winscale is negotiated properly -cjr */
237 +       
238 +       /* Set tcp receive buffer if requested */
239 +       if (options.tcp_rcv_buf) 
240 +         {
241 +           if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, 
242 +                          (void *)&options.tcp_rcv_buf, 
243 +                          sizeof(options.tcp_rcv_buf)) >= 0)
244 +             {             
245 +               debug("setsockopt SO_RCVBUF: %.100s", strerror(errno));
246 +             }
247 +           else 
248 +             {
249 +               /* coudln't set the socket size to use spec. */
250 +               /* should default to system param and continue */
251 +               /* warn the user though - cjr */
252 +               error("Couldn't set socket receive buffer as requested. Continuing anyway.");
253 +             }
254 +         }
255 +       
256 +               /* Bind the socket to an alternative local IP address */
257         if (options.bind_address == NULL)
258 @@ -481,3 +526,3 @@ ssh_exchange_identification(void)
259             compat20 ? PROTOCOL_MINOR_2 : minor1,
260 -           SSH_VERSION);
261 +           SSH_RELEASE);
262         if (atomicio(vwrite, connection_out, buf, strlen(buf)) != strlen(buf))
263 diff -r -u -p1 openssh-4.3p1/sshd.c patch/sshd.c
264 --- openssh-4.3p1/sshd.c        2005-12-23 22:59:12.000000000 -0500
265 +++ patch/sshd.c        2006-02-01 10:26:11.000000000 -0500
266 @@ -379,3 +379,3 @@ sshd_exchange_identification(int sock_in
267         }
268 -       snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", major, minor, SSH_VERSION);
269 +       snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", major, minor, SSH_RELEASE);
270         server_version_string = xstrdup(buf);
271 diff -r -u -p1 openssh-4.3p1/version.h patch/version.h
272 --- openssh-4.3p1/version.h     2006-02-01 06:27:31.000000000 -0500
273 +++ patch/version.h     2006-02-01 10:26:11.000000000 -0500
274 @@ -5,2 +5,3 @@
275  #define SSH_PORTABLE   "p1"
276 -#define SSH_RELEASE    SSH_VERSION SSH_PORTABLE
277 +#define SSH_HPN                "-hpn"
278 +#define SSH_RELEASE    SSH_VERSION SSH_PORTABLE SSH_HPN
This page took 0.053432 seconds and 4 git commands to generate.