- free(interface);
- interface = NULL;
- for (addrp = ifaddr;
- addrp != NULL;
- addrp = addrp->ifa_next) {
- if (strncasecmp("lo", addrp->ifa_name, strlen("lo")) == 0)
- continue;
- // Skip this interface if it is a wireless interface.
- snprintf(path, sizeof(path), "/sys/class/net/%s/wireless", addrp->ifa_name);
- const bool is_wireless = (stat(path, &stbuf) == 0);
- if (( is_wireless && type == NET_TYPE_ETHERNET) ||
- (!is_wireless && type == NET_TYPE_WIRELESS))
- continue;
- interface = strdup(addrp->ifa_name);
- break;
- }
+ free(interface);
+ interface = NULL;
+ for (addrp = ifaddr;
+ addrp != NULL;
+ addrp = addrp->ifa_next) {
+ if (strncasecmp("lo", addrp->ifa_name, strlen("lo")) == 0)
+ continue;
+ // Skip this interface if it is a wireless interface.
+ snprintf(path, sizeof(path), "/sys/class/net/%s/wireless", addrp->ifa_name);
+ const bool is_wireless = (stat(path, &stbuf) == 0);
+ if ((is_wireless && type == NET_TYPE_ETHERNET) ||
+ (!is_wireless && type == NET_TYPE_WIRELESS))
+ continue;
+ interface = strdup(addrp->ifa_name);
+ break;
+ }