diff --git a/src/Cedar/VLanUnix.c b/src/Cedar/VLanUnix.c index b59fe2e0..784bd746 100644 --- a/src/Cedar/VLanUnix.c +++ b/src/Cedar/VLanUnix.c @@ -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; diff --git a/src/Cedar/VLanUnix.h b/src/Cedar/VLanUnix.h index faac5b3c..26fca385 100644 --- a/src/Cedar/VLanUnix.h +++ b/src/Cedar/VLanUnix.h @@ -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);