ifnet: replace SIOCGIFHWADDR ioctl

This commit is contained in:
Pavel Šimerda 2013-05-18 23:14:19 +02:00
parent f63c7f8ee6
commit 0f91894132
2 changed files with 2 additions and 20 deletions

@ -1 +1 @@
Subproject commit daadc3cfc3e5f35e2b5f861317d23e3a4d7a2137
Subproject commit be1b3b9d3dbfacf15ede143de377452a92976468

View file

@ -129,24 +129,6 @@ is_global_setting (char *key)
return 0;
}
/* Find out whether the 'iface' is an interface */
static gboolean
name_is_interface (const char *iface)
{
int fd;
struct ifreq ifr;
gboolean is_iface = FALSE;
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd >= 0) {
strncpy (ifr.ifr_name, iface, IFNAMSIZ);
if (ioctl (fd, SIOCGIFHWADDR, &ifr) == 0)
is_iface = TRUE;
close (fd);
}
return is_iface;
}
/* Parse a complete line */
/* Connection type is determined here */
static void
@ -191,7 +173,7 @@ init_block_by_line (gchar * buf)
/* ignored connection */
conn = add_new_connection_config ("ignore", pos);
} else
if (name_is_interface (pos) && !wifi_utils_is_wifi (pos, NULL))
if (if_nametoindex (pos) && !wifi_utils_is_wifi (pos, NULL))
/* wired connection */
conn = add_new_connection_config ("wired", pos);
else