struct ifreq ifr;
fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
- if (fd < 0)
+ if (fd < 0) {
+ ERR("socket failed %d", errno);
return FALSE;
+ }
memset(&ifr, 0, sizeof(ifr));
g_strlcpy((char *)ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
+ ERR("Fail to get IFFLAGS %d", errno);
close(fd);
return FALSE;
}
ifr.ifr_flags |= (IFF_UP | IFF_DYNAMIC);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
+ ERR("Fail to set IFFLAGS %d", errno);
close(fd);
return FALSE;
}
struct ifreq ifr;
fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
- if (fd < 0)
+ if (fd < 0) {
+ ERR("socket failed %d", errno);
return FALSE;
+ }
memset(&ifr, 0, sizeof(ifr));
g_strlcpy((char *)ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
+ ERR("Fail to get IFFLAGS %d", errno);
close(fd);
return FALSE;
}
ifr.ifr_flags = (ifr.ifr_flags & ~IFF_UP) | IFF_DYNAMIC;
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
+ ERR("Fail to set IFFLAGS %d", errno);
close(fd);
return FALSE;
}