device: Consider blacklisted interfaces from main.conf when filtering
authorManfred Kober <manfred.kober@gmx.de>
Thu, 21 Jun 2012 07:40:32 +0000 (09:40 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 25 Jun 2012 06:33:05 +0000 (09:33 +0300)
Interfaces blacklisted in main.conf are now also taken into account
by connman_device_isfiltered. This is done in addition to what gets
passed with -i or -I on the command line.

src/device.c

index 3a5e467..4a80b76 100644 (file)
@@ -1113,6 +1113,7 @@ int __connman_device_request_hidden_scan(struct connman_device *device,
 connman_bool_t __connman_device_isfiltered(const char *devname)
 {
        char **pattern;
+       char **blacklisted_interfaces;
 
        if (device_filter == NULL)
                goto nodevice;
@@ -1131,7 +1132,7 @@ nodevice:
        }
 
        if (nodevice_filter == NULL)
-               return FALSE;
+               goto list;
 
        for (pattern = nodevice_filter; *pattern; pattern++) {
                if (g_pattern_match_simple(*pattern, devname) == TRUE) {
@@ -1140,6 +1141,19 @@ nodevice:
                }
        }
 
+list:
+       blacklisted_interfaces =
+               connman_setting_get_string_list("BlacklistedInterfaces");
+       if (blacklisted_interfaces == NULL)
+               return FALSE;
+
+       for (pattern = blacklisted_interfaces; *pattern; pattern++) {
+               if (g_str_has_prefix(devname, *pattern) == TRUE) {
+                       DBG("ignoring device %s (blacklist)", devname);
+                       return TRUE;
+               }
+       }
+
        return FALSE;
 }