gsupplicant: Dont allow scanning while associating
authorMohamed Abbas <mabbas@linux.intel.com>
Mon, 13 Dec 2010 15:32:35 +0000 (16:32 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 13 Dec 2010 15:32:35 +0000 (16:32 +0100)
In gsupplicant defer any scanning if association is in progress.

gsupplicant/supplicant.c

index 861936e6c41f1e04e99207b99e70dce3bf9cf0c6..0e4f932b54bfbcfb74dafca373ec90bb2b9b855f 100644 (file)
@@ -2007,6 +2007,21 @@ int g_supplicant_interface_scan(GSupplicantInterface *interface,
        if (interface->scanning == TRUE)
                return -EALREADY;
 
+       switch (interface->state) {
+       case G_SUPPLICANT_STATE_AUTHENTICATING:
+       case G_SUPPLICANT_STATE_ASSOCIATING:
+       case G_SUPPLICANT_STATE_ASSOCIATED:
+       case G_SUPPLICANT_STATE_4WAY_HANDSHAKE:
+       case G_SUPPLICANT_STATE_GROUP_HANDSHAKE:
+               return -EBUSY;
+       case G_SUPPLICANT_STATE_UNKNOWN:
+       case G_SUPPLICANT_STATE_DISCONNECTED:
+       case G_SUPPLICANT_STATE_INACTIVE:
+       case G_SUPPLICANT_STATE_SCANNING:
+       case G_SUPPLICANT_STATE_COMPLETED:
+               break;
+       }
+
        data = dbus_malloc0(sizeof(*data));
        if (data == NULL)
                return -ENOMEM;