This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new da5ea3185b build: remove the SOCKS_WITH_TS build condition (#9776)
da5ea3185b is described below
commit da5ea3185b41371ccf7cfed375bc3c8b50b7f74f
Author: James Peach <[email protected]>
AuthorDate: Wed Jun 7 16:51:37 2023 +1000
build: remove the SOCKS_WITH_TS build condition (#9776)
The SOCKS_WITH_TS define is hardcoded to true, and there's no way to
alter that in the build. Remove it, on the assumption that this is a
legacy olden days configuration.
Signed-off-by: James Peach <[email protected]>
---
iocore/net/I_Socks.h | 6 ------
iocore/net/P_Socks.h | 18 +-----------------
iocore/net/Socks.cc | 19 -------------------
iocore/net/UnixNetProcessor.cc | 19 +++++++++----------
4 files changed, 10 insertions(+), 52 deletions(-)
diff --git a/iocore/net/I_Socks.h b/iocore/net/I_Socks.h
index e1249e77f6..fc090bafa4 100644
--- a/iocore/net/I_Socks.h
+++ b/iocore/net/I_Socks.h
@@ -23,12 +23,6 @@
#pragma once
-/*When this is being compiled with TS, we enable more features the use
- non modularized stuff. namely:
- ip_ranges and multiple socks server support.
-*/
-#define SOCKS_WITH_TS
-
#define SOCKS_DEFAULT_VERSION 0 // defined the configuration variable
#define SOCKS4_VERSION 4
#define SOCKS5_VERSION 5
diff --git a/iocore/net/P_Socks.h b/iocore/net/P_Socks.h
index d92737792f..b622fb7e28 100644
--- a/iocore/net/P_Socks.h
+++ b/iocore/net/P_Socks.h
@@ -30,9 +30,7 @@
#include "I_Socks.h"
#include "tscpp/util/ts_errata.h"
-#ifdef SOCKS_WITH_TS
#include "ParentSelection.h"
-#endif
enum {
// types of events for Socks auth handlers
@@ -57,21 +55,9 @@ struct socks_conf_struct {
int accept_port = 0;
unsigned short http_port = 1080;
-#ifdef SOCKS_WITH_TS
swoc::IPRangeSet ip_addrs;
-#endif
-#ifndef SOCKS_WITH_TS
- IpEndpoint server_addr;
-#endif
-
- socks_conf_struct()
-
- {
-#if !defined(SOCKS_WITH_TS)
- memset(&server_addr, 0, sizeof(server_addr));
-#endif
- }
+ socks_conf_struct() {}
};
extern struct socks_conf_struct *g_socks_conf_stuff;
@@ -124,12 +110,10 @@ struct SocksEntry : public Continuation {
SocksAuthHandler auth_handler = nullptr;
unsigned char socks_cmd = NORMAL_SOCKS;
-#ifdef SOCKS_WITH_TS
// socks server selection:
ParentConfigParams *server_params = nullptr;
HttpRequestData req_data; // We dont use any http specific fields.
ParentResult server_result;
-#endif
int startEvent(int event, void *data);
int mainEvent(int event, void *data);
diff --git a/iocore/net/Socks.cc b/iocore/net/Socks.cc
index c60624e3a1..8fd4260dcc 100644
--- a/iocore/net/Socks.cc
+++ b/iocore/net/Socks.cc
@@ -73,7 +73,6 @@ SocksEntry::init(Ptr<ProxyMutex> &m, SocksNetVC *vc, unsigned
char socks_support
ats_ip_copy(&target_addr, vc->get_remote_addr());
-#ifdef SOCKS_WITH_TS
req_data.hdr = nullptr;
req_data.hostname_str = nullptr;
req_data.api_info = nullptr;
@@ -86,7 +85,6 @@ SocksEntry::init(Ptr<ProxyMutex> &m, SocksNetVC *vc, unsigned
char socks_support
ats_ip_copy(&req_data.src_ip, &target_addr);
server_params = SocksServerConfig::acquire();
-#endif
nattempts = 0;
findServer();
@@ -102,7 +100,6 @@ SocksEntry::findServer()
unsigned int fail_threshold = server_params->policy.FailThreshold;
unsigned int retry_time = server_params->policy.ParentRetryTime;
-#ifdef SOCKS_WITH_TS
if (nattempts == 1) {
ink_assert(server_result.result == PARENT_UNDEFINED);
server_params->findParent(&req_data, &server_result, fail_threshold,
retry_time);
@@ -140,12 +137,6 @@ SocksEntry::findServer()
case PARENT_FAIL:
memset(&server_addr, 0, sizeof(server_addr));
}
-#else
- if (nattempts > netProcessor.socks_conf_stuff->connection_attempts)
- memset(&server_addr, 0, sizeof(server_addr));
- else
- ats_ip_copy(&server_addr, &g_socks_conf_stuff->server_addr);
-#endif // SOCKS_WITH_TS
char buff[INET6_ADDRSTRLEN];
Dbg(dbg_ctl_SocksParent, "findServer result: %s:%d",
ats_ip_ntop(&server_addr.sa, buff, sizeof(buff)),
@@ -164,11 +155,9 @@ SocksEntry::free()
timeout->cancel(this);
}
-#ifdef SOCKS_WITH_TS
if (!lerrno && netVConnection && server_result.retry) {
server_params->markParentUp(&server_result);
}
-#endif
if ((action_.cancelled || lerrno) && netVConnection) {
netVConnection->do_io_close();
@@ -189,9 +178,7 @@ SocksEntry::free()
action_.continuation->handleEvent(NET_EVENT_OPEN, netVConnection);
}
}
-#ifdef SOCKS_WITH_TS
SocksServerConfig::release(server_params);
-#endif
free_MIOBuffer(buf);
action_ = nullptr;
@@ -469,9 +456,7 @@ loadSocksConfiguration(socks_conf_struct *socks_conf_stuff)
{
int socks_config_fd = -1;
ats_scoped_str config_pathname;
-#ifdef SOCKS_WITH_TS
swoc::Errata errata;
-#endif
std::error_code ec;
std::string config_text;
@@ -506,9 +491,7 @@ loadSocksConfiguration(socks_conf_struct *socks_conf_stuff)
"accept_port = %d http_port = %d",
socks_conf_stuff->accept_enabled, socks_conf_stuff->accept_port,
socks_conf_stuff->http_port);
-#ifdef SOCKS_WITH_TS
SocksServerConfig::startup();
-#endif
config_pathname =
RecConfigReadConfigPath("proxy.config.socks.socks_config_file");
Dbg(dbg_ctl_Socks, "Socks Config File: %s", (const char *)config_pathname);
@@ -525,7 +508,6 @@ loadSocksConfiguration(socks_conf_struct *socks_conf_stuff)
goto error;
}
-#ifdef SOCKS_WITH_TS
errata = loadSocksIPAddrs(config_text, socks_conf_stuff);
if (!errata.is_ok()) {
@@ -533,7 +515,6 @@ loadSocksConfiguration(socks_conf_struct *socks_conf_stuff)
Error("%s", config_text.c_str());
goto error;
}
-#endif
if (loadSocksAuthInfo(config_text, socks_conf_stuff) != 0) {
Error("SOCKS Config: Error while reading Socks auth info");
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index 8ee1b65e7f..b98519dc6c 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -193,16 +193,15 @@ UnixNetProcessor::connect_re_internal(Continuation *cont,
sockaddr const *target
}
vc->set_context(NET_VCONNECTION_OUT);
- bool using_socks = (socks_conf_stuff->socks_needed && opt->socks_support !=
NO_SOCKS
-#ifdef SOCKS_WITH_TS
- && (opt->socks_version != SOCKS_DEFAULT_VERSION ||
- /* This implies we are tunnelling.
- * we need to connect using socks server even
- * if this ip is in no_socks list.
- */
-
!socks_conf_stuff->ip_addrs.contains(swoc::IPAddr(target)))
-#endif
- );
+
+ const bool using_socks = (socks_conf_stuff->socks_needed &&
opt->socks_support != NO_SOCKS &&
+ (opt->socks_version != SOCKS_DEFAULT_VERSION ||
+ /* This implies we are tunnelling.
+ * we need to connect using socks server even
+ * if this ip is in no_socks list.
+ */
+
!socks_conf_stuff->ip_addrs.contains(swoc::IPAddr(target))));
+
SocksEntry *socksEntry = nullptr;
vc->id = net_next_connection_number();