mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-07-06 07:44:57 +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:
@ -242,6 +242,7 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
|
||||
UINT layer)
|
||||
{
|
||||
IPC *ipc;
|
||||
HUB *hub;
|
||||
UINT dummy_int = 0;
|
||||
SOCK *a;
|
||||
SOCK *s;
|
||||
@ -466,6 +467,13 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
|
||||
PackGetStr(p, "IpcHubName", ipc->HubName, sizeof(ipc->HubName));
|
||||
Debug("IPC Hub Name: %s\n", ipc->HubName);
|
||||
|
||||
hub = GetHub(cedar, ipc->HubName);
|
||||
if (hub != NULL)
|
||||
{
|
||||
UINTToIP(&ipc->DefaultGateway, hub->Option->DefaultGateway);
|
||||
UINTToIP(&ipc->SubnetMask, hub->Option->DefaultSubnet);
|
||||
}
|
||||
|
||||
MacToStr(macstr, sizeof(macstr), ipc->MacAddress);
|
||||
|
||||
Debug("IPC: Session = %s, Connection = %s, Mac = %s\n", ipc->SessionName, ipc->ConnectionName, macstr);
|
||||
|
Reference in New Issue
Block a user