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

Adding timeout propagation from user policy in PPP sessions (including L2TP and SSTP).

This commit is contained in:
Evengard
2020-04-27 21:43:40 +03:00
parent 039cd8edf0
commit 1bdd9a92bc
6 changed files with 79 additions and 14 deletions

View File

@ -97,6 +97,8 @@ void SstpProcessControlPacket(SSTP_SERVER *s, SSTP_PACKET *p)
// Process the SSTP received data packet
void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p)
{
PPP_SESSION* underlyingSession;
// Validate arguments
if (s == NULL || p == NULL || p->IsControl)
{
@ -108,9 +110,11 @@ void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p)
if (s->PPPThread == NULL)
{
// Create a thread to initialize the new PPP module
s->PPPThread = NewPPPSession(s->Cedar, &s->ClientIp, s->ClientPort, &s->ServerIp, s->ServerPort,
underlyingSession = NewPPPSession(s->Cedar, &s->ClientIp, s->ClientPort, &s->ServerIp, s->ServerPort,
s->TubeSend, s->TubeRecv, SSTP_IPC_POSTFIX, SSTP_IPC_CLIENT_NAME,
s->ClientHostName, s->ClientCipherName, 0);
s->PPPSession = underlyingSession;
s->PPPThread = underlyingSession->SessionThread;
}
// Pass the received data to the PPP module
@ -177,6 +181,7 @@ void SstpSendPacket(SSTP_SERVER *s, SSTP_PACKET *p)
// Process the timer interrupt
void SstpProcessInterrupt(SSTP_SERVER *s)
{
UINT64 sstpTimeout = SSTP_TIMEOUT;
// Validate arguments
if (s == NULL)
{
@ -261,7 +266,12 @@ void SstpProcessInterrupt(SSTP_SERVER *s)
}
}
if ((s->LastRecvTick + (UINT64)SSTP_TIMEOUT) <= s->Now)
if (s->PPPSession != NULL && s->PPPSession->DataTimeout > sstpTimeout)
{
sstpTimeout = s->PPPSession->DataTimeout;
}
if ((s->LastRecvTick + sstpTimeout) <= s->Now)
{
// Disconnect the SSTP because a timeout occurred
SstpAbort(s);