]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Add support for auth_alg auto-selection with connect command
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 7 Apr 2011 11:53:40 +0000 (14:53 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 7 Apr 2011 11:53:40 +0000 (14:53 +0300)
When the SME is in the driver or cfg80211, the automatic selection
of auth_alg is done by leaving out the NL80211_ATTR_AUTH_TYPE
attribute from the NL80211_CMD_CONNECT command.

src/drivers/driver_nl80211.c

index 87fb4e28c3571a1b18c48253be96787c32d6f175..90b3f209b1ccbc08a7716e28c101877ec0fcad27 100644 (file)
@@ -4504,6 +4504,7 @@ static int wpa_driver_nl80211_connect(
        struct nl_msg *msg;
        enum nl80211_auth_type type;
        int ret = 0;
+       int algs;
 
        msg = nlmsg_alloc();
        if (!msg)
@@ -4538,6 +4539,19 @@ static int wpa_driver_nl80211_connect(
                NLA_PUT(msg, NL80211_ATTR_IE, params->wpa_ie_len,
                        params->wpa_ie);
 
+       algs = 0;
+       if (params->auth_alg & WPA_AUTH_ALG_OPEN)
+               algs++;
+       if (params->auth_alg & WPA_AUTH_ALG_SHARED)
+               algs++;
+       if (params->auth_alg & WPA_AUTH_ALG_LEAP)
+               algs++;
+       if (algs > 1) {
+               wpa_printf(MSG_DEBUG, "  * Leave out Auth Type for automatic "
+                          "selection");
+               goto skip_auth_type;
+       }
+
        if (params->auth_alg & WPA_AUTH_ALG_OPEN)
                type = NL80211_AUTHTYPE_OPEN_SYSTEM;
        else if (params->auth_alg & WPA_AUTH_ALG_SHARED)
@@ -4552,6 +4566,7 @@ static int wpa_driver_nl80211_connect(
        wpa_printf(MSG_DEBUG, "  * Auth Type %d", type);
        NLA_PUT_U32(msg, NL80211_ATTR_AUTH_TYPE, type);
 
+skip_auth_type:
        if (params->wpa_ie && params->wpa_ie_len) {
                enum nl80211_wpa_versions ver;