1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-12 02:34:59 +03:00

Supporting VLAN for Mac OS X using TunTapOSX

This commit is contained in:
nattoheaven
2014-01-14 23:19:37 +09:00
parent c32bf3b84f
commit 8779e59295
7 changed files with 91 additions and 28 deletions

View File

@ -7446,12 +7446,14 @@ bool CtDisableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan)
#ifndef OS_WIN32
#ifdef NO_VLAN
if (GetOsInfo()->OsType == OSTYPE_MACOS_X)
{
// Can not be added or removed the virtual LAN card in MacOS X
CiSetError(c, ERR_NOT_SUPPORTED);
return false;
}
#endif
// Check whether the virtual LAN card with the specified name is not
// being used by one or more accounts
@ -7597,12 +7599,14 @@ bool CtEnableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan)
#ifndef OS_WIN32
#ifdef NO_VLAN
if (GetOsInfo()->OsType == OSTYPE_MACOS_X)
{
// Can not be added or removed the virtual LAN card in MacOS X
CiSetError(c, ERR_NOT_SUPPORTED);
return false;
}
#endif
// Search the virtual LAN card
LockList(c->UnixVLanList);
@ -7693,12 +7697,14 @@ bool CtDeleteVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *d)
#ifndef OS_WIN32
#ifdef NO_VLAN
if (GetOsInfo()->OsType == OSTYPE_MACOS_X)
{
// Can not be added or removed the virtual LAN card in MacOS X
CiSetError(c, ERR_NOT_SUPPORTED);
return false;
}
#endif
// Check whether the virtual LAN card with the specified name is not
// being used by one or more accounts
@ -8265,12 +8271,14 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
#ifndef OS_WIN32
// Non-Win32
#ifdef NO_VLAN
if (GetOsInfo()->OsType == OSTYPE_MACOS_X)
{
// A virtual LAN card can not be added or removed in MacOS X
CiSetError(c, ERR_NOT_SUPPORTED);
return false;
}
#endif
// Check whether the specified name is valid or not
if (IsSafeStr(create->DeviceName) == false)
@ -9792,7 +9800,11 @@ bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root)
// Eraser
c->Eraser = NewEraser(c->Logger, CfgGetInt64(config, "AutoDeleteCheckDiskFreeSpaceMin"));
if (OS_IS_UNIX(GetOsInfo()->OsType) && GetOsInfo()->OsType != OSTYPE_MACOS_X)
if (OS_IS_UNIX(GetOsInfo()->OsType)
#ifdef NO_VLAN
&& GetOsInfo()->OsType != OSTYPE_MACOS_X
#endif
)
{
// Read the UNIX version virtual LAN card list (except MacOS)
vlan = CfgGetFolder(root, "UnixVLan");
@ -9802,6 +9814,7 @@ bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root)
}
}
#ifdef NO_VLAN
if (GetOsInfo()->OsType == OSTYPE_MACOS_X)
{
#ifdef OS_UNIX
@ -9822,6 +9835,7 @@ bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root)
Add(c->UnixVLanList, uv);
#endif // OS_UNIX
}
#endif
CiLoadAccountDatabase(c, db);
@ -10328,7 +10342,11 @@ void CiWriteSettingToCfg(CLIENT *c, FOLDER *root)
CiWriteCAList(c, ca);
// VLAN
if (OS_IS_UNIX(GetOsInfo()->OsType) && GetOsInfo()->OsType != OSTYPE_MACOS_X)
if (OS_IS_UNIX(GetOsInfo()->OsType)
#ifdef NO_VLAN
&& GetOsInfo()->OsType != OSTYPE_MACOS_X
#endif
)
{
vlan = CfgCreateFolder(root, "UnixVLan");
CiWriteVLanList(c, vlan);