Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jun 2011 22:56:02 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r222587 - user/brooks/openssh-hpn
Message-ID:  <201106012256.p51Mu2OC090320@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Jun  1 22:56:02 2011
New Revision: 222587
URL: http://svn.freebsd.org/changeset/base/222587

Log:
  Remove some of my XXX's.  More general whitespace cleanups.

Modified:
  user/brooks/openssh-hpn/buffer.c
  user/brooks/openssh-hpn/buffer.h
  user/brooks/openssh-hpn/channels.c
  user/brooks/openssh-hpn/kex.c
  user/brooks/openssh-hpn/readconf.c
  user/brooks/openssh-hpn/servconf.c
  user/brooks/openssh-hpn/ssh.c
  user/brooks/openssh-hpn/sshconnect.c
  user/brooks/openssh-hpn/sshconnect2.c

Modified: user/brooks/openssh-hpn/buffer.c
==============================================================================
--- user/brooks/openssh-hpn/buffer.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/buffer.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -25,7 +25,6 @@
 #include "log.h"
 
 #define	BUFFER_MAX_CHUNK	0x100000
-#define	BUFFER_MAX_LEN		0xa00000
 #define	BUFFER_ALLOCSZ		0x008000
 
 /* Initializes the buffer structure. */
@@ -127,7 +126,7 @@ restart:
 
 	/* Increase the size of the buffer and retry. */
 	newlen = roundup(buffer->alloc + len, BUFFER_ALLOCSZ);
-	if (newlen > BUFFER_MAX_LEN_HPN)
+	if (newlen > BUFFER_MAX_LEN)
 		fatal("buffer_append_space: alloc %u not supported",
 		    newlen);
 	buffer->buf = xrealloc(buffer->buf, 1, newlen);

Modified: user/brooks/openssh-hpn/buffer.h
==============================================================================
--- user/brooks/openssh-hpn/buffer.h	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/buffer.h	Wed Jun  1 22:56:02 2011	(r222587)
@@ -16,8 +16,7 @@
 #ifndef BUFFER_H
 #define BUFFER_H
 
