mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Merge pull request #1869 from metalefty/bsdunixvlan-group
Cedar/VLanUnix: assign virtual interface to softether group
This commit is contained in:
commit
f6f2660060
@ -485,6 +485,9 @@ int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool cre
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set interface group
|
||||
UnixSetIfGroup(s, tap_name, CEDAR_PRODUCT_STR);
|
||||
|
||||
if (create_up)
|
||||
{
|
||||
Zero(&ifr, sizeof(ifr));
|
||||
@ -622,6 +625,24 @@ void UnixDestroyClientTapDevice(char *name)
|
||||
#endif // UNIX_BSD
|
||||
}
|
||||
|
||||
void UnixSetIfGroup(int fd, const char *name, const char *group_name)
|
||||
{
|
||||
#ifdef SIOCAIFGROUP
|
||||
struct ifgroupreq ifgr;
|
||||
char *tmp;
|
||||
|
||||
tmp = CopyStr((char *)group_name);
|
||||
StrLower(tmp);
|
||||
Zero(&ifgr, sizeof(ifgr));
|
||||
|
||||
StrCpy(ifgr.ifgr_name, sizeof(ifgr.ifgr_name), (char *) name);
|
||||
StrCpy(ifgr.ifgr_group, sizeof(ifgr.ifgr_group), tmp);
|
||||
ioctl(fd, SIOCAIFGROUP, &ifgr);
|
||||
|
||||
Free(tmp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else // NO_VLAN
|
||||
|
||||
void UnixCloseDevice(int fd)
|
||||
@ -636,6 +657,10 @@ void UnixDestroyTapDeviceEx(char *name, char *prefix)
|
||||
{
|
||||
}
|
||||
|
||||
void UnixSetIfGroup()
|
||||
{
|
||||
}
|
||||
|
||||
int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up)
|
||||
{
|
||||
return -1;
|
||||
|
@ -62,6 +62,7 @@ int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool cre
|
||||
void UnixCloseTapDevice(int fd);
|
||||
void UnixDestroyBridgeTapDevice(char *name);
|
||||
void UnixDestroyClientTapDevice(char *name);
|
||||
void UnixSetIfGroup(int fd, const char *name, const char *group_name);
|
||||
void UnixVLanInit();
|
||||
void UnixVLanFree();
|
||||
bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up);
|
||||
|
Loading…
Reference in New Issue
Block a user