mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-08-26 06:23:00 +03:00
Bind outgoing connection to a specific IP address No.2
This commit is contained in:
parent
e4330ca71a
commit
c2fe874865
@ -6151,6 +6151,7 @@ void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite)
|
||||
t->ClientOption->RequireBridgeRoutingMode = old_option->RequireBridgeRoutingMode;
|
||||
t->ClientOption->DisableQoS = old_option->DisableQoS;
|
||||
t->ClientOption->BindLocalIP = old_option->BindLocalIP;// Source IP address for outgoing connection
|
||||
t->ClientOption->BindLocalPort = old_option->BindLocalPort;// Source port number for outgoing connection
|
||||
|
||||
// Inherit the authentication data
|
||||
CiFreeClientAuth(t->ClientAuth);
|
||||
@ -6459,6 +6460,7 @@ void CmDetailDlgUpdate(HWND hWnd, CM_ACCOUNT *a)
|
||||
Disable(hWnd, R_NO_ROUTING);
|
||||
#if TYPE_BINDLOCALIP
|
||||
Disable(hWnd, E_BIND_LOCALIP);// Source IP address for outgoing connection
|
||||
Disable(hWnd, E_BIND_LOCALPORT);// Source port number for outgoing connection
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -6543,6 +6545,8 @@ UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
|
||||
Check(hWnd, R_DISABLE_UDP, a->ClientOption->NoUdpAcceleration);
|
||||
#if TYPE_BINDLOCALIP
|
||||
SetIp(hWnd, E_BIND_LOCALIP, &a->ClientOption->BindLocalIP);// Source IP address for outgoing connection
|
||||
SetIntEx(hWnd, E_BIND_LOCALPORT, a->ClientOption->BindLocalPort);// Source port number for outgoing connection
|
||||
//Disable(hWnd, E_BIND_LOCALPORT); // You can not edit
|
||||
#endif
|
||||
|
||||
// Select the Connection Mode
|
||||
@ -6594,11 +6598,16 @@ UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
|
||||
#if TYPE_BINDLOCALIP
|
||||
// Source IP address for outgoing connection
|
||||
IP tmpIP;
|
||||
if (GetIp(hWnd, E_BIND_LOCALIP, &tmpIP) == false)
|
||||
if (GetIp(hWnd, E_BIND_LOCALIP, &tmpIP) == false)
|
||||
{
|
||||
FocusEx(hWnd, E_BIND_LOCALIP);
|
||||
break;
|
||||
}
|
||||
// Source port number for outgoing connection
|
||||
if ((GetInt(hWnd, E_BIND_LOCALPORT) < 0) || (GetInt(hWnd, E_BIND_LOCALPORT) > 65535)){
|
||||
FocusEx(hWnd, E_BIND_LOCALPORT);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
a->ClientOption->MaxConnection = num;
|
||||
@ -6619,6 +6628,7 @@ UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
|
||||
a->ClientOption->NoUdpAcceleration = IsChecked(hWnd, R_DISABLE_UDP);
|
||||
#if TYPE_BINDLOCALIP
|
||||
a->ClientOption->BindLocalIP = tmpIP;// Source IP address for outgoing connection
|
||||
a->ClientOption->BindLocalPort = GetInt(hWnd, E_BIND_LOCALPORT);// Source port number for outgoing connection
|
||||
#endif
|
||||
|
||||
if (a->LinkMode)
|
||||
|
@ -4342,9 +4342,9 @@ void InRpcClientOption(CLIENT_OPTION *c, PACK *p)
|
||||
PackGetStr(p, "CustomHttpHeader", c->CustomHttpHeader, sizeof(c->CustomHttpHeader));
|
||||
PackGetStr(p, "HubName", c->HubName, sizeof(c->HubName));
|
||||
PackGetStr(p, "DeviceName", c->DeviceName, sizeof(c->DeviceName));
|
||||
#if TYPE_BINDLOCALIP
|
||||
PackGetIp(p, "BindLocalIP", &c->BindLocalIP);// Source IP address for outgoing connection
|
||||
#endif
|
||||
c->BindLocalPort = PackGetInt(p, "BindLocalPort");// Source port nubmer for outgoing connection
|
||||
|
||||
c->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false;
|
||||
c->UseCompress = PackGetInt(p, "UseCompress") ? true : false;
|
||||
c->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false;
|
||||
@ -4405,9 +4405,8 @@ void OutRpcClientOption(PACK *p, CLIENT_OPTION *c)
|
||||
PackAddBool(p, "FromAdminPack", c->FromAdminPack);
|
||||
PackAddBool(p, "NoUdpAcceleration", c->NoUdpAcceleration);
|
||||
PackAddData(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE);
|
||||
#if TYPE_BINDLOCALIP
|
||||
PackAddIp(p, "BindLocalIP", &c->BindLocalIP);// Source IP address for outgoing connection
|
||||
#endif
|
||||
PackAddInt(p, "BindLocalPort", c->BindLocalPort);// Source port number for outgoing connection
|
||||
}
|
||||
|
||||
// CLIENT_AUTH
|
||||
@ -9303,6 +9302,7 @@ CLIENT_OPTION *CiLoadClientOption(FOLDER *f)
|
||||
o->FromAdminPack = CfgGetBool(f, "FromAdminPack");
|
||||
o->NoUdpAcceleration = CfgGetBool(f, "NoUdpAcceleration");
|
||||
CfgGetIp(f, "BindLocalIP", &o->BindLocalIP);// Source IP address for outgoing connection
|
||||
o->BindLocalPort = CfgGetInt(f, "BindLocalPort");// Source port number for outgoing connection
|
||||
|
||||
b = CfgGetBuf(f, "HostUniqueKey");
|
||||
if (b != NULL)
|
||||
@ -9858,6 +9858,7 @@ void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o)
|
||||
CfgAddBool(f, "DisableQoS", o->DisableQoS);
|
||||
CfgAddBool(f, "NoUdpAcceleration", o->NoUdpAcceleration);
|
||||
CfgAddIp(f, "BindLocalIP", &o->BindLocalIP);// Source IP address for outgoing connection
|
||||
CfgAddInt(f, "BindLocalPort", o->BindLocalPort);// Source port number for outgoing connection
|
||||
|
||||
if (o->FromAdminPack)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ struct RC4_KEY_PAIR
|
||||
UCHAR ServerToClientKey[16];
|
||||
UCHAR ClientToServerKey[16];
|
||||
};
|
||||
#define TYPE_BINDLOCALIP 1 // Enable HMI user to edit Source IP address for outgoing connection
|
||||
#define TYPE_BINDLOCALIP 1 // Enable HMI user to edit Source IP address & Source port number for outgoing connection
|
||||
|
||||
// Client Options
|
||||
// Do not change item size or order and only add new items at the end!
|
||||
@ -108,6 +108,7 @@ struct CLIENT_OPTION
|
||||
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE]; // Custom HTTP proxy header
|
||||
char HintStr[MAX_HOST_NAME_LEN + 1]; // Hint string for NAT-T
|
||||
IP BindLocalIP; // Source IP address for outgoing connection
|
||||
UINT BindLocalPort; // Source port number for outgoing connection
|
||||
};
|
||||
|
||||
// Client authentication data
|
||||
|
@ -6281,8 +6281,7 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
||||
if (o->PortUDP == 0)
|
||||
{
|
||||
IP *localIP;
|
||||
IP tmpIP;
|
||||
UINT localport = BIND_LOCALPORT_NULL;
|
||||
UINT localport;
|
||||
|
||||
// Top of Bind outgoing connection
|
||||
// Decide the binding operation which is explicitly executed on the client-side
|
||||
@ -6290,14 +6289,19 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
||||
// In the case of first TCP/IP connection
|
||||
if (additional_connect == false) {
|
||||
if (sess->ClientOption->NoRoutingTracking == false) {
|
||||
StrToIP(&tmpIP, "0::0"); // Zero address is for dummy not to bind
|
||||
localIP = BIND_LOCALIP_NULL; // Specify not to bind
|
||||
}
|
||||
else {
|
||||
Debug("ClientConnectGetSocket(): Using client option %r for source IP address\n", sess->ClientOption->BindLocalIP);
|
||||
Debug("ClientConnectGetSocket(): Using client option %r and %d for binding\n"
|
||||
, sess->ClientOption->BindLocalIP, sess->ClientOption->BindLocalPort);
|
||||
// Nonzero address is for source IP address to bind. Zero address is for dummy not to bind.
|
||||
tmpIP = sess->ClientOption->BindLocalIP;
|
||||
if (IsZeroIP(&sess->ClientOption->BindLocalIP) == true) {
|
||||
localIP = BIND_LOCALIP_NULL;
|
||||
}
|
||||
else {
|
||||
localIP = &sess->ClientOption->BindLocalIP;
|
||||
}
|
||||
}
|
||||
localIP = &tmpIP;
|
||||
}
|
||||
// In the case of second and subsequent TCP/IP connections
|
||||
else {
|
||||
@ -6305,6 +6309,13 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
||||
localIP = &sess->LocalIP_CacheForNextConnect;
|
||||
//localIP = BIND_LOCALIP_NULL; // Specify not to bind for test
|
||||
}
|
||||
if (sess->ClientOption->BindLocalPort == 0) {
|
||||
localport = BIND_LOCALPORT_NULL;
|
||||
}
|
||||
else {
|
||||
localport = sess->ClientOption->BindLocalPort + Count(sess->Connection->CurrentNumConnection) - 1;
|
||||
Debug("ClientConnectGetSocket(): Additional port number %u\n", localport);
|
||||
}
|
||||
// Bottom of Bind outgoing connection
|
||||
|
||||
// If additional_connect == false, enable trying to NAT-T connection
|
||||
@ -6384,19 +6395,27 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
||||
// In the case of first TCP/IP connection
|
||||
if (additional_connect == false) {
|
||||
if (sess->ClientOption->NoRoutingTracking == false) {
|
||||
IP tmpIP;
|
||||
StrToIP(&tmpIP, "0::0");
|
||||
in.BindLocalIP = tmpIP;
|
||||
in.BindLocalIP = BIND_LOCALIP_NULL; // Specify not to bind
|
||||
}
|
||||
else {
|
||||
in.BindLocalIP = sess->ClientOption->BindLocalIP;
|
||||
if (IsZeroIP(&sess->ClientOption->BindLocalIP) == true) {
|
||||
in.BindLocalIP = BIND_LOCALIP_NULL;
|
||||
}
|
||||
else {
|
||||
in.BindLocalIP = &sess->ClientOption->BindLocalIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
// In the case of second and subsequent TCP/IP connections
|
||||
else {
|
||||
in.BindLocalIP = sess->LocalIP_CacheForNextConnect;
|
||||
in.BindLocalIP = &sess->LocalIP_CacheForNextConnect;
|
||||
}
|
||||
if (sess->ClientOption->BindLocalPort == 0) {
|
||||
in.BindLocalPort = BIND_LOCALPORT_NULL;
|
||||
}
|
||||
else {
|
||||
in.BindLocalPort = sess->ClientOption->BindLocalPort + Count(sess->Connection->CurrentNumConnection) - 1;
|
||||
}
|
||||
in.BindLocalPort = BIND_LOCALPORT_NULL;
|
||||
// Bottom of Bind outgoing connection
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
@ -42,9 +42,9 @@ typedef struct SETTING
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Password
|
||||
CLIENT_OPTION ClientOption; // Client Option
|
||||
|
||||
#define IP_SIZE sizeof(IP) // Source IP address for outgoing connection
|
||||
#define SRC_SIZE (sizeof(IP) + sizeof(UINT)) // Source IP address & port number for outgoing connection
|
||||
// UCHAR Reserved[10240 - sizeof(UINT) * 8 - SHA1_SIZE - HTTP_CUSTOM_HEADER_MAX_SIZE - MAX_HOST_NAME_LEN - 1]; // Reserved area
|
||||
UCHAR Reserved[10240 - sizeof(UINT) * 8 - SHA1_SIZE - HTTP_CUSTOM_HEADER_MAX_SIZE - MAX_HOST_NAME_LEN - 1 - IP_SIZE]; // Reserved area
|
||||
UCHAR Reserved[10240 - sizeof(UINT) * 8 - SHA1_SIZE - HTTP_CUSTOM_HEADER_MAX_SIZE - MAX_HOST_NAME_LEN - 1 - SRC_SIZE]; // Reserved area
|
||||
} SETTING;
|
||||
|
||||
// Structure declaration
|
||||
|
@ -609,6 +609,24 @@ void SessionMain(SESSION *s)
|
||||
WHERE;
|
||||
}
|
||||
}
|
||||
|
||||
// If all the specified number of tcp connections are not alive continuously, then terminate the session.
|
||||
UINT num_tcp_conn = LIST_NUM(s->Connection->Tcp->TcpSockList);
|
||||
UINT max_conn = s->ClientOption->MaxConnection;
|
||||
|
||||
if ((s->CurrentConnectionEstablishTime +
|
||||
(UINT64)(s->ClientOption->AdditionalConnectionInterval * 1000 * 2 + CONNECTING_TIMEOUT * 2))
|
||||
<= Tick64())
|
||||
{
|
||||
if (s->ClientOption->BindLocalPort != 0 || num_tcp_conn == 0)
|
||||
{
|
||||
timeouted = true;
|
||||
WHERE;
|
||||
}
|
||||
}
|
||||
//Debug("SessionMain(): The number of TCP connections short... Num_Tcp_Conn=%d Max_Conn=%d Curr_Conn_Time=%llu Tick64=%llu\n"
|
||||
// , num_tcp_conn, max_conn, s->CurrentConnectionEstablishTime, Tick64());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1430,7 +1448,7 @@ void ClientThread(THREAD *t, void *param)
|
||||
while (true)
|
||||
{
|
||||
Zero(&s->ServerIP_CacheForNextConnect, sizeof(IP));
|
||||
Zero(&s->LocalIP_CacheForNextConnect, sizeof(IP));
|
||||
Zero(&s->LocalIP_CacheForNextConnect, sizeof(IP)); // Assigned by first outgoing connection
|
||||
Zero(s->UnderlayProtocol, sizeof(s->UnderlayProtocol));
|
||||
Zero(s->ProtocolDetails, sizeof(s->ProtocolDetails));
|
||||
|
||||
|
@ -13108,7 +13108,6 @@ SOCK *ListenEx63(UINT port, bool local_only, bool enable_ca, IP *listen_ip)
|
||||
#ifdef OS_WIN32
|
||||
if (enable_ca)
|
||||
{
|
||||
setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(true_flag));
|
||||
backlog = 1;
|
||||
}
|
||||
#endif
|
||||
@ -13654,6 +13653,10 @@ char *PrintError(int ErrorCode)
|
||||
{
|
||||
char *Message;
|
||||
switch (ErrorCode) {
|
||||
case WSAEFAULT:
|
||||
Message = "Bad address.";
|
||||
break;
|
||||
|
||||
case WSAEWOULDBLOCK:
|
||||
Message = "Resource temporarily unavailable.";
|
||||
break;
|
||||
@ -13666,6 +13669,10 @@ char *PrintError(int ErrorCode)
|
||||
Message = "Operation already in progress.";
|
||||
break;
|
||||
|
||||
case WSAEAFNOSUPPORT:
|
||||
Message = "Address family not supported by protocol family.";
|
||||
break;
|
||||
|
||||
case WSAEADDRINUSE:
|
||||
Message = "Address already in use.";
|
||||
break;
|
||||
@ -13814,28 +13821,30 @@ void SetSockHighPriority(SOCK *s, bool flag)
|
||||
}
|
||||
|
||||
// Bind the socket to IPv4 or IPV6 address
|
||||
int bind_sock(SOCKET sock, IP* ip, UINT port)
|
||||
int bind_sock(SOCKET sock, IP *ip, UINT port)
|
||||
{
|
||||
//char tmp[MAX_HOST_NAME_LEN + 1];
|
||||
//memset(tmp, 0, sizeof(tmp));
|
||||
//IPToStr(tmp, sizeof(tmp), ip);
|
||||
//Debug("_____ bind_sock(): Binding... IP address %s:%d\n", tmp, port);
|
||||
//Debug("bind_sock(): Binding... IP address %s:%d\n", tmp, port);
|
||||
|
||||
if (IsIP4(ip))
|
||||
{
|
||||
// Declare variables
|
||||
struct sockaddr_in sockaddr_in;
|
||||
struct in_addr in_addr;
|
||||
|
||||
Zero(&sockaddr_in, sizeof(sockaddr_in));
|
||||
Zero(&in_addr, sizeof(in_addr));
|
||||
|
||||
IPToInAddr(&in_addr, ip);
|
||||
|
||||
// Set up the sockaddr structure
|
||||
sockaddr_in.sin_family = AF_INET;
|
||||
//inet_pton(AF_INET, tmp, &addr_in.sin_addr.s_addr);
|
||||
sockaddr_in.sin_addr.s_addr = in_addr.s_addr;
|
||||
IPToInAddr(&sockaddr_in.sin_addr, ip);
|
||||
sockaddr_in.sin_port = htons((USHORT)port);
|
||||
//inet_pton(AF_INET, tmp, &addr_in.sin_addr.s_addr);
|
||||
|
||||
UINT true_flag = 1;
|
||||
// This only have enabled for UNIX system since there is a bug
|
||||
// in the implementation of REUSEADDR in Windows OS
|
||||
(void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&true_flag, sizeof(true_flag));
|
||||
|
||||
// Bind the socket using the information in the sockaddr structure
|
||||
return (bind(sock, (struct sockaddr *)&sockaddr_in, sizeof(sockaddr_in)));
|
||||
@ -13844,18 +13853,24 @@ int bind_sock(SOCKET sock, IP* ip, UINT port)
|
||||
{
|
||||
// Declare variables
|
||||
struct sockaddr_in6 sockaddr_in;
|
||||
struct in6_addr in_addr;
|
||||
|
||||
Zero(&sockaddr_in, sizeof(sockaddr_in));
|
||||
Zero(&in_addr, sizeof(in_addr));
|
||||
|
||||
IPToInAddr6(&in_addr, ip);
|
||||
|
||||
// Set up the sockaddr structure
|
||||
sockaddr_in.sin6_family = AF_INET6;
|
||||
//inet_pton(AF_INET6, tmp, &sockaddr_in.sin6_addr.s6_bytes);
|
||||
Copy(&sockaddr_in.sin6_addr, &in_addr, sizeof(in_addr));
|
||||
IPToInAddr6(&sockaddr_in.sin6_addr, ip);
|
||||
sockaddr_in.sin6_scope_id = ip->ipv6_scope_id;
|
||||
sockaddr_in.sin6_port = htons((USHORT)port);
|
||||
//inet_pton(AF_INET6, tmp, &sockaddr_in.sin6_addr.s6_bytes);
|
||||
|
||||
UINT true_flag = 1;
|
||||
#ifdef OS_UNIX
|
||||
// It is necessary to set the IPv6 Only flag on a UNIX system
|
||||
(void)setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &true_flag, sizeof(true_flag));
|
||||
#endif // OS_UNIX
|
||||
// This only have enabled for UNIX system since there is a bug
|
||||
// in the implementation of REUSEADDR in Windows OS
|
||||
(void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&true_flag, sizeof(true_flag));
|
||||
|
||||
// Bind the socket using the information in the sockaddr structure
|
||||
return (bind(sock, (struct sockaddr *)&sockaddr_in, sizeof(sockaddr_in)));
|
||||
@ -13890,6 +13905,12 @@ SOCKET BindConnectTimeoutIPv4(IP* localIP, UINT localport, IP* ip, UINT port, UI
|
||||
// Top of Bind outgoing connection
|
||||
if (s != INVALID_SOCKET) {
|
||||
int ier;
|
||||
IP tmpIP;
|
||||
|
||||
if (localIP == BIND_LOCALIP_NULL) {
|
||||
StrToIP(&tmpIP, "0.0.0.0"); // A NULL address for the argument "localIP" is treated as if "0::0" in IPV4 was specified.
|
||||
localIP = &tmpIP;
|
||||
}
|
||||
|
||||
if ((IsZeroIP(localIP) == false) || (localport != 0)) {
|
||||
|
||||
@ -14177,8 +14198,8 @@ void ConnectThreadForIPv4(THREAD* thread, void* param)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StrToIP(&p->LocalIP, "0.0.0.0");
|
||||
p->LocalPort = 0;
|
||||
p->LocalIP = BIND_LOCALIP_NULL;
|
||||
p->LocalPort = BIND_LOCALPORT_NULL;
|
||||
return BindConnectThreadForIPv4(thread, param);
|
||||
}
|
||||
|
||||
@ -14238,7 +14259,7 @@ void BindConnectThreadForIPv4(THREAD *thread, void *param)
|
||||
{
|
||||
// Normal connection without using NAT-T
|
||||
// s = ConnectTimeoutIPv4(ip, p->Port, p->Timeout, p->CancelFlag);
|
||||
s = BindConnectTimeoutIPv4(&p->LocalIP, p->LocalPort, ip, p->Port, p->Timeout, p->CancelFlag);
|
||||
s = BindConnectTimeoutIPv4(p->LocalIP, p->LocalPort, ip, p->Port, p->Timeout, p->CancelFlag);
|
||||
|
||||
if (s != INVALID_SOCKET)
|
||||
{
|
||||
@ -14547,8 +14568,8 @@ void ConnectThreadForIPv6(THREAD* thread, void* param)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StrToIP(&p->LocalIP, "0::0");
|
||||
p->LocalPort = 0;
|
||||
p->LocalIP = BIND_LOCALIP_NULL;
|
||||
p->LocalPort = BIND_LOCALPORT_NULL;
|
||||
return BindConnectThreadForIPv6(thread, param);
|
||||
}
|
||||
|
||||
@ -14613,11 +14634,17 @@ void BindConnectThreadForIPv6(THREAD* thread, void* param)
|
||||
// Top of Bind outgoing connection
|
||||
if (s != INVALID_SOCKET){
|
||||
int ier;
|
||||
IP tmpIP;
|
||||
|
||||
if ((IsZeroIP(&p->LocalIP) == false) || (p->LocalPort != 0)){
|
||||
if (p->LocalIP == BIND_LOCALIP_NULL) {
|
||||
StrToIP(&tmpIP, "0::0"); // A NULL address for the argument "p->LocalIP" is treated as if "0::0" in IPV6 was specified.
|
||||
p->LocalIP = &tmpIP;
|
||||
}
|
||||
|
||||
if ((IsZeroIP(p->LocalIP) == false) || (p->LocalPort != 0)){
|
||||
|
||||
// Bind the socket
|
||||
if (bind_sock(s, &p->LocalIP, p->LocalPort) != 0) {
|
||||
if (bind_sock(s, p->LocalIP, p->LocalPort) != 0) {
|
||||
#ifdef OS_WIN32
|
||||
ier = WSAGetLastError();
|
||||
Debug("IPv6 bind() failed with error: %d %s\n", ier, PrintError(ier));
|
||||
@ -14864,10 +14891,14 @@ SOCK *BindConnectEx5(IP *localIP, UINT localport, char *hostname, UINT port, UIN
|
||||
{
|
||||
p6.IpList = iplist_v6;
|
||||
|
||||
//ZeroIP6(&p6.LocalIP);
|
||||
Zero(&p6.LocalIP, sizeof(p6.LocalIP)); // Zero IP6 must be used when argument localIP is NULL
|
||||
CopyIP(&p6.LocalIP, localIP);
|
||||
p6.LocalPort = localport;
|
||||
if (localIP == BIND_LOCALIP_NULL) {
|
||||
p6.LocalIP = BIND_LOCALIP_NULL; // Make the NULL address passing through
|
||||
}
|
||||
else {
|
||||
CopyIP(&p6.LocalIP_Cache, localIP);
|
||||
p6.LocalIP = &p6.LocalIP_Cache;
|
||||
}
|
||||
p6.LocalPort = localport;
|
||||
|
||||
p6.Port = port;
|
||||
p6.Timeout = timeout;
|
||||
@ -14891,9 +14922,14 @@ SOCK *BindConnectEx5(IP *localIP, UINT localport, char *hostname, UINT port, UIN
|
||||
{
|
||||
p4.IpList = iplist_v4;
|
||||
|
||||
ZeroIP4(&p4.LocalIP); // Zero IP4 must be used when argument localIP is NULL
|
||||
CopyIP(&p4.LocalIP, localIP);
|
||||
p4.LocalPort = localport;
|
||||
if (localIP == BIND_LOCALIP_NULL) {
|
||||
p4.LocalIP = BIND_LOCALIP_NULL; // Make the NULL address passing through
|
||||
}
|
||||
else {
|
||||
CopyIP(&p4.LocalIP_Cache, localIP);
|
||||
p4.LocalIP = &p4.LocalIP_Cache;
|
||||
}
|
||||
p4.LocalPort = localport;
|
||||
|
||||
p4.Port = port;
|
||||
p4.Timeout = timeout;
|
||||
|
@ -809,7 +809,8 @@ struct CONNECT_SERIAL_PARAM
|
||||
{
|
||||
LIST *IpList;
|
||||
UINT LocalPort; // Local port number to bind
|
||||
IP LocalIP; // Local IP address to bind
|
||||
IP *LocalIP; // Local IP address to bind. NULL address allowed to use.
|
||||
IP LocalIP_Cache; // Local IP address to bind
|
||||
UINT Port;
|
||||
UINT Timeout;
|
||||
char Hostname[MAX_SIZE];
|
||||
|
@ -17,7 +17,7 @@ SOCK *Internal_ProxyTcpConnect(PROXY_PARAM_IN *param, volatile bool *cancel_flag
|
||||
#endif
|
||||
|
||||
//return ConnectEx4(param->Hostname, param->Port, param->Timeout, (bool*)cancel_flag, NULL, NULL, false, true, resolved_ip);
|
||||
return BindConnectEx4(¶m->BindLocalIP, param->BindLocalPort, param->Hostname, param->Port, param->Timeout, (bool *)cancel_flag, NULL, NULL, false, true, resolved_ip);
|
||||
return BindConnectEx4(param->BindLocalIP, param->BindLocalPort, param->Hostname, param->Port, param->Timeout, (bool *)cancel_flag, NULL, NULL, false, true, resolved_ip);
|
||||
}
|
||||
|
||||
// Connect to an HTTP proxy
|
||||
@ -28,8 +28,8 @@ UINT ProxyHttpConnect(PROXY_PARAM_OUT *out, PROXY_PARAM_IN *in, volatile bool *c
|
||||
{
|
||||
return PROXY_ERROR_PARAMETER;
|
||||
}
|
||||
StrToIP(&in->BindLocalIP, "0::0");
|
||||
in->BindLocalPort = 0;
|
||||
in->BindLocalIP = BIND_LOCALIP_NULL;
|
||||
in->BindLocalPort = BIND_LOCALPORT_NULL;
|
||||
return BindProxyHttpConnect(out, in, cancel_flag);
|
||||
}
|
||||
|
||||
@ -228,8 +228,8 @@ UINT ProxySocks5Connect(PROXY_PARAM_OUT *out, PROXY_PARAM_IN *in, volatile bool
|
||||
{
|
||||
return PROXY_ERROR_PARAMETER;
|
||||
}
|
||||
StrToIP(&in->BindLocalIP, "0::0");
|
||||
in->BindLocalPort = 0;
|
||||
in->BindLocalIP = BIND_LOCALIP_NULL;
|
||||
in->BindLocalPort = BIND_LOCALPORT_NULL;
|
||||
return BindProxySocks5Connect(out, in, cancel_flag);
|
||||
}
|
||||
|
||||
@ -554,6 +554,8 @@ UINT ProxySocks4Connect(PROXY_PARAM_OUT *out, PROXY_PARAM_IN *in, volatile bool
|
||||
{
|
||||
return PROXY_ERROR_PARAMETER;
|
||||
}
|
||||
in->BindLocalIP = BIND_LOCALIP_NULL;
|
||||
in->BindLocalPort = BIND_LOCALPORT_NULL;
|
||||
return BindProxySocks4Connect(out, in, cancel_flag);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct PROXY_PARAM_IN
|
||||
UINT Timeout;
|
||||
char HttpCustomHeader[HTTP_CUSTOM_HEADER_MAX_SIZE];
|
||||
char HttpUserAgent[HTTP_HEADER_USER_AGENT_MAX_SIZE + 1];
|
||||
IP BindLocalIP; // Source IP address for outgoing connection
|
||||
IP *BindLocalIP; // Source IP address for outgoing connection
|
||||
UINT BindLocalPort; // UINT used not USHORT // Source port number for outgoing connection
|
||||
#ifdef OS_WIN32
|
||||
void *Hwnd;
|
||||
|
@ -1654,16 +1654,18 @@ BEGIN
|
||||
LTEXT "@S_MODE",S_MODE,254,169,166,17
|
||||
CONTROL "@R_BRIDGE",R_BRIDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,191,166,9
|
||||
CONTROL "@R_MONITOR",R_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,205,166,9
|
||||
GROUPBOX "@STATIC17", IDC_STATIC, 222, 225, 205, 42
|
||||
CONTROL "@R_NO_ROUTING",R_NO_ROUTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,238,181,9
|
||||
LTEXT "@STATIC20", IDC_STATIC, 233, 249, 56, 17
|
||||
EDITTEXT E_BIND_LOCALIP, 289, 249, 126, 11, ES_RIGHT | ES_AUTOHSCROLL
|
||||
GROUPBOX "@STATIC17", IDC_STATIC, 222, 225, 205, 43
|
||||
CONTROL "@R_NO_ROUTING",R_NO_ROUTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,234,181,9
|
||||
LTEXT "@STATIC20", IDC_STATIC, 233, 243, 58, 17
|
||||
EDITTEXT E_BIND_LOCALIP, 292, 243, 126, 11, ES_RIGHT | ES_AUTOHSCROLL
|
||||
LTEXT "@STATIC21", IDC_STATIC, 233, 255, 58, 12
|
||||
EDITTEXT E_BIND_LOCALPORT, 292, 255, 40, 11, ES_RIGHT | ES_AUTOHSCROLL
|
||||
ICON ICO_WARNING,S_WARNING_ICON,223,270,18,18
|
||||
LTEXT "@STATIC18",IDC_STATIC,247,270,180,26
|
||||
DEFPUSHBUTTON "@IDOK",IDOK,294,291,64,15
|
||||
PUSHBUTTON "@IDCANCEL",IDCANCEL,363,291,64,15
|
||||
ICON ICO_SWITCH,IDC_STATIC,230,169,18,18
|
||||
END
|
||||
END
|
||||
|
||||
D_CM_NEW_VLAN DIALOGEX 0, 0, 251, 98
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
|
@ -339,7 +339,8 @@
|
||||
#define C_NUM_TCP 1075
|
||||
#define B_TRUST 1076
|
||||
#define E_INTERVAL 1076
|
||||
#define E_BIND_LOCALIP 9076 // Bind source IP
|
||||
#define E_BIND_LOCALIP 9076 // Bind source IP address
|
||||
#define E_BIND_LOCALPORT 9077 // Bind source port number
|
||||
#define B_PROXY_CONFIG 1077
|
||||
#define B_SERVER_CERT 1078
|
||||
#define B_VIEW_SERVER_CERT 1079
|
||||
|
@ -2420,7 +2420,8 @@ STATIC17 Other Confi&gurations:
|
||||
R_NO_ROUTING No Adjustments of &Routing Table
|
||||
STATIC18 Keep the settings default in this dialog unless you are told to do so by a system administrator, or you have expertise for networking and security.
|
||||
STATIC19 The VoIP / QoS functions handle high priority packets such as IP telephone packets (VoIP) to be transmitted faster.
|
||||
STATIC20 Source IP Address\n(IP Address on NIC):
|
||||
STATIC20 Source IP Address:
|
||||
STATIC21 Source Port Number:
|
||||
R_DISABLE_QOS Disable VoIP / &QoS Functions
|
||||
IDOK &OK
|
||||
IDCANCEL Cancel
|
||||
|
@ -2423,7 +2423,8 @@ STATIC17 その他の設定(&G):
|
||||
R_NO_ROUTING ルーティングテーブルの調整処理を行わない(&R)
|
||||
STATIC18 この設定画面の設定項目は、システム管理者から指示があった場合や、ネットワークやセキュリティに関して詳しい知識をお持ちの場合以外は変更しないでください。
|
||||
STATIC19 VoIP / QoS 対応機能を使用すると、IP 電話パケットなどの優先度の高いパケットを VPN 内で高速に伝送できます。
|
||||
STATIC20 送信元IPアドレス\n(NICのIPアドレス):
|
||||
STATIC20 送信元IPアドレス:
|
||||
STATIC21 送信元ポート番号:
|
||||
R_DISABLE_QOS VoIP / QoS 対応機能を無効にする(&Q)
|
||||
IDOK &OK
|
||||
IDCANCEL キャンセル
|
||||
|
Loading…
Reference in New Issue
Block a user