1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-12-06 10:11:32 +03:00

Config value for dhcp discover timeout

This commit is contained in:
Julian Grasböck
2025-11-26 13:56:29 +01:00
parent acbc514b87
commit 173df872b8
5 changed files with 23 additions and 1 deletions

View File

@ -630,6 +630,7 @@ void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao)
GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption); GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption);
GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId); GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId);
GetHubAdminOptionDataAndSet(ao, "AllowEapMatchUserByCert", o->AllowEapMatchUserByCert); GetHubAdminOptionDataAndSet(ao, "AllowEapMatchUserByCert", o->AllowEapMatchUserByCert);
GetHubAdminOptionDataAndSet(ao, "DhcpDiscoverTimeoutMs", o->DhcpDiscoverTimeoutMs);
} }
// Convert the contents of the HUB_OPTION to data // Convert the contents of the HUB_OPTION to data
@ -705,6 +706,7 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption)); Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption));
Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId)); Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId));
Add(aol, NewAdminOption("AllowEapMatchUserByCert", o->AllowEapMatchUserByCert)); Add(aol, NewAdminOption("AllowEapMatchUserByCert", o->AllowEapMatchUserByCert));
Add(aol, NewAdminOption("DhcpDiscoverTimeoutMs", o->DhcpDiscoverTimeoutMs));
Zero(ao, sizeof(RPC_ADMIN_OPTION)); Zero(ao, sizeof(RPC_ADMIN_OPTION));

View File

@ -30,6 +30,9 @@
// Default flooding queue length // Default flooding queue length
#define DEFAULT_FLOODING_QUEUE_LENGTH (32 * 1024 * 1024) #define DEFAULT_FLOODING_QUEUE_LENGTH (32 * 1024 * 1024)
// Default DHCP Discover Timeout
#define DEFAULT_DHCP_DISCOVER_TIMEOUT (5 * 1000)
// SoftEther link control packet // SoftEther link control packet
struct SE_LINK struct SE_LINK
{ {
@ -183,6 +186,7 @@ struct HUB_OPTION
bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option
bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption
bool AllowEapMatchUserByCert; // Allow matching EAP Identity with user certificate CNs bool AllowEapMatchUserByCert; // Allow matching EAP Identity with user certificate CNs
UINT DhcpDiscoverTimeoutMs; // Timeout to wait for DHCP server response on DISCOVER request
}; };
// MAC table entry // MAC table entry

View File

