diff --git a/src/Cedar/Cedar.h b/src/Cedar/Cedar.h index e2add369..667584a5 100644 --- a/src/Cedar/Cedar.h +++ b/src/Cedar/Cedar.h @@ -126,10 +126,10 @@ // Version number -#define CEDAR_VER 437 +#define CEDAR_VER 438 // Build Number -#define CEDAR_BUILD 9758 +#define CEDAR_BUILD 9760 // Beta number //#define BETA_NUMBER 3 @@ -150,10 +150,10 @@ // Specifies the build date #define BUILD_DATE_Y 2021 #define BUILD_DATE_M 8 -#define BUILD_DATE_D 16 -#define BUILD_DATE_HO 0 -#define BUILD_DATE_MI 27 -#define BUILD_DATE_SE 11 +#define BUILD_DATE_D 17 +#define BUILD_DATE_HO 22 +#define BUILD_DATE_MI 14 +#define BUILD_DATE_SE 6 // Tolerable time difference #define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000) diff --git a/src/Cedar/IPsec_IKE.c b/src/Cedar/IPsec_IKE.c index b458aa48..f5b7943e 100644 --- a/src/Cedar/IPsec_IKE.c +++ b/src/Cedar/IPsec_IKE.c @@ -1484,13 +1484,13 @@ void SendInformationalExchangePacketEx(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKE IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, - ps_buf->Buf, ps_buf->Size); + Clone(ps_buf->Buf, ps_buf->Size), ps_buf->Size); #ifdef RAW_DEBUG IkeDebugUdpSendRawPacket(ps); #endif // RAW_DEBUG - Free(ps_buf); + FreeBuf(ps_buf); IkeFree(ps); } @@ -4122,9 +4122,9 @@ void IPsecSaSendPacket(IKE_SERVER *ike, IPSECSA *sa, IKE_PACKET *p) IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &sa->IkeClient->ServerIP, sa->IkeClient->ServerPort, &sa->IkeClient->ClientIP, sa->IkeClient->ClientPort, - buf->Buf, buf->Size); + Clone(buf->Buf, buf->Size), buf->Size); - Free(buf); + FreeBuf(buf); } // Send a packet using the IKE SA @@ -4182,9 +4182,9 @@ void IkeSaSendPacket(IKE_SERVER *ike, IKE_SA *sa, IKE_PACKET *p) IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &sa->IkeClient->ServerIP, sa->IkeClient->ServerPort, &sa->IkeClient->ClientIP, sa->IkeClient->ClientPort, - buf->Buf, buf->Size); + Clone(buf->Buf, buf->Size), buf->Size); - Free(buf); + FreeBuf(buf); } // Send an UDP packet diff --git a/src/CurrentBuild.txt b/src/CurrentBuild.txt index a783815e..a58798d5 100644 --- a/src/CurrentBuild.txt +++ b/src/CurrentBuild.txt @@ -1,4 +1,4 @@ -BUILD_NUMBER 9758 -VERSION 437 -BUILD_NAME beta -BUILD_DATE 20210816_002711 +BUILD_NUMBER 9760 +VERSION 438 +BUILD_NAME rtm +BUILD_DATE 20210817_221406 diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c index 7100caa1..3bc9d3de 100644 --- a/src/Mayaqua/Network.c +++ b/src/Mayaqua/Network.c @@ -20448,6 +20448,7 @@ void UdpListenerThread(THREAD *thread, void *param) while (u->Halt == false) { LIST *recv_list; + UINT recv_list_total_size = 0; UINT64 now = Tick64(); UINT interval; bool stage_changed = false; @@ -20621,6 +20622,7 @@ LABEL_RESTART: stage_changed = false; recv_list = NewListFast(NULL); + recv_list_total_size = 0; if (u->PollMyIpAndPort) { @@ -20670,8 +20672,15 @@ LABEL_RESTART: IP src_addr; UINT src_port; UDPPACKET *p; + UINT size; - UINT size = RecvFrom(us->Sock, &src_addr, &src_port, buf, buf_size); + if (u->RecvBufSize != 0 && recv_list_total_size >= u->RecvBufSize) + { + // No more receive packet since the buffer is full + break; + } + + size = RecvFrom(us->Sock, &src_addr, &src_port, buf, buf_size); if (size == 0) { // Socket failure @@ -20724,6 +20733,8 @@ LABEL_FATAL_ERROR: } Add(recv_list, p); + + recv_list_total_size += size; } stage_changed = true; @@ -20732,6 +20743,7 @@ LABEL_FATAL_ERROR: } // Pass the received packet to the procedure + // Print("recv_list_total_size = %u\n", recv_list_total_size); u->RecvProc(u, recv_list); // Release the packet @@ -20758,6 +20770,8 @@ LABEL_FATAL_ERROR: Zero(&last_src_ip, sizeof(IP)); last_src_port = 0; + // Print("LIST_NUM(u->SendPacketList) = %u\n", LIST_NUM(u->SendPacketList)); + for (i = 0;i < LIST_NUM(u->SendPacketList);i++) { UDPPACKET *p = LIST_DATA(u->SendPacketList, i); @@ -21007,6 +21021,8 @@ UDPLISTENER *NewUdpListener(UDPLISTENER_RECV_PROC *recv_proc, void *param) u = ZeroMalloc(sizeof(UDPLISTENER)); + u->RecvBufSize = UDP_MAX_BUFFER_SIZE; + u->Param = param; u->PortList = NewList(NULL); diff --git a/src/Mayaqua/Network.h b/src/Mayaqua/Network.h index 68d9d220..a0d4d70a 100644 --- a/src/Mayaqua/Network.h +++ b/src/Mayaqua/Network.h @@ -601,6 +601,7 @@ struct UDPLISTENER bool IsEspRawPortOpened; // Whether the raw port opens bool PollMyIpAndPort; // Examine whether the global IP and the port number of its own QUERYIPTHREAD *GetNatTIpThread; // NAT-T IP address acquisition thread + UINT RecvBufSize; // Receive buffer size }; #define QUERYIPTHREAD_INTERVAL_LAST_OK (3 * 60 * 60 * 1000) diff --git a/src/bin/vpnweb.cab b/src/bin/vpnweb.cab index 8e8f66ba..f2e0fd9c 100644 Binary files a/src/bin/vpnweb.cab and b/src/bin/vpnweb.cab differ diff --git a/src/bin/vpnweb.ocx b/src/bin/vpnweb.ocx index 9a097ab0..39953de1 100644 Binary files a/src/bin/vpnweb.ocx and b/src/bin/vpnweb.ocx differ diff --git a/src/vpnweb/vpnweb.h b/src/vpnweb/vpnweb.h index 9ca211b4..d96b789b 100644 --- a/src/vpnweb/vpnweb.h +++ b/src/vpnweb/vpnweb.h @@ -4,7 +4,7 @@ /* File created by MIDL compiler version 7.00.0500 */ -/* at Mon Aug 16 00:27:28 2021 +/* at Tue Aug 17 22:14:22 2021 */ /* Compiler settings for .\vpnweb.idl: Oicf, W1, Zp8, env=Win32 (32b run) diff --git a/src/vpnweb/vpnweb_i.c b/src/vpnweb/vpnweb_i.c index a0b1f9ff..8c202411 100644 --- a/src/vpnweb/vpnweb_i.c +++ b/src/vpnweb/vpnweb_i.c @@ -6,7 +6,7 @@ /* File created by MIDL compiler version 7.00.0500 */ -/* at Mon Aug 16 00:27:28 2021 +/* at Tue Aug 17 22:14:22 2021 */ /* Compiler settings for .\vpnweb.idl: Oicf, W1, Zp8, env=Win32 (32b run) diff --git a/src/vpnweb/vpnweb_p.c b/src/vpnweb/vpnweb_p.c index 6bd00159..c892fe8b 100644 --- a/src/vpnweb/vpnweb_p.c +++ b/src/vpnweb/vpnweb_p.c @@ -4,7 +4,7 @@ /* File created by MIDL compiler version 7.00.0500 */ -/* at Mon Aug 16 00:27:28 2021 +/* at Tue Aug 17 22:14:22 2021 */ /* Compiler settings for .\vpnweb.idl: Oicf, W1, Zp8, env=Win32 (32b run)