mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-26 19:39:53 +03:00
Merge pull request #1104 from Evengard/fixup-ppp-unices
Fixup ppp unices
This commit is contained in:
commit
14e9c7299d
@ -1088,9 +1088,12 @@ bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp)
|
|||||||
USHORT NegotiatedMRU = PPP_UNSPECIFIED;
|
USHORT NegotiatedMRU = PPP_UNSPECIFIED;
|
||||||
// MSCHAPv2 code
|
// MSCHAPv2 code
|
||||||
UCHAR ms_chap_v2_code[3];
|
UCHAR ms_chap_v2_code[3];
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
Debug("Got LCP packet request ID=%i OptionsListSize=%i\n", pp->Lcp->Id, LIST_NUM(pp->Lcp->OptionList));
|
||||||
|
|
||||||
for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++)
|
for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++)
|
||||||
{
|
{
|
||||||
PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i);
|
PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i);
|
||||||
@ -1359,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;
|
||||||
@ -1366,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)
|
||||||
@ -1618,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);
|
||||||
}
|
}
|
||||||
@ -1792,6 +1804,12 @@ bool PPPAckLCPOptionsEx(PPP_SESSION *p, PPP_PACKET* pp, bool simulate)
|
|||||||
UINT i = 0;
|
UINT i = 0;
|
||||||
PPP_PACKET* ret;
|
PPP_PACKET* ret;
|
||||||
bool toBeACKed = false;
|
bool toBeACKed = false;
|
||||||
|
if (LIST_NUM(pp->Lcp->OptionList) == 0)
|
||||||
|
{
|
||||||
|
// We acknoweldge an empty option list
|
||||||
|
toBeACKed = true;
|
||||||
|
Debug("ACKing empty LCP options list, id=%i\n", pp->Lcp->Id);
|
||||||
|
}
|
||||||
for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++)
|
for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++)
|
||||||
{
|
{
|
||||||
PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i);
|
PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i);
|
||||||
@ -1826,7 +1844,7 @@ bool PPPAckLCPOptionsEx(PPP_SESSION *p, PPP_PACKET* pp, bool simulate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LIST_NUM(ret->Lcp->OptionList) == 0 || simulate)
|
if (simulate)
|
||||||
{
|
{
|
||||||
FreePPPPacket(ret);
|
FreePPPPacket(ret);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user