+static bool is_virtual(const char *ifname) {
+ char path[1024];
+ char *target = NULL;
+ bool is_virtual = false;
+
+ snprintf(path, sizeof(path), "/sys/class/net/%s", ifname);
+ if ((target = realpath(path, NULL))) {
+ if (BEGINS_WITH(target, "/sys/devices/virtual/")) {
+ is_virtual = true;
+ }
+ }
+
+ free(target);
+ return is_virtual;
+}
+