gboolean __connman_element_device_isfiltered(const char *devname)
{
- if (device_filter != NULL &&
- g_pattern_match_simple(device_filter, devname) == FALSE) {
- DBG("ignoring device %s (no match)", devname);
+ if (device_filter == NULL)
+ goto nodevice;
+
+ if (g_pattern_match_simple(device_filter, devname) == FALSE) {
+ DBG("ignoring device %s (match)", devname);
return TRUE;
}
- if (nodevice_filter != NULL &&
- g_pattern_match_simple(nodevice_filter, devname) == TRUE) {
- DBG("ignoring device %s (match no)", devname);
+
+nodevice:
+ if (nodevice_filter == NULL)
+ return FALSE;
+
+ if (g_pattern_match_simple(nodevice_filter, devname) == TRUE) {
+ DBG("ignoring device %s (no match)", devname);
return TRUE;
}
+
return FALSE;
}
if (element->devname == NULL)
element->devname = g_strdup(element->name);
- if (element->type == CONNMAN_ELEMENT_TYPE_DEVICE &&
- __connman_element_device_isfiltered(element->devname) == TRUE) {
- DBG("ignoring %s [%s] device", element->name, element->devname);
+ if (element->type != CONNMAN_ELEMENT_TYPE_DEVICE)
+ goto setup;
+
+ if (__connman_element_device_isfiltered(element->devname) == TRUE)
return -EPERM;
- }
+setup:
if (connman_element_ref(element) == NULL)
return -EINVAL;
devname = connman_inet_ifname(index);
if (devname == NULL)
return NULL;
+
if (__connman_element_device_isfiltered(devname) == TRUE) {
- connman_info("Ignoring network interface %s (filtered)",
- devname);
+ connman_info("Ignoring interface %s (filtered)", devname);
return NULL;
}
switch (type) {
case CONNMAN_DEVICE_TYPE_UNKNOWN:
- connman_info("Ignoring network interface %s (type unknown)",
- devname);
+ connman_info("Ignoring interface %s (type unknown)", devname);
g_free(devname);
return NULL;
case CONNMAN_DEVICE_TYPE_ETHERNET:
goto update;
ifname = connman_inet_ifname(index);
+
if (__connman_element_device_isfiltered(ifname) == TRUE) {
- connman_info("Ignoring network interface %s (filtered)",
- ifname);
+ connman_info("Ignoring interface %s (filtered)", ifname);
g_free(ifname);
return;
}