1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 09:29:52 +03:00

Cedar: Don't hardcode prefix for virtual brige destination

This commit is contained in:
Koichiro IWAO 2023-06-02 18:01:23 +09:00
parent 1c0bdb0c30
commit 696a9bc0a1
4 changed files with 9 additions and 7 deletions

View File

@ -321,7 +321,7 @@ TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip)
{
if (IsInListStr(o, name) == false)
{
if (StartWith(name, "tap_") == false)
if (StartWith(name, UNIX_VLAN_BRDEST_IFACE_PREFIX"_") == false)
{
Add(o, CopyStr(name));
}

View File

@ -675,7 +675,8 @@
//
//////////////////////////////////////////////////////////////////////
#define UNIX_VLAN_IFACE_PREFIX "vpn" // Prefix of UNIX virual LAN card interface
#define UNIX_VLAN_CLIENT_IFACE_PREFIX "vpn" // Prefix of UNIX virtual LAN card interface (used for client)
#define UNIX_VLAN_BRDEST_IFACE_PREFIX "tap" // Prefix of UNIX virtual LAN card interface (used for bridge destination)
#ifndef UNIX_BSD
#define TAP_FILENAME_1 "/dev/net/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, UNIX_VLAN_IFACE_PREFIX, false)
if (InStrEx(t.DeviceName, UNIX_VLAN_CLIENT_IFACE_PREFIX, false)
|| InStrEx(t.DeviceName, "UNIX_VLAN_BRDEST_IFACE_PREFIX, false)
|| InStrEx(t.DeviceName, "tun", false)
|| InStrEx(t.DeviceName, "tap", false))
{

View File

@ -273,7 +273,7 @@ VLAN *NewTap(char *name, char *mac_address, bool create_up)
return NULL;
}
fd = UnixCreateTapDeviceEx(name, "tap", mac_address, create_up);
fd = UnixCreateTapDeviceEx(name, UNIX_VLAN_BRDEST_IFACE_PREFIX, mac_address, create_up);
if (fd == -1)
{
return NULL;
@ -565,7 +565,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, UNIX_VLAN_IFACE_PREFIX, mac_address, create_up);
return UnixCreateTapDeviceEx(name, UNIX_VLAN_CLIENT_IFACE_PREFIX, mac_address, create_up);
}
// Close the tap device
@ -701,7 +701,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, UNIX_VLAN_IFACE_PREFIX, mac_address, create_up);
return UnixVLanCreateEx(name, UNIX_VLAN_CLIENT_IFACE_PREFIX, mac_address, create_up);
}
// Set a VLAN up/down
@ -728,7 +728,7 @@ bool UnixVLanSetState(char* name, bool state_up)
return false;
}
GenerateTunName(name, UNIX_VLAN_IFACE_PREFIX, eth_name, sizeof(eth_name));
GenerateTunName(name, UNIX_VLAN_CLIENT_IFACE_PREFIX, eth_name, sizeof(eth_name));
Zero(&ifr, sizeof(ifr));
StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);