mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-07-12 02:34:59 +03:00
Cedar: Add "DefaultGateway" and "DefaultSubnet" virtual hub options
WireGuard does not provide any configuration messages, meaning that we cannot push the IP address we receive from the DHCP server to the client. In order to overcome the limitation we don't perform any DHCP operations and instead just extract the source IP address from the first IPv4 packet we receive in the tunnel. The gateway address and the subnet mask can be set using the new "SetStaticNetwork" command. The values can be retrieved using "OptionsGet". In future we will add a "allowed source IP addresses" function, similar to what the original WireGuard implementation provides. ================================================================================ SetStaticNetwork command - Set Virtual Hub static IPv4 network parameters Help for command "SetStaticNetwork" Purpose: Set Virtual Hub static IPv4 network parameters Description: Set the static IPv4 network parameters for the Virtual Hub. They are used when DHCP is not available (e.g. WireGuard sessions). You can get the current settings by using the OptionsGet command. Usage: SetStaticNetwork [/GATEWAY:gateway] [/SUBNET:subnet] Parameters: /GATEWAY - Specify the IP address of the gateway that will be used for internet communication. /SUBNET - Specify the subnet mask, required to determine the size of the local VPN network.
This commit is contained in:
@ -9061,9 +9061,12 @@ UINT StGetHub(ADMIN *a, RPC_CREATE_HUB *t)
|
||||
{
|
||||
StrCpy(t->HubName, sizeof(t->HubName), h->Name);
|
||||
t->Online = h->Offline ? false : true;
|
||||
t->HubType = h->Type;
|
||||
|
||||
t->HubOption.DefaultGateway = h->Option->DefaultGateway;
|
||||
t->HubOption.DefaultSubnet = h->Option->DefaultSubnet;
|
||||
t->HubOption.MaxSession = h->Option->MaxSession;
|
||||
t->HubOption.NoEnum = h->Option->NoEnum;
|
||||
t->HubType = h->Type;
|
||||
}
|
||||
Unlock(h->lock);
|
||||
|
||||
@ -9090,7 +9093,6 @@ UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t)
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
CHECK_RIGHT;
|
||||
NO_SUPPORT_FOR_BRIDGE;
|
||||
|
||||
@ -9175,8 +9177,12 @@ UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t)
|
||||
else
|
||||
{
|
||||
h->Type = t->HubType;
|
||||
|
||||
h->Option->DefaultGateway = t->HubOption.DefaultGateway;
|
||||
h->Option->DefaultSubnet = t->HubOption.DefaultSubnet;
|
||||
h->Option->MaxSession = t->HubOption.MaxSession;
|
||||
h->Option->NoEnum = t->HubOption.NoEnum;
|
||||
|
||||
if (IsZero(t->HashedPassword, sizeof(t->HashedPassword)) == false &&
|
||||
IsZero(t->SecurePassword, sizeof(t->SecurePassword)) == false)
|
||||
{
|
||||
@ -9234,8 +9240,6 @@ UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t)
|
||||
return ERR_NOT_FARM_CONTROLLER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false)
|
||||
{
|
||||
return ERR_INVALID_PARAMETER;
|
||||
@ -9279,6 +9283,8 @@ UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t)
|
||||
|
||||
// Create a hub object
|
||||
Zero(&o, sizeof(o));
|
||||
o.DefaultGateway = t->HubOption.DefaultGateway;
|
||||
o.DefaultSubnet = t->HubOption.DefaultSubnet;
|
||||
o.MaxSession = t->HubOption.MaxSession;
|
||||
o.NoEnum = t->HubOption.NoEnum;
|
||||
|
||||
@ -12885,6 +12891,8 @@ void InRpcHubOption(RPC_HUB_OPTION *t, PACK *p)
|
||||
}
|
||||
|
||||
Zero(t, sizeof(RPC_HUB_OPTION));
|
||||
t->DefaultGateway = PackGetInt(p, "DefaultGateway");
|
||||
t->DefaultSubnet = PackGetInt(p, "DefaultSubnet");
|
||||
t->MaxSession = PackGetInt(p, "MaxSession");
|
||||
t->NoEnum = PackGetBool(p, "NoEnum");
|
||||
}
|
||||
@ -12896,6 +12904,8 @@ void OutRpcHubOption(PACK *p, RPC_HUB_OPTION *t)
|
||||
return;
|
||||
}
|
||||
|
||||
PackAddInt(p, "DefaultGateway", t->DefaultGateway);
|
||||
PackAddInt(p, "DefaultSubnet", t->DefaultSubnet);
|
||||
PackAddInt(p, "MaxSession", t->MaxSession);
|
||||
PackAddBool(p, "NoEnum", t->NoEnum);
|
||||
}
|
||||
|
Reference in New Issue
Block a user