1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-25 01:29:53 +03:00

Cedar: Don't hardcode prefix for UNIX virtual network interface

This commit is contained in:
Koichiro IWAO 2023-05-30 23:01:37 +09:00
parent 3c70698c35
commit 9c33605f5e
3 changed files with 7 additions and 4 deletions

View File

@ -675,6 +675,8 @@
//
//////////////////////////////////////////////////////////////////////
#define UNIX_VLAN_IFACE_PREFIX "vpn" // Prefix of UNIX virual LAN card interface
#ifndef UNIX_BSD
#define TAP_FILENAME_1 "/dev/net/tun"
#define TAP_FILENAME_2 "/dev/tun"

View File

@ -7987,7 +7987,8 @@ void SmBridgeDlgOnOk(HWND hWnd, SM_SERVER *s)
StrCpy(t.HubName, sizeof(t.HubName), hub);
t.TapMode = tapmode;
if (InStrEx(t.DeviceName, "vpn", false) || InStrEx(t.DeviceName, "tun", false)
if (InStrEx(t.DeviceName, UNIX_VLAN_IFACE_PREFIX, false)
|| InStrEx(t.DeviceName, "tun", false)
|| InStrEx(t.DeviceName, "tap", false))
{
// Trying to make a local bridge to the VPN device

View File

@ -554,7 +554,7 @@ int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool cre
}
int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up)
{
return UnixCreateTapDeviceEx(name, "vpn", mac_address, create_up);
return UnixCreateTapDeviceEx(name, UNIX_VLAN_IFACE_PREFIX, mac_address, create_up);
}
// Close the tap device
@ -662,7 +662,7 @@ bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_
}
bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up)
{
return UnixVLanCreateEx(name, "vpn", mac_address, create_up);
return UnixVLanCreateEx(name, UNIX_VLAN_IFACE_PREFIX, mac_address, create_up);
}
// Set a VLAN up/down
@ -689,7 +689,7 @@ bool UnixVLanSetState(char* name, bool state_up)
return false;
}
GenerateTunName(name, "vpn", eth_name, sizeof(eth_name));
GenerateTunName(name, UNIX_VLAN_IFACE_PREFIX, eth_name, sizeof(eth_name));
Zero(&ifr, sizeof(ifr));
StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);