]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Change vif type to P2P_CLI upon P2P authentication
authorEliad Peller <eliad@wizery.com>
Sun, 17 Jul 2011 17:25:58 +0000 (20:25 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 17 Jul 2011 17:25:58 +0000 (20:25 +0300)
Currently, wpa_driver_nl80211_authenticate() changes the interface type
to station. However, in case of P2P, we need to change the interface
type to P2P_CLI.

Add p2p field to the authentication params, and consider it for choosing
the correct interface type.

Signed-off-by: Eliad Peller <eliad@wizery.com>
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/sme.c

index 0d8a6a309f0b35bac00ba0c3ef6f72cc085f4e69..4bc4d2dc8781ad31f18d170d73708f9a922aa99e 100644 (file)
@@ -282,6 +282,12 @@ struct wpa_driver_auth_params {
        size_t wep_key_len[4];
        int wep_tx_keyidx;
        int local_state_change;
+
+       /**
+        * p2p - Whether this connection is a P2P group
+        */
+       int p2p;
+
 };
 
 enum wps_mode {
index ae5d8afd47f2cf58e2b8a220298cbd4e1f6cf255..87d474ed583503b4d895eabc19ac42bbc1865ece 100644 (file)
@@ -3160,13 +3160,16 @@ static int wpa_driver_nl80211_authenticate(
        int ret = -1, i;
        struct nl_msg *msg;
        enum nl80211_auth_type type;
+       enum nl80211_iftype nlmode;
        int count = 0;
 
        drv->associated = 0;
        os_memset(drv->auth_bssid, 0, ETH_ALEN);
        /* FIX: IBSS mode */
-       if (drv->nlmode != NL80211_IFTYPE_STATION &&
-           wpa_driver_nl80211_set_mode(priv, NL80211_IFTYPE_STATION) < 0)
+       nlmode = params->p2p ?
+               NL80211_IFTYPE_P2P_CLIENT : NL80211_IFTYPE_STATION;
+       if (drv->nlmode != nlmode &&
+           wpa_driver_nl80211_set_mode(priv, nlmode) < 0)
                return -1;
 
 retry:
index 325ffc550f7219bf53bd11d9df43cbfda83d6373..86d6b6a30f69c290afde66db34001bdff766d202 100644 (file)
@@ -72,6 +72,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
        params.bssid = bss->bssid;
        params.ssid = bss->ssid;
        params.ssid_len = bss->ssid_len;
+       params.p2p = ssid->p2p_group;
 
        if (wpa_s->sme.ssid_len != params.ssid_len ||
            os_memcmp(wpa_s->sme.ssid, params.ssid, params.ssid_len) != 0)