1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Treating empty IPCP requests as IPCP requests with IP-Address option zeroed out

This commit is contained in:
Evengard 2020-04-25 18:02:02 +03:00
parent b9109211d3
commit f20e99f8e4
2 changed files with 13 additions and 7 deletions

View File

@ -1089,8 +1089,6 @@ bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp)
// MSCHAPv2 code // MSCHAPv2 code
UCHAR ms_chap_v2_code[3]; UCHAR ms_chap_v2_code[3];
UINT currentMagic = 0;
WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP);
ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2;
@ -1364,6 +1362,8 @@ bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET* pp)
{ {
PPP_IPOPTION o; PPP_IPOPTION o;
PPP_IPOPTION res; PPP_IPOPTION res;
PPP_OPTION *dummyIpOption;
UINT dummyIp = 0;
DHCP_OPTION_LIST cao; DHCP_OPTION_LIST cao;
IP client_ip; IP client_ip;
IP subnet; IP subnet;
@ -1371,21 +1371,27 @@ bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET* pp)
IP gw; IP gw;
bool ok = true; bool ok = true;
bool processed = false; bool processed = false;
bool isEmptyIpAddress = false;
PPP_LCP* c;
if (p->IPv4_State == PPP_PROTO_STATUS_REJECTED) if (p->IPv4_State == PPP_PROTO_STATUS_REJECTED)
{ {
Debug("We got an IPCP packet after we had it rejected"); Debug("We got an IPCP packet after we had it rejected\n");
return PPPRejectUnsupportedPacketEx(p, pp, true); return PPPRejectUnsupportedPacketEx(p, pp, true);
} }
if (!PPPGetIPOptionFromLCP(&o, pp->Lcp)) if (!PPPGetIPOptionFromLCP(&o, pp->Lcp))
{ {
Debug("Unsupported IPCP request!"); Debug("IPCP request without client IP address received! Treating as zeroed out client IP...\n");
ok = false; isEmptyIpAddress = true;
dummyIpOption = NewPPPOption(PPP_IPCP_OPTION_IP, &dummyIp, sizeof(UINT));
dummyIpOption->IsSupported = true;
dummyIpOption->IsAccepted = false;
Add(pp->Lcp->OptionList, dummyIpOption);
} }
// Process if not configured yet by server // Process if not configured yet by server
if (IsZero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)) && ok) if ((IsZero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)) || isEmptyIpAddress) && ok)
{ {
// Decide if we received a static IP from client and it is allowed // Decide if we received a static IP from client and it is allowed
if (IsZeroIP(&o.IpAddress) == false) if (IsZeroIP(&o.IpAddress) == false)
@ -1623,6 +1629,7 @@ bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET* pp)
Zero(&res, sizeof(res)); Zero(&res, sizeof(res));
// We will try to reconfigure if we receive another request by wiping all data // We will try to reconfigure if we receive another request by wiping all data
Zero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)); Zero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST));
p->UseStaticIPAddress = false;
PPPSetIPOptionToLCP(&res, pp->Lcp, true); PPPSetIPOptionToLCP(&res, pp->Lcp, true);
} }

View File

@ -82,7 +82,6 @@
// LCP Option Type // LCP Option Type
#define PPP_LCP_OPTION_MRU 1 #define PPP_LCP_OPTION_MRU 1
#define PPP_LCP_OPTION_AUTH 3 #define PPP_LCP_OPTION_AUTH 3
#define PPP_LCP_OPTION_MAGIC 5
// IPCP option type // IPCP option type
#define PPP_IPCP_OPTION_IP 3 #define PPP_IPCP_OPTION_IP 3