1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-14 19:54:57 +03:00

Change IP structure so that IPv4 addresses are stored in RFC3493 format

In addition to saving 4 bytes for each instantiation, this change makes IP-related operations faster and clearer.

https://tools.ietf.org/html/rfc3493.html#section-3.7
This commit is contained in:
Davide Beatrici
2021-04-07 21:24:55 +02:00
parent 01663f836d
commit 1708998a11
21 changed files with 295 additions and 403 deletions

View File

@ -1535,7 +1535,7 @@ void CnListenerProc(THREAD *thread, void *param)
AddRef(s->ref);
NoticeThreadInit(thread);
if (s->LocalIP.addr[0] == 127)
if (IsLocalHostIP(&s->LocalIP))
{
p = RecvPack(s);
@ -5110,7 +5110,7 @@ void CiRpcAccepted(CLIENT *c, SOCK *s)
retcode = 1;
}
if (c->PasswordRemoteOnly && s->RemoteIP.addr[0] == 127)
if (c->PasswordRemoteOnly && IsLocalHostIP(&s->RemoteIP))
{
// If in a mode that requires a password only remote,
// the password sent from localhost is considered to be always correct
@ -5123,7 +5123,7 @@ void CiRpcAccepted(CLIENT *c, SOCK *s)
{
// If the remote control is prohibited,
// identify whether this connection is from remote
if (s->RemoteIP.addr[0] != 127)
if (IsLocalHostIP(&s->RemoteIP) == false)
{
retcode = 2;
}