]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not allow scan or normal association on cfg80211 P2P Device
authorJouni Malinen <j@w1.fi>
Sun, 1 Mar 2015 09:23:09 +0000 (11:23 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 1 Mar 2015 09:23:09 +0000 (11:23 +0200)
The dedicated P2P management instance (wpas->p2p_mgmt == 1) using
cfg80211 P2P Device cannot be used for non-P2P uses or connection (there
is no netdev). Reject or ignore such operations to avoid unexpected
operations if enabled network blocks are configured in the
wpa_supplicant instance used to control this interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/events.c
wpa_supplicant/scan.c
wpa_supplicant/wpa_supplicant.c

index f76fe97c52ef1b0c1615798f79fc8632ddc0d07a..1f9fc97a9787544e5f823236a0f4aa17ec94d600 100644 (file)
@@ -1421,6 +1421,9 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
        struct wpa_bss *selected;
        struct wpa_ssid *ssid = NULL;
 
+       if (wpa_s->p2p_mgmt)
+               return 0; /* no normal connection on p2p_mgmt interface */
+
        selected = wpa_supplicant_pick_network(wpa_s, &ssid);
 
        if (selected) {
index 6e376a2ab4198c28af14c913ab449cd5e93ed43b..27e2cc0f5e7e79517aa9a3ccd01adf4493fd6f10 100644 (file)
@@ -96,6 +96,10 @@ int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s)
 {
        struct wpa_ssid *ssid = wpa_s->conf->ssid;
        int count = 0, disabled = 0;
+
+       if (wpa_s->p2p_mgmt)
+               return 0; /* no normal network profiles on p2p_mgmt interface */
+
        while (ssid) {
                if (!wpas_network_disabled(wpa_s, ssid))
                        count++;
@@ -1066,8 +1070,17 @@ void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec)
  */
 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
 {
-       int res = eloop_deplete_timeout(sec, usec, wpa_supplicant_scan, wpa_s,
-                                       NULL);
+       int res;
+
+       if (wpa_s->p2p_mgmt) {
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "Ignore scan request (%d.%06d sec) on p2p_mgmt interface",
+                       sec, usec);
+               return;
+       }
+
+       res = eloop_deplete_timeout(sec, usec, wpa_supplicant_scan, wpa_s,
+                                   NULL);
        if (res == 1) {
                wpa_dbg(wpa_s, MSG_DEBUG, "Rescheduling scan request: %d.%06d sec",
                        sec, usec);
index 16f05c7d7595cf16dc3b0e645fae5432de55c80d..e96199ea217da1d7040c0f85b77d86095decd7f0 100644 (file)
@@ -4966,6 +4966,9 @@ int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
        int i;
        unsigned int drv_enc;
 
+       if (wpa_s->p2p_mgmt)
+               return 1; /* no normal network profiles on p2p_mgmt interface */
+
        if (ssid == NULL)
                return 1;