-/* move the following to a more appropriate place and name */
-#define BUFFER_MAX_LEN_HPN          0x4000000  /* 64MB */
+#define BUFFER_MAX_LEN		0x4000000 /* 64MB */
 
 typedef struct {
 	u_char	*buf;		/* Buffer for data. */

Modified: user/brooks/openssh-hpn/channels.c
==============================================================================
--- user/brooks/openssh-hpn/channels.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/channels.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -821,12 +821,12 @@ int channel_tcpwinsz () {
 	if (!packet_connection_is_on_socket()) 
 		return(128*1024);
 	ret = getsockopt(packet_get_connection_in(),
-	     SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
+	    SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
 	/* return no more than 64MB */
-	if ((ret == 0) && tcpwinsz > BUFFER_MAX_LEN_HPN)
-		tcpwinsz = BUFFER_MAX_LEN_HPN;
+	if ((ret == 0) && tcpwinsz > BUFFER_MAX_LEN)
+		tcpwinsz = BUFFER_MAX_LEN;
 	debug2("tcpwinsz: %d for connection: %d", tcpwinsz, 
-		packet_get_connection_in());
+	    packet_get_connection_in());
 	return(tcpwinsz);
 }
 
@@ -2679,7 +2679,8 @@ channel_set_hpn(int external_hpn_disable
 {
       	hpn_disabled = external_hpn_disabled;
 	hpn_buffer_size = external_hpn_buffer_size;
-	debug("HPN Disabled: %d, HPN Buffer Size: %d", hpn_disabled, hpn_buffer_size);
+	debug("HPN Disabled: %d, HPN Buffer Size: %d",
+	    hpn_disabled, hpn_buffer_size);
 }
 
 static int
@@ -2835,7 +2836,6 @@ channel_setup_fwd_listener(int type, con
 		}
 
 		/* Allocate a channel number for the socket. */
-		/* explicitly test for hpn disabled option. if true use smaller window size */
 		if (hpn_disabled) {
 			c = channel_new("port listener", type, sock, sock, -1,
 			    CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
@@ -3389,7 +3389,6 @@ x11_create_display_inet(int x11_display_
 	*chanids = xcalloc(num_socks + 1, sizeof(**chanids));
 	for (n = 0; n < num_socks; n++) {
 		sock = socks[n];
-		/* Is this really necassary? */
 		if (hpn_disabled) {
 			nc = channel_new("x11 listener",
 			    SSH_CHANNEL_X11_LISTENER, sock, sock, -1,

Modified: user/brooks/openssh-hpn/kex.c
==============================================================================
--- user/brooks/openssh-hpn/kex.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/kex.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -450,7 +450,6 @@ kex_choose_conf(Kex *kex)
 		choose_enc (&newkeys->enc,  cprop[nenc],  sprop[nenc]);
 		choose_mac (&newkeys->mac,  cprop[nmac],  sprop[nmac]);
 		choose_comp(&newkeys->comp, cprop[ncomp], sprop[ncomp]);
-		debug("REQUESTED ENC.NAME is '%s'", newkeys->enc.name);
 		if (strcmp(newkeys->enc.name, "none") == 0) {
 			debug("Requesting NONE. Authflag is %d", auth_flag);			
 			if (auth_flag == 1)

Modified: user/brooks/openssh-hpn/readconf.c
==============================================================================
--- user/brooks/openssh-hpn/readconf.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/readconf.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -535,6 +535,10 @@ parse_flag:
 		intptr = &options->tcp_rcv_buf_poll;
 		goto parse_flag;
 
+	case oTcpRcvBuf:
+		intptr = &options->tcp_rcv_buf;
+		goto parse_int;
+
 	case oVerifyHostKeyDNS:
 		intptr = &options->verify_host_key_dns;
 		goto parse_yesnoask;
@@ -713,10 +717,6 @@ parse_int:
 		intptr = &options->connection_attempts;
 		goto parse_int;
 
-	case oTcpRcvBuf:
-		intptr = &options->tcp_rcv_buf;
-		goto parse_int;
-
 	case oCipher:
 		intptr = &options->cipher;
 		arg = strdelim(&s);
@@ -1351,12 +1351,8 @@ fill_default_options(Options * options)
 		/* if a user tries to set the size to 0 set it to 1KB */
 		if (options->hpn_buffer_size == 0)
 			options->hpn_buffer_size = 1024;
-		/* XXX: BUFFER_SIZE */
-		if (options->hpn_buffer_size > 65536) {
-			options->hpn_buffer_size = 65536*1024;
-			debug("User requested buffer larger than 64MB.  "
-			    "Request reverted to 64MB");
-		}
+		if (options->hpn_buffer_size > BUFFER_MAX_LEN/1024)
+			options->hpn_buffer_size = BUFFER_MAX_LEN;
 		debug("hpn_buffer_size set to %d", options->hpn_buffer_size);
 	}
 	if (options->tcp_rcv_buf == 0)

Modified: user/brooks/openssh-hpn/servconf.c
==============================================================================
--- user/brooks/openssh-hpn/servconf.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/servconf.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -311,17 +311,16 @@ fill_default_server_options(ServerOption
 		} 
 	} else {
 		/*
-                 * In the case that the user sets both values in
-                 * a contradictory manner hpn_disabled overrrides
-                 * hpn_buffer_size.
+		 * In the case that the user sets both values in
+		 * a contradictory manner hpn_disabled overrrides
+		 * hpn_buffer_size.
 		 */
 		if (options->hpn_disabled <= 0) {
 			if (options->hpn_buffer_size == 0)
 				options->hpn_buffer_size = 1;
-			/* XXX: MAX_BUFFER_SIZE */
 			/* limit the maximum buffer to 64MB */
-			if (options->hpn_buffer_size > 64*1024)
-				options->hpn_buffer_size = 64*1024*1024;
+			if (options->hpn_buffer_size > BUFFER_MAX_LEN/1024)
+				options->hpn_buffer_size = BUFFER_MAX_LEN;
 			else
 				options->hpn_buffer_size *= 1024;
 		} else

Modified: user/brooks/openssh-hpn/ssh.c
==============================================================================
--- user/brooks/openssh-hpn/ssh.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/ssh.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -548,7 +548,7 @@ main(int ac, char **av)
 			/*
 			 * Ensure that the user does not try to backdoor
 			 * a null cipher switch on an interactive session
-			 * so explicitly disable it if the user asks for
+			 * by explicitly disabling it if the user asks for
 			 * a session without a tty.
 			 */
 			options.none_switch=0;
@@ -1421,7 +1421,6 @@ ssh_session2_open(void)
 				    options.hpn_buffer_size);
 			}
  		}
-		
 	}
 
 	debug("Final hpn_buffer_size = %d", options.hpn_buffer_size);

Modified: user/brooks/openssh-hpn/sshconnect.c
==============================================================================
--- user/brooks/openssh-hpn/sshconnect.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/sshconnect.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -195,7 +195,8 @@ ssh_set_socket_recvbuf(int sock)
 	int socksize;
 	int socksizelen = sizeof(int);
 
-	debug("setsockopt Attempting to set SO_RCVBUF to %d", options.tcp_rcv_buf);
+	debug("setsockopt Attempting to set SO_RCVBUF to %d",
+	    options.tcp_rcv_buf);
 	if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, buf, sz) >= 0) {
 		getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
 		    &socksize, &socksizelen);

Modified: user/brooks/openssh-hpn/sshconnect2.c
==============================================================================
--- user/brooks/openssh-hpn/sshconnect2.c	Wed Jun  1 21:00:28 2011	(r222586)
+++ user/brooks/openssh-hpn/sshconnect2.c	Wed Jun  1 22:56:02 2011	(r222587)
@@ -427,10 +427,10 @@ ssh_userauth2(const char *local_user, co
 	dispatch_range(SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL);
 
 	/*
-         * If the user wants to use the none cipher, do it post
-         * authentication and only if the right conditions are met.
-         * Both of the NONE commands must be true and there must be no
-         * tty allocated.
+	 * If the user wants to use the none cipher, do it post
+	 * authentication and only if the right conditions are met.
+	 * Both of the NONE commands must be true and there must be no
+	 * tty allocated.
 	 */
 	if ((options.none_switch == 1) && (options.none_enabled == 1)) {
 		if (!tty_flag) /* no null on tty sessions */ {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106012256.p51Mu2OC090320>