@ -493,12 +493,14 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
{ {
UINTToIP(&ipc->DefaultGateway, hub->Option->DefaultGateway); UINTToIP(&ipc->DefaultGateway, hub->Option->DefaultGateway);
UINTToIP(&ipc->SubnetMask, hub->Option->DefaultSubnet); UINTToIP(&ipc->SubnetMask, hub->Option->DefaultSubnet);
ipc->DhcpDiscoverTimeoutMs = hub->Option->DhcpDiscoverTimeoutMs;
GetBroadcastAddress4(&ipc->BroadcastAddress, &ipc->DefaultGateway, &ipc->SubnetMask); GetBroadcastAddress4(&ipc->BroadcastAddress, &ipc->DefaultGateway, &ipc->SubnetMask);
} }
else else
{ {
ZeroIP4(&ipc->DefaultGateway); ZeroIP4(&ipc->DefaultGateway);
ZeroIP4(&ipc->SubnetMask); ZeroIP4(&ipc->SubnetMask);
ipc->DhcpDiscoverTimeoutMs = DEFAULT_DHCP_DISCOVER_TIMEOUT;
ZeroIP4(&ipc->BroadcastAddress); ZeroIP4(&ipc->BroadcastAddress);
} }
@ -793,7 +795,7 @@ bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube)
StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname);
IPCDhcpSetConditionalUserClass(ipc, &req); IPCDhcpSetConditionalUserClass(ipc, &req);
d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_OFFER, IPC_DHCP_TIMEOUT, discon_poll_tube); d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_OFFER, ipc->DhcpDiscoverTimeoutMs, discon_poll_tube);
if (d == NULL) if (d == NULL)
{ {
return false; return false;

View File

@ -149,6 +149,7 @@ struct IPC
SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session
IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session
UINT Layer; UINT Layer;
UINT DhcpDiscoverTimeoutMs; // Timeut to wait for DHCP server response on DISCOVER request
// IPv6 stuff // IPv6 stuff
QUEUE *IPv6ReceivedQueue; // IPv6 reception queue QUEUE *IPv6ReceivedQueue; // IPv6 reception queue

View File

@ -2337,6 +2337,7 @@ void SiSetDefaultHubOption(HUB_OPTION *o)
o->AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; o->AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME;
o->RemoveDefGwOnDhcpForLocalhost = true; o->RemoveDefGwOnDhcpForLocalhost = true;
o->FloodingSendQueueBufferQuota = DEFAULT_FLOODING_QUEUE_LENGTH; o->FloodingSendQueueBufferQuota = DEFAULT_FLOODING_QUEUE_LENGTH;
o->DhcpDiscoverTimeoutMs = DEFAULT_DHCP_DISCOVER_TIMEOUT;
} }
// Create a default virtual HUB // Create a default virtual HUB
@ -3942,6 +3943,11 @@ void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o)
o->UseHubNameAsDhcpUserClassOption = CfgGetBool(f, "UseHubNameAsDhcpUserClassOption"); o->UseHubNameAsDhcpUserClassOption = CfgGetBool(f, "UseHubNameAsDhcpUserClassOption");
o->UseHubNameAsRadiusNasId = CfgGetBool(f, "UseHubNameAsRadiusNasId"); o->UseHubNameAsRadiusNasId = CfgGetBool(f, "UseHubNameAsRadiusNasId");
o->AllowEapMatchUserByCert = CfgGetBool(f, "AllowEapMatchUserByCert"); o->AllowEapMatchUserByCert = CfgGetBool(f, "AllowEapMatchUserByCert");
o->DhcpDiscoverTimeoutMs = CfgGetInt(f, "DhcpDiscoverTimeoutMs");
if (o->DhcpDiscoverTimeoutMs == 0)
{
o->DhcpDiscoverTimeoutMs = DEFAULT_DHCP_DISCOVER_TIMEOUT;
}
// Enabled by default // Enabled by default
if (CfgIsItem(f, "ManageOnlyPrivateIP")) if (CfgIsItem(f, "ManageOnlyPrivateIP"))
@ -4048,6 +4054,7 @@ void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o)
CfgAddBool(f, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption); CfgAddBool(f, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption);
CfgAddBool(f, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId); CfgAddBool(f, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId);
CfgAddBool(f, "AllowEapMatchUserByCert", o->AllowEapMatchUserByCert); CfgAddBool(f, "AllowEapMatchUserByCert", o->AllowEapMatchUserByCert);
CfgAddInt(f, "DhcpDiscoverTimeoutMs", o->DhcpDiscoverTimeoutMs);
} }
// Write the user // Write the user
@ -7533,6 +7540,11 @@ void SiCalledUpdateHub(SERVER *s, PACK *p)
o.UseHubNameAsDhcpUserClassOption = PackGetBool(p, "UseHubNameAsDhcpUserClassOption"); o.UseHubNameAsDhcpUserClassOption = PackGetBool(p, "UseHubNameAsDhcpUserClassOption");
o.UseHubNameAsRadiusNasId = PackGetBool(p, "UseHubNameAsRadiusNasId"); o.UseHubNameAsRadiusNasId = PackGetBool(p, "UseHubNameAsRadiusNasId");
o.AllowEapMatchUserByCert = PackGetBool(p, "AllowEapMatchUserByCert"); o.AllowEapMatchUserByCert = PackGetBool(p, "AllowEapMatchUserByCert");
o.DhcpDiscoverTimeoutMs = PackGetInt(p, "DhcpDiscoverTimeoutMs");
if (o.DhcpDiscoverTimeoutMs == 0)
{
o.DhcpDiscoverTimeoutMs = DEFAULT_DHCP_DISCOVER_TIMEOUT;
}
save_packet_log = PackGetInt(p, "SavePacketLog"); save_packet_log = PackGetInt(p, "SavePacketLog");
packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType"); packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType");
@ -9368,6 +9380,7 @@ void SiPackAddCreateHub(PACK *p, HUB *h)
PackAddBool(p, "UseHubNameAsDhcpUserClassOption", h->Option->UseHubNameAsDhcpUserClassOption); PackAddBool(p, "UseHubNameAsDhcpUserClassOption", h->Option->UseHubNameAsDhcpUserClassOption);
PackAddBool(p, "UseHubNameAsRadiusNasId", h->Option->UseHubNameAsRadiusNasId); PackAddBool(p, "UseHubNameAsRadiusNasId", h->Option->UseHubNameAsRadiusNasId);
PackAddBool(p, "AllowEapMatchUserByCert", h->Option->AllowEapMatchUserByCert); PackAddBool(p, "AllowEapMatchUserByCert", h->Option->AllowEapMatchUserByCert);
PackAddInt(p, "DhcpDiscoverTimeoutMs", h->Option->DhcpDiscoverTimeoutMs);
SiAccessListToPack(p, h->AccessList); SiAccessListToPack(p, h->AccessList);