]>
Commit | Line | Data |
---|---|---|
d4575b41 | 1 | diff -p -u openssh-4.2p1/buffer.c openssh-hpn-none-4.2p1/buffer.c |
2 | --- openssh-4.2p1/buffer.c 2005-03-14 07:22:26.000000000 -0500 | |
3 | +++ openssh-hpn-none-4.2p1/buffer.c 2005-09-08 12:16:10.000000000 -0400 | |
4 | @@ -107,7 +107,7 @@ restart: | |
5 | /* Increase the size of the buffer and retry. */ | |
6 | ||
7 | newlen = buffer->alloc + len + 32768; | |
8 | - if (newlen > BUFFER_MAX_LEN) | |
9 | + if (newlen > BUFFER_MAX_HPN_LEN) | |
10 | fatal("buffer_append_space: alloc %u not supported", | |
11 | newlen); | |
12 | buffer->buf = xrealloc(buffer->buf, newlen); | |
13 | diff -p -u openssh-4.2p1/buffer.h openssh-hpn-none-4.2p1/buffer.h | |
14 | --- openssh-4.2p1/buffer.h 2005-03-14 07:22:26.000000000 -0500 | |
15 | +++ openssh-hpn-none-4.2p1/buffer.h 2005-09-08 12:16:10.000000000 -0400 | |
16 | @@ -25,6 +25,7 @@ typedef struct { | |
17 | ||
18 | #define BUFFER_MAX_CHUNK 0x100000 | |
19 | #define BUFFER_MAX_LEN 0xa00000 | |
20 | +#define BUFFER_MAX_HPN_LEN (2>>29)-1 | |
21 | ||
22 | void buffer_init(Buffer *); | |
23 | void buffer_clear(Buffer *); | |
24 | diff -p -u openssh-4.2p1/channels.c openssh-hpn-none-4.2p1/channels.c | |
25 | --- openssh-4.2p1/channels.c 2005-07-17 03:22:45.000000000 -0400 | |
26 | +++ openssh-hpn-none-4.2p1/channels.c 2005-09-08 12:16:10.000000000 -0400 | |
27 | @@ -262,6 +262,7 @@ channel_new(char *ctype, int type, int r | |
28 | c->local_window_max = window; | |
29 | c->local_consumed = 0; | |
30 | c->local_maxpacket = maxpack; | |
31 | + c->dynamic_window = 0; | |
32 | c->remote_id = -1; | |
33 | c->remote_name = xstrdup(remote_name); | |
34 | c->remote_window = 0; | |
35 | @@ -716,9 +717,9 @@ static void | |
36 | channel_pre_open(Channel *c, fd_set * readset, fd_set * writeset) | |
37 | { | |
38 | u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); | |
39 | - | |
40 | + | |
41 | /* check buffer limits */ | |
42 | - limit = MIN(limit, (BUFFER_MAX_LEN - BUFFER_MAX_CHUNK - CHAN_RBUF)); | |
43 | + limit = MIN(limit, (BUFFER_MAX_HPN_LEN - BUFFER_MAX_CHUNK - CHAN_RBUF)); | |
44 | ||
45 | if (c->istate == CHAN_INPUT_OPEN && | |
46 | limit > 0 && | |
47 | @@ -1537,14 +1538,29 @@ channel_check_window(Channel *c) | |
48 | !(c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD)) && | |
49 | c->local_window < c->local_window_max/2 && | |
50 | c->local_consumed > 0) { | |
51 | + u_int32_t tcpwinsz = 0; | |
52 | + socklen_t optsz = sizeof(tcpwinsz); | |
53 | + int ret = -1; | |
54 | + u_int32_t addition = 0; | |
55 | + if (c->dynamic_window) { | |
56 | + ret = getsockopt(packet_get_connection_in(), | |
57 | + SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz); | |
58 | + if ((ret == 0) && tcpwinsz > BUFFER_MAX_HPN_LEN) | |
59 | + tcpwinsz = BUFFER_MAX_HPN_LEN; | |
60 | + } | |
61 | + if (c->dynamic_window && (ret == 0) && | |
62 | + (tcpwinsz > c->local_window_max)) { | |
63 | + addition = tcpwinsz - c->local_window_max; | |
64 | + c->local_window_max += addition; | |
65 | + } | |
66 | packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST); | |
67 | packet_put_int(c->remote_id); | |
68 | - packet_put_int(c->local_consumed); | |
69 | + packet_put_int(c->local_consumed + addition); | |
70 | packet_send(); | |
71 | debug2("channel %d: window %d sent adjust %d", | |
72 | c->self, c->local_window, | |
73 | c->local_consumed); | |
74 | - c->local_window += c->local_consumed; | |
75 | + c->local_window += c->local_consumed + addition; | |
76 | c->local_consumed = 0; | |
77 | } | |
78 | return 1; | |
79 | diff -p -u openssh-4.2p1/channels.h openssh-hpn-none-4.2p1/channels.h | |
80 | --- openssh-4.2p1/channels.h 2005-07-17 03:19:25.000000000 -0400 | |
81 | +++ openssh-hpn-none-4.2p1/channels.h 2005-09-08 12:16:10.000000000 -0400 | |
82 | @@ -99,6 +99,7 @@ struct Channel { | |
83 | u_int local_window_max; | |
84 | u_int local_consumed; | |
85 | u_int local_maxpacket; | |
86 | + int dynamic_window; | |
87 | int extended_usage; | |
88 | int single_connection; | |
89 | ||
90 | @@ -119,11 +120,11 @@ struct Channel { | |
91 | ||
92 | /* default window/packet sizes for tcp/x11-fwd-channel */ | |
93 | #define CHAN_SES_PACKET_DEFAULT (32*1024) | |
94 | -#define CHAN_SES_WINDOW_DEFAULT (4*CHAN_SES_PACKET_DEFAULT) | |
95 | +#define CHAN_SES_WINDOW_DEFAULT (0xa00000/2) | |
96 | #define CHAN_TCP_PACKET_DEFAULT (32*1024) | |
97 | -#define CHAN_TCP_WINDOW_DEFAULT (4*CHAN_TCP_PACKET_DEFAULT) | |
98 | +#define CHAN_TCP_WINDOW_DEFAULT (0xa00000/2) | |
99 | #define CHAN_X11_PACKET_DEFAULT (16*1024) | |
100 | -#define CHAN_X11_WINDOW_DEFAULT (4*CHAN_X11_PACKET_DEFAULT) | |
101 | +#define CHAN_X11_WINDOW_DEFAULT (0xa00000/2) | |
102 | ||
103 | /* possible input states */ | |
104 | #define CHAN_INPUT_OPEN 0 | |
105 | diff -p -u openssh-4.2p1/cipher.c openssh-hpn-none-4.2p1/cipher.c | |
106 | --- openssh-4.2p1/cipher.c 2005-07-17 03:02:10.000000000 -0400 | |
107 | +++ openssh-hpn-none-4.2p1/cipher.c 2005-09-08 12:16:10.000000000 -0400 | |
108 | @@ -151,7 +151,8 @@ ciphers_valid(const char *names) | |
109 | for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; | |
110 | (p = strsep(&cp, CIPHER_SEP))) { | |
111 | c = cipher_by_name(p); | |
112 | - if (c == NULL || c->number != SSH_CIPHER_SSH2) { | |
113 | + if (c == NULL || (c->number != SSH_CIPHER_SSH2 && | |
114 | +c->number != SSH_CIPHER_NONE)) { | |
115 | debug("bad cipher %s [%s]", p, names); | |
116 | xfree(cipher_list); | |
117 | return 0; | |
118 | @@ -325,6 +326,7 @@ cipher_get_keyiv(CipherContext *cc, u_ch | |
119 | int evplen; | |
120 | ||
121 | switch (c->number) { | |
122 | + case SSH_CIPHER_NONE: | |
123 | case SSH_CIPHER_SSH2: | |
124 | case SSH_CIPHER_DES: | |
125 | case SSH_CIPHER_BLOWFISH: | |
126 | @@ -359,6 +361,7 @@ cipher_set_keyiv(CipherContext *cc, u_ch | |
127 | int evplen = 0; | |
128 | ||
129 | switch (c->number) { | |
130 | + case SSH_CIPHER_NONE: | |
131 | case SSH_CIPHER_SSH2: | |
132 | case SSH_CIPHER_DES: | |
133 | case SSH_CIPHER_BLOWFISH: | |
134 | diff -p -u openssh-4.2p1/compat.c openssh-hpn-none-4.2p1/compat.c | |
135 | --- openssh-4.2p1/compat.c 2005-03-01 05:24:33.000000000 -0500 | |
136 | +++ openssh-hpn-none-4.2p1/compat.c 2005-09-08 12:16:10.000000000 -0400 | |
137 | @@ -162,6 +162,14 @@ compat_datafellows(const char *version) | |
138 | strlen(check[i].pat), 0) == 1) { | |
139 | debug("match: %s pat %s", version, check[i].pat); | |
140 | datafellows = check[i].bugs; | |
141 | + /* Check to see if the remote side is OpenSSH and not HPN */ | |
142 | + if(strstr(version,"OpenSSH") != NULL) | |
143 | + { | |
144 | + if (strstr(version,"hpn") == NULL) | |
145 | + { | |
146 | + datafellows |= SSH_BUG_LARGEWINDOW; | |
147 | + } | |
148 | + } | |
149 | return; | |
150 | } | |
151 | } | |
152 | diff -p -u openssh-4.2p1/compat.h openssh-hpn-none-4.2p1/compat.h | |
153 | --- openssh-4.2p1/compat.h 2005-03-01 05:24:33.000000000 -0500 | |
154 | +++ openssh-hpn-none-4.2p1/compat.h 2005-09-08 12:16:10.000000000 -0400 | |
155 | @@ -56,6 +56,7 @@ | |
156 | #define SSH_BUG_PROBE 0x00400000 | |
157 | #define SSH_BUG_FIRSTKEX 0x00800000 | |
158 | #define SSH_OLD_FORWARD_ADDR 0x01000000 | |
159 | +#define SSH_BUG_LARGEWINDOW 0x02000000 | |
160 | ||
161 | void enable_compat13(void); | |
162 | void enable_compat20(void); | |
163 | Common subdirectories: openssh-4.2p1/contrib and openssh-hpn-none-4.2p1/contrib | |
164 | diff -p -u openssh-4.2p1/kex.c openssh-hpn-none-4.2p1/kex.c | |
165 | --- openssh-4.2p1/kex.c 2005-07-26 07:54:56.000000000 -0400 | |
166 | +++ openssh-hpn-none-4.2p1/kex.c 2005-09-08 12:16:10.000000000 -0400 | |
167 | @@ -49,7 +49,7 @@ static void kex_kexinit_finish(Kex *); | |
168 | static void kex_choose_conf(Kex *); | |
169 | ||
170 | /* put algorithm proposal into buffer */ | |
171 | -static void | |
172 | +void | |
173 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) | |
174 | { | |
175 | u_int i; | |
176 | diff -p -u openssh-4.2p1/kex.h openssh-hpn-none-4.2p1/kex.h | |
177 | --- openssh-4.2p1/kex.h 2005-07-26 07:54:56.000000000 -0400 | |
178 | +++ openssh-hpn-none-4.2p1/kex.h 2005-09-08 12:16:10.000000000 -0400 | |
179 | @@ -122,6 +122,8 @@ struct Kex { | |
180 | void (*kex[KEX_MAX])(Kex *); | |
181 | }; | |
182 | ||
183 | +void kex_prop2buf(Buffer *, char *proposal[PROPOSAL_MAX]); | |
184 | + | |
185 | Kex *kex_setup(char *[PROPOSAL_MAX]); | |
186 | void kex_finish(Kex *); | |
187 | ||
188 | diff -p -u openssh-4.2p1/myproposal.h openssh-hpn-none-4.2p1/myproposal.h | |
189 | --- openssh-4.2p1/myproposal.h 2005-07-26 07:54:56.000000000 -0400 | |
190 | +++ openssh-hpn-none-4.2p1/myproposal.h 2005-09-08 12:16:10.000000000 -0400 | |
191 | @@ -31,7 +31,7 @@ | |
192 | "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc," \ | |
193 | "arcfour128,arcfour256,arcfour," \ | |
194 | "aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se," \ | |
195 | - "aes128-ctr,aes192-ctr,aes256-ctr" | |
196 | + "aes128-ctr,aes192-ctr,aes256-ctr,none" | |
197 | #define KEX_DEFAULT_MAC \ | |
198 | "hmac-md5,hmac-sha1,hmac-ripemd160," \ | |
199 | "hmac-ripemd160@openssh.com," \ | |
200 | Common subdirectories: openssh-4.2p1/openbsd-compat and openssh-hpn-none-4.2p1/openbsd-compat | |
201 | diff -p -u openssh-4.2p1/packet.c openssh-hpn-none-4.2p1/packet.c | |
202 | --- openssh-4.2p1/packet.c 2005-08-12 08:10:29.000000000 -0400 | |
203 | +++ openssh-hpn-none-4.2p1/packet.c 2005-09-08 12:16:10.000000000 -0400 | |
204 | @@ -1546,6 +1546,13 @@ packet_send_ignore(int nbytes) | |
205 | rnd >>= 8; | |
206 | } | |
207 | } | |
208 | +int rekey_requested = 0; | |
209 | + | |
210 | +void | |
211 | +packet_request_rekeying(void) | |
212 | +{ | |
213 | + rekey_requested = 1; | |
214 | +} | |
215 | ||
216 | #define MAX_PACKETS (1U<<31) | |
217 | int | |
218 | @@ -1553,6 +1560,11 @@ packet_need_rekeying(void) | |
219 | { | |
220 | if (datafellows & SSH_BUG_NOREKEY) | |
221 | return 0; | |
222 | + if (rekey_requested == 1) | |
223 | + { | |
224 | + rekey_requested = 0; | |
225 | + return 1; | |
226 | + } | |
227 | return | |
228 | (p_send.packets > MAX_PACKETS) || | |
229 | (p_read.packets > MAX_PACKETS) || | |
230 | diff -p -u openssh-4.2p1/packet.h openssh-hpn-none-4.2p1/packet.h | |
231 | --- openssh-4.2p1/packet.h 2005-07-26 07:54:56.000000000 -0400 | |
232 | +++ openssh-hpn-none-4.2p1/packet.h 2005-09-08 12:16:10.000000000 -0400 | |
233 | @@ -18,6 +18,9 @@ | |
234 | ||
235 | #include <openssl/bn.h> | |
236 | ||
237 | +void | |
238 | +packet_request_rekeying(void); | |
239 | + | |
240 | void packet_set_connection(int, int); | |
241 | void packet_set_nonblocking(void); | |
242 | int packet_get_connection_in(void); | |
243 | diff -p -u openssh-4.2p1/readconf.c openssh-hpn-none-4.2p1/readconf.c | |
244 | --- openssh-4.2p1/readconf.c 2005-08-12 08:11:18.000000000 -0400 | |
245 | +++ openssh-hpn-none-4.2p1/readconf.c 2005-09-08 12:16:10.000000000 -0400 | |
246 | @@ -962,6 +962,7 @@ initialize_options(Options * options) | |
247 | options->verify_host_key_dns = -1; | |
248 | options->server_alive_interval = -1; | |
249 | options->server_alive_count_max = -1; | |
250 | + options->none_switch = -1; | |
251 | options->num_send_env = 0; | |
252 | options->control_path = NULL; | |
253 | options->control_master = -1; | |
254 | @@ -1086,6 +1087,8 @@ fill_default_options(Options * options) | |
255 | options->server_alive_interval = 0; | |
256 | if (options->server_alive_count_max == -1) | |
257 | options->server_alive_count_max = 3; | |
258 | + if (options->none_switch == -1) | |
259 | + options->none_switch = 0; | |
260 | if (options->control_master == -1) | |
261 | options->control_master = 0; | |
262 | if (options->hash_known_hosts == -1) | |
263 | diff -p -u openssh-4.2p1/readconf.h openssh-hpn-none-4.2p1/readconf.h | |
264 | --- openssh-4.2p1/readconf.h 2005-06-15 23:19:42.000000000 -0400 | |
265 | +++ openssh-hpn-none-4.2p1/readconf.h 2005-09-08 12:16:10.000000000 -0400 | |
266 | @@ -57,6 +57,7 @@ typedef struct { | |
267 | int compression_level; /* Compression level 1 (fast) to 9 | |
268 | * (best). */ | |
269 | int tcp_keep_alive; /* Set SO_KEEPALIVE. */ | |
270 | + int tcp_rcv_buf; /* user switch to set tcp recv buffer */ | |
271 | LogLevel log_level; /* Level for logging. */ | |
272 | ||
273 | int port; /* Port to connect. */ | |
274 | @@ -102,6 +103,7 @@ typedef struct { | |
275 | ||
276 | int enable_ssh_keysign; | |
277 | int rekey_limit; | |
278 | + int none_switch; | |
279 | int no_host_authentication_for_localhost; | |
280 | int identities_only; | |
281 | int server_alive_interval; | |
282 | Common subdirectories: openssh-4.2p1/regress and openssh-hpn-none-4.2p1/regress | |
283 | Common subdirectories: openssh-4.2p1/scard and openssh-hpn-none-4.2p1/scard | |
284 | diff -p -u openssh-4.2p1/scp.c openssh-hpn-none-4.2p1/scp.c | |
285 | --- openssh-4.2p1/scp.c 2005-08-02 03:07:08.000000000 -0400 | |
286 | +++ openssh-hpn-none-4.2p1/scp.c 2005-09-08 12:16:50.000000000 -0400 | |
287 | @@ -231,7 +231,7 @@ main(int argc, char **argv) | |
288 | addargs(&args, "-oClearAllForwardings yes"); | |
289 | ||
290 | fflag = tflag = 0; | |
291 | - while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1) | |
292 | + while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246zS:o:F:w:")) != -1) | |
293 | switch (ch) { | |
294 | /* User-visible flags. */ | |
295 | case '1': | |
296 | @@ -239,6 +239,7 @@ main(int argc, char **argv) | |
297 | case '4': | |
298 | case '6': | |
299 | case 'C': | |
300 | + case 'z': | |
301 | addargs(&args, "-%c", ch); | |
302 | break; | |
303 | case 'o': | |
304 | @@ -292,6 +293,9 @@ main(int argc, char **argv) | |
305 | setmode(0, O_BINARY); | |
306 | #endif | |
307 | break; | |
308 | + case 'w': | |
309 | + addargs(&args, "-w%s", optarg); | |
310 | + break; | |
311 | default: | |
312 | usage(); | |
313 | } | |
314 | @@ -507,7 +511,7 @@ source(int argc, char **argv) | |
315 | off_t i, amt, statbytes; | |
316 | size_t result; | |
317 | int fd = -1, haderr, indx; | |
318 | - char *last, *name, buf[2048]; | |
319 | + char *last, *name, buf[16384]; | |
320 | int len; | |
321 | ||
322 | for (indx = 0; indx < argc; ++indx) { | |
323 | @@ -567,7 +571,11 @@ syserr: run_err("%s: %s", name, strerr | |
324 | (void) atomicio(vwrite, remout, buf, strlen(buf)); | |
325 | if (response() < 0) | |
326 | goto next; | |
327 | - if ((bp = allocbuf(&buffer, fd, 2048)) == NULL) { | |
328 | + /* this change decreases the number of read/write syscalls*/ | |
329 | + /* when scp acts as data source. this is the critical change*/ | |
330 | + /* buf can actually remain at 2k but increasing both to 16k*/ | |
331 | + /* seemed to make sense*/ | |
332 | + if ((bp = allocbuf(&buffer, fd, sizeof(buf))) == NULL) { | |
333 | next: (void) close(fd); | |
334 | continue; | |
335 | } | |
336 | @@ -728,7 +736,7 @@ sink(int argc, char **argv) | |
337 | int amt, exists, first, mask, mode, ofd, omode; | |
338 | off_t size, statbytes; | |
339 | int setimes, targisdir, wrerrno = 0; | |
340 | - char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; | |
341 | + char ch, *cp, *np, *targ, *why, *vect[1], buf[16384]; | |
342 | struct timeval tv[2]; | |
343 | ||
344 | #define atime tv[0] | |
345 | @@ -889,7 +897,7 @@ bad: run_err("%s: %s", np, strerror(er | |
346 | continue; | |
347 | } | |
348 | (void) atomicio(vwrite, remout, "", 1); | |
349 | - if ((bp = allocbuf(&buffer, ofd, 4096)) == NULL) { | |
350 | + if ((bp = allocbuf(&buffer, ofd, sizeof(buf))) == NULL) { | |
351 | (void) close(ofd); | |
352 | continue; | |
353 | } | |
354 | @@ -899,8 +907,8 @@ bad: run_err("%s: %s", np, strerror(er | |
355 | statbytes = 0; | |
356 | if (showprogress) | |
357 | start_progress_meter(curfile, size, &statbytes); | |
358 | - for (count = i = 0; i < size; i += 4096) { | |
359 | - amt = 4096; | |
360 | + for (count = i = 0; i < size; i += sizeof(buf)) { | |
361 | + amt = sizeof(buf); | |
362 | if (i + amt > size) | |
363 | amt = size - i; | |
364 | count += amt; | |
365 | @@ -917,7 +925,7 @@ bad: run_err("%s: %s", np, strerror(er | |
366 | } while (amt > 0); | |
367 | ||
368 | if (limit_rate) | |
369 | - bwlimit(4096); | |
370 | + bwlimit(sizeof(buf)); | |
371 | ||
372 | if (count == bp->cnt) { | |
373 | /* Keep reading so we stay sync'd up. */ | |
374 | @@ -1033,7 +1041,7 @@ usage(void) | |
375 | { | |
376 | (void) fprintf(stderr, | |
377 | "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" | |
378 | - " [-l limit] [-o ssh_option] [-P port] [-S program]\n" | |
379 | + " [-l limit] [-o ssh_option] [-P port] [-w buffer size] [-S program]\n" | |
380 | " [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); | |
381 | exit(1); | |
382 | } | |
383 | diff -p -u openssh-4.2p1/serverloop.c openssh-hpn-none-4.2p1/serverloop.c | |
384 | --- openssh-4.2p1/serverloop.c 2005-07-17 03:26:44.000000000 -0400 | |
385 | +++ openssh-hpn-none-4.2p1/serverloop.c 2005-09-08 12:16:10.000000000 -0400 | |
386 | @@ -895,6 +895,8 @@ server_request_session(void) | |
387 | c = channel_new("session", SSH_CHANNEL_LARVAL, | |
388 | -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT, | |
389 | 0, "server-session", 1); | |
390 | + if (!(datafellows & SSH_BUG_LARGEWINDOW)) | |
391 | + c->dynamic_window = 1; | |
392 | if (session_open(the_authctxt, c->self) != 1) { | |
393 | debug("session open failed, free channel %d", c->self); | |
394 | channel_free(c); | |
395 | diff -p -u openssh-4.2p1/sshconnect.c openssh-hpn-none-4.2p1/sshconnect.c | |
396 | --- openssh-4.2p1/sshconnect.c 2005-07-17 03:22:46.000000000 -0400 | |
397 | +++ openssh-hpn-none-4.2p1/sshconnect.c 2005-09-08 12:16:10.000000000 -0400 | |
398 | @@ -167,13 +167,58 @@ ssh_create_socket(int privileged, struct | |
399 | strerror(errno)); | |
400 | else | |
401 | debug("Allocated local port %d.", p); | |
402 | + | |
403 | + | |
404 | + /* tuning needs to happen after the socket is */ | |
405 | + /* created but before the connection happens */ | |
406 | + /* so winscale is negotiated properly -cjr */ | |
407 | + | |
408 | + /* Set tcp receive buffer if requested */ | |
409 | + if (options.tcp_rcv_buf) | |
410 | + { | |
411 | + if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, | |
412 | + (void *)&options.tcp_rcv_buf, | |
413 | + sizeof(options.tcp_rcv_buf)) >= 0) | |
414 | + { | |
415 | + debug("setsockopt SO_RCVBUF: %.100s", strerror(errno)); | |
416 | + } | |
417 | + else | |
418 | + { | |
419 | + /* coudln't set the socket size to use spec. */ | |
420 | + /* should default to system param and continue */ | |
421 | + /* warn the user though - cjr */ | |
422 | + error("Couldn't set socket receive buffer as requested. Continuing anyway."); | |
423 | + } | |
424 | + } | |
425 | return sock; | |
426 | } | |
427 | sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); | |
428 | if (sock < 0) | |
429 | error("socket: %.100s", strerror(errno)); | |
430 | - | |
431 | - /* Bind the socket to an alternative local IP address */ | |
432 | + | |
433 | + /* tuning needs to happen after the socket is */ | |
434 | + /* created but before the connection happens */ | |
435 | + /* so winscale is negotiated properly -cjr */ | |
436 | + | |
437 | + /* Set tcp receive buffer if requested */ | |
438 | + if (options.tcp_rcv_buf) | |
439 | + { | |
440 | + if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, | |
441 | + (void *)&options.tcp_rcv_buf, | |
442 | + sizeof(options.tcp_rcv_buf)) >= 0) | |
443 | + { | |
444 | + debug("setsockopt SO_RCVBUF: %.100s", strerror(errno)); | |
445 | + } | |
446 | + else | |
447 | + { | |
448 | + /* coudln't set the socket size to use spec. */ | |
449 | + /* should default to system param and continue */ | |
450 | + /* warn the user though - cjr */ | |
451 | + error("Couldn't set socket receive buffer as requested. Continuing anyway."); | |
452 | + } | |
453 | + } | |
454 | + | |
455 | + /* Bind the socket to an alternative local IP address */ | |
456 | if (options.bind_address == NULL) | |
457 | return sock; | |
458 | ||
459 | @@ -480,7 +525,7 @@ ssh_exchange_identification(void) | |
460 | snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", | |
461 | compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1, | |
462 | compat20 ? PROTOCOL_MINOR_2 : minor1, | |
463 | - SSH_VERSION); | |
464 | + SSH_RELEASE); | |
465 | if (atomicio(vwrite, connection_out, buf, strlen(buf)) != strlen(buf)) | |
466 | fatal("write: %.100s", strerror(errno)); | |
467 | client_version_string = xstrdup(buf); | |
468 | diff -p -u openssh-4.2p1/sshconnect2.c openssh-hpn-none-4.2p1/sshconnect2.c | |
469 | --- openssh-4.2p1/sshconnect2.c 2005-08-31 05:46:27.000000000 -0400 | |
470 | +++ openssh-hpn-none-4.2p1/sshconnect2.c 2005-09-08 12:16:10.000000000 -0400 | |
471 | @@ -58,6 +58,12 @@ RCSID("$OpenBSD: sshconnect2.c,v 1.142 2 | |
472 | extern char *client_version_string; | |
473 | extern char *server_version_string; | |
474 | extern Options options; | |
475 | +extern Kex *xxx_kex; | |
476 | + | |
477 | +/* tty_flag is set in ssh.c. use this in ssh_userauth2 */ | |
478 | +/* if it is set then prevent the switch to the null cipher */ | |
479 | + | |
480 | +extern int tty_flag; | |
481 | ||
482 | /* | |
483 | * SSH2 key exchange | |
484 | @@ -309,7 +315,15 @@ ssh_userauth2(const char *local_user, co | |
485 | ||
486 | pubkey_cleanup(&authctxt); | |
487 | dispatch_range(SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); | |
488 | - | |
489 | + if ((options.none_switch == 1) && !tty_flag) /* no null on tty sessions */ | |
490 | + { | |
491 | + debug("Requesting none rekeying..."); | |
492 | + myproposal[PROPOSAL_ENC_ALGS_STOC] = "none"; | |
493 | + myproposal[PROPOSAL_ENC_ALGS_CTOS] = "none"; | |
494 | + kex_prop2buf(&xxx_kex->my,myproposal); | |
495 | + packet_request_rekeying(); | |
496 | + fprintf(stderr, "WARNING: ENABLED NULL CIPHER\n"); | |
497 | + } | |
498 | debug("Authentication succeeded (%s).", authctxt.method->name); | |
499 | } | |
500 | ||
501 | diff -p -u openssh-4.2p1/sshd.c openssh-hpn-none-4.2p1/sshd.c | |
502 | --- openssh-4.2p1/sshd.c 2005-07-26 07:54:56.000000000 -0400 | |
503 | +++ openssh-hpn-none-4.2p1/sshd.c 2005-09-08 12:16:10.000000000 -0400 | |
504 | @@ -377,7 +377,7 @@ sshd_exchange_identification(int sock_in | |
505 | major = PROTOCOL_MAJOR_1; | |
506 | minor = PROTOCOL_MINOR_1; | |
507 | } | |
508 | - snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", major, minor, SSH_VERSION); | |
509 | + snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", major, minor, SSH_RELEASE); | |
510 | server_version_string = xstrdup(buf); | |
511 | ||
512 | /* Send our protocol version identification. */ | |
513 | diff -p -u openssh-4.2p1/version.h openssh-hpn-none-4.2p1/version.h | |
514 | --- openssh-4.2p1/version.h 2005-08-31 05:47:07.000000000 -0400 | |
515 | +++ openssh-hpn-none-4.2p1/version.h 2005-09-08 12:16:10.000000000 -0400 | |
516 | @@ -3,4 +3,5 @@ | |
517 | #define SSH_VERSION "OpenSSH_4.2" | |
518 | ||
519 | #define SSH_PORTABLE "p1" | |
520 | -#define SSH_RELEASE SSH_VERSION SSH_PORTABLE | |
521 | +#define SSH_HPN "-hpn" | |
522 | +#define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN | |
523 | diff -p -u openssh-4.2p1/ssh.c openssh-hpn-none-4.2p1/ssh.c | |
524 | --- openssh-4.2p1/ssh.c 2005-08-12 08:10:56.000000000 -0400 | |
525 | +++ openssh-hpn-none-4.2p1/ssh.c 2005-09-08 12:16:10.000000000 -0400 | |
526 | @@ -161,7 +161,7 @@ usage(void) | |
527 | { | |
528 | fprintf(stderr, | |
529 | "usage: ssh [-1246AaBCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]\n" | |
530 | -" [-D port] [-e escape_char] [-F configfile]\n" | |
531 | +" [-D port] [-e escape_char] [-F configfile] [-w receive buffer size]\n" | |
532 | " [-i identity_file] [-L [bind_address:]port:host:hostport]\n" | |
533 | " [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" | |
534 | " [-R [bind_address:]port:host:hostport] [-S ctl_path]\n" | |
535 | @@ -242,9 +242,12 @@ main(int ac, char **av) | |
536 | /* Parse command-line arguments. */ | |
537 | host = NULL; | |
538 | ||
539 | + /* need to set options.tcp_rcv_buf to 0 */ | |
540 | + options.tcp_rcv_buf = 0; | |
541 | + | |
542 | again: | |
543 | while ((opt = getopt(ac, av, | |
544 | - "1246ab:c:e:fgi:kl:m:no:p:qstvxABCD:F:I:L:MNO:PR:S:TVXY")) != -1) { | |
545 | + "1246ab:c:e:fgi:kl:m:no:p:qstvw:xzABCD:F:I:L:MNO:PR:S:TVXY")) != -1) { | |
546 | switch (opt) { | |
547 | case '1': | |
548 | options.protocol = SSH_PROTO_1; | |
549 | @@ -466,6 +469,7 @@ again: | |
550 | break; | |
551 | case 'T': | |
552 | no_tty_flag = 1; | |
553 | + options.none_switch = 0; | |
554 | break; | |
555 | case 'o': | |
556 | dummy = 1; | |
557 | @@ -489,6 +493,16 @@ again: | |
558 | case 'F': | |
559 | config = optarg; | |
560 | break; | |
561 | + case 'w': | |
562 | + options.tcp_rcv_buf = atoi(optarg); | |
563 | + break; | |
564 | + case 'z': | |
565 | + /* make sure we can't turn on the none_switch */ | |
566 | + /* if they try to force a no tty flag on a tty session */ | |
567 | + if (!no_tty_flag) { | |
568 | + options.none_switch = 1; | |
569 | + } | |
570 | + break; | |
571 | default: | |
572 | usage(); | |
573 | } | |
574 | @@ -1098,6 +1112,7 @@ ssh_session2_open(void) | |
575 | window = CHAN_SES_WINDOW_DEFAULT; | |
576 | packetmax = CHAN_SES_PACKET_DEFAULT; | |
577 | if (tty_flag) { | |
578 | + window = 4*CHAN_SES_PACKET_DEFAULT; | |
579 | window >>= 1; | |
580 | packetmax >>= 1; | |
581 | } | |
582 | @@ -1106,6 +1121,9 @@ ssh_session2_open(void) | |
583 | window, packetmax, CHAN_EXTENDED_WRITE, | |
584 | "client-session", /*nonblock*/0); | |
585 | ||
586 | + if (!tty_flag && (!(datafellows & SSH_BUG_LARGEWINDOW))) { | |
587 | + c->dynamic_window = 1; | |
588 | + } | |
589 | debug3("ssh_session2_open: channel_new: %d", c->self); | |
590 | ||
591 | channel_send_open(c->self); |