mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Bind outgoing connection to a specific IP address (fix a bug)
This commit is contained in:
parent
643cbbbf88
commit
f57f05a599
@ -6292,8 +6292,6 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
|||||||
localIP = BIND_LOCALIP_NULL; // Specify not to bind
|
localIP = BIND_LOCALIP_NULL; // Specify not to bind
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
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.
|
// Nonzero address is for source IP address to bind. Zero address is for dummy not to bind.
|
||||||
if (IsZeroIP(&sess->ClientOption->BindLocalIP) == true) {
|
if (IsZeroIP(&sess->ClientOption->BindLocalIP) == true) {
|
||||||
localIP = BIND_LOCALIP_NULL;
|
localIP = BIND_LOCALIP_NULL;
|
||||||
@ -6301,6 +6299,8 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
|||||||
else {
|
else {
|
||||||
localIP = &sess->ClientOption->BindLocalIP;
|
localIP = &sess->ClientOption->BindLocalIP;
|
||||||
}
|
}
|
||||||
|
Debug("ClientConnectGetSocket(): Source IP address %r and source port number %d for binding\n"
|
||||||
|
, &sess->ClientOption->BindLocalIP, sess->ClientOption->BindLocalPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// In the case of second and subsequent TCP/IP connections
|
// In the case of second and subsequent TCP/IP connections
|
||||||
@ -6314,7 +6314,7 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
localport = sess->ClientOption->BindLocalPort + Count(sess->Connection->CurrentNumConnection) - 1;
|
localport = sess->ClientOption->BindLocalPort + Count(sess->Connection->CurrentNumConnection) - 1;
|
||||||
Debug("ClientConnectGetSocket(): Additional port number %u\n", localport);
|
Debug("ClientConnectGetSocket(): Additional source port number %u\n", localport);
|
||||||
}
|
}
|
||||||
// Bottom of Bind outgoing connection
|
// Bottom of Bind outgoing connection
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user