device: Check positive device filter correctly
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Thu, 7 Mar 2013 08:24:37 +0000 (10:24 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 7 Mar 2013 08:55:55 +0000 (10:55 +0200)
The -i or --device command line option contains the device names
that we should use. Unfortunately the check fails if there are
multiple interfaces in that list and we ignore the interfaces instead.

Fixes BMC#25979

src/device.c

index fbfb2b5..2e0dbdc 100644 (file)
@@ -1306,17 +1306,23 @@ connman_bool_t __connman_device_isfiltered(const char *devname)
 {
        char **pattern;
        char **blacklisted_interfaces;
+       gboolean match;
 
        if (device_filter == NULL)
                goto nodevice;
 
-       for (pattern = device_filter; *pattern; pattern++) {
-               if (g_pattern_match_simple(*pattern, devname) == FALSE) {
-                       DBG("ignoring device %s (match)", devname);
-                       return TRUE;
+       for (pattern = device_filter, match = FALSE; *pattern; pattern++) {
+               if (g_pattern_match_simple(*pattern, devname) == TRUE) {
+                       match = TRUE;
+                       break;
                }
        }
 
+       if (match == FALSE) {
+               DBG("ignoring device %s (match)", devname);
+               return TRUE;
+       }
+
 nodevice:
        if (g_pattern_match_simple("dummy*", devname) == TRUE) {
                DBG("ignoring dummy networking devices");