summarylogtreecommitdiffstats
path: root/hpn-revert-default-port-2222.patch
blob: fa377b58423830a9161fc2eaf5bb9c1c457e18f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
diff --git a/HPN-README b/HPN-README
index d559a565c..1ed9afb77 100644
--- a/HPN-README
+++ b/HPN-README
@@ -5,16 +5,6 @@ Changes in LibreSSL version 3.5 and 3.6 prevent the use of the threaded AES CTR
 In those cases HPNSSH will fallback to the serial versionof the AES CTR cipher. A warning
 is printed to stderr. 
 
-Automatic Port Fallback (in version 17v3)
-The hpnssh client now uses TCP port 2222 to connect automatically as this is the
-default hpnsshd port. However, we understand that many users will be end up connecting
-standard SSH servers on port 22. To make the easier for users the client will fall back to
-port 22 in the event that there is no hpnssh server running on port 2222. The behaviour can
-be modifed as follows:
--oFallback=[yes|no] will enable or disable port fallback. Default is yes.
--oFallbackPort=[N] where N is the port number that should be used for fall back.
-    Default is 22.
-
 TCP_INFO Metrics
 This features allows the client to request tcp networking information from the
 TCP_INFO struct. This includes data on retransmits, round trip time, lost packets,
diff --git a/readconf.c b/readconf.c
index 5f9c04279..b85ec82c7 100644
--- a/readconf.c
+++ b/readconf.c
@@ -168,7 +168,7 @@ typedef enum {
 	oLocalCommand, oPermitLocalCommand, oRemoteCommand,
 	oTcpRcvBufPoll, oTcpRcvBuf, oHPNDisabled, oHPNBufferSize,
 	oNoneEnabled, oNoneMacEnabled, oNoneSwitch, oHPNBufferLimit,
-	oMetrics, oMetricsPath, oMetricsInterval, oFallback, oFallbackPort,
+	oMetrics, oMetricsPath, oMetricsInterval,
 	oVisualHostKey,
 	oKexAlgorithms, oIPQoS, oRequestTTY, oSessionType, oStdinNull,
 	oForkAfterAuthentication, oIgnoreUnknown, oProxyUseFdpass,
@@ -309,8 +309,6 @@ static struct {
 	{ "metrics", oMetrics },
 	{ "metricspath", oMetricsPath },
 	{ "metricsinterval", oMetricsInterval },
-	{ "fallback", oFallback },
-	{ "fallbackport", oFallbackPort },
 	{ "sessiontype", oSessionType },
 	{ "stdinnull", oStdinNull },
 	{ "forkafterauthentication", oForkAfterAuthentication },
@@ -531,7 +529,7 @@ default_ssh_port(void)
 
 	if (port == 0) {
 		sp = getservbyname(SSH_SERVICE_NAME, "tcp");
-		port = sp ? ntohs(sp->s_port) : HPNSSH_DEFAULT_PORT;
+		port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT;
 	}
 	return port;
 }
@@ -1187,15 +1185,7 @@ parse_time:
 		options->metrics = 1;
 		goto parse_string;
 
-	case oFallback:
-		intptr = &options->fallback;
-		goto parse_flag;
-
-	case oFallbackPort:
-		intptr = &options->fallback_port;
-		goto parse_int;
-
-	/*
+	 /*
 	 * We check to see if the command comes from the command
 	 * line or not. If it does then enable it otherwise fail.
 	 *  NONE should never be a default configuration.
@@ -2511,8 +2501,6 @@ initialize_options(Options * options)
 	options->hpn_disabled = -1;
 	options->hpn_buffer_size = -1;
 	options->hpn_buffer_limit = -1;
-	options->fallback = -1;
-	options->fallback_port = -1;
 	options->tcp_rcv_buf_poll = -1;
 	options->tcp_rcv_buf = -1;
 	options->session_type = -1;
@@ -2725,10 +2713,6 @@ fill_default_options(Options * options)
 		options->metrics_interval = 5;
 	if (options->control_master == -1)
 		options->control_master = 0;
-	if (options->fallback == -1)
-		options->fallback = 1;
-	if (options->fallback_port == -1)
-		options->fallback_port = SSH_DEFAULT_PORT;
 	if (options->control_persist == -1) {
 		options->control_persist = 0;
 		options->control_persist_timeout = 0;
diff --git a/readconf.h b/readconf.h
index 452751b36..953be98ab 100644
--- a/readconf.h
+++ b/readconf.h
@@ -130,8 +130,6 @@ typedef struct {
         int     metrics; /* enable metrics */
         int     metrics_interval; /* time in seconds between polls */
         char   *metrics_path; /* path for the metrics files */
-	int     fallback; /* en|disable fallback port (def: true) */
-	int     fallback_port; /* port to fallback to (def: 22) */
 	int	rekey_interval;
 
 	int	no_host_authentication_for_localhost;
diff --git a/ssh.c b/ssh.c
index 0543ca971..72b555097 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1563,36 +1563,10 @@ main(int ac, char **av)
 		timeout_ms = options.connection_timeout * 1000;
 
 	/* Open a connection to the remote host. */
-	/* we try initially on the default hpnssh port returned by
-	 * default_ssh_port() which now returns HPNSSH_DEFAULT_PORT
-	 * if that fails we reset the port to SSH_DEFAULT_PORT
-	 * -cjr 8/17/2022
-	 */
-tryagain:
 	if (ssh_connect(ssh, host, options.host_arg, addrs, &hostaddr,
 	    options.port, options.connection_attempts,
-	    &timeout_ms, options.tcp_keep_alive) != 0) {
-		/* could not connect. If the port requested is the same as
-		 * hpnssh default port then fallback. Otherwise, exit */
-		if ((options.port == default_ssh_port()) && options.fallback) {
-			int port = options.fallback_port;
-			options.port = port;
-			fprintf(stderr, "HPNSSH server not available on default port %d\n",
-				default_ssh_port());
-			if (port == 22)
-				fprintf(stderr, "Falling back to OpenSSH default port %d\n",
-					port);
-			else
-				fprintf(stderr, "Falling back to user defined port %d\n",
-					port);
-			addrs = resolve_host(host, port, 1,
-					     cname, sizeof(cname));
-			goto tryagain;
-		} else {
-			exit(255);
-		}
+	    &timeout_ms, options.tcp_keep_alive) != 0)
 		exit(255);
-	}
 
 	if (addrs != NULL)
 		freeaddrinfo(addrs);
diff --git a/ssh.h b/ssh.h
index c63911545..8aa1633a6 100644
--- a/ssh.h
+++ b/ssh.h
@@ -17,7 +17,6 @@
 
 /* Default port number. */
 #define SSH_DEFAULT_PORT	22
-#define HPNSSH_DEFAULT_PORT    2222
 
 /*
  * Maximum number of certificate files that can be specified