Standardize on a single definition of auth_alg bitfield values
This commit is contained in:
parent
70f8cc8ec8
commit
abd9fafab6
14 changed files with 48 additions and 67 deletions
|
@ -77,6 +77,7 @@ static inline int wpa_key_mgmt_sha256(int akm)
|
|||
#define WPA_AUTH_ALG_OPEN BIT(0)
|
||||
#define WPA_AUTH_ALG_SHARED BIT(1)
|
||||
#define WPA_AUTH_ALG_LEAP BIT(2)
|
||||
#define WPA_AUTH_ALG_FT BIT(2)
|
||||
|
||||
|
||||
enum wpa_alg {
|
||||
|
|
|
@ -103,11 +103,6 @@ struct hostapd_hw_modes {
|
|||
};
|
||||
|
||||
|
||||
#define AUTH_ALG_OPEN_SYSTEM 0x01
|
||||
#define AUTH_ALG_SHARED_KEY 0x02
|
||||
#define AUTH_ALG_LEAP 0x04
|
||||
#define AUTH_ALG_FT 0x08
|
||||
|
||||
#define IEEE80211_MODE_INFRA 0
|
||||
#define IEEE80211_MODE_IBSS 1
|
||||
#define IEEE80211_MODE_AP 2
|
||||
|
@ -329,7 +324,7 @@ struct wpa_driver_associate_params {
|
|||
|
||||
/**
|
||||
* auth_alg - Allowed authentication algorithms
|
||||
* Bit field of AUTH_ALG_*
|
||||
* Bit field of WPA_AUTH_ALG_*
|
||||
*/
|
||||
int auth_alg;
|
||||
|
||||
|
|
|
@ -1148,10 +1148,10 @@ wpa_driver_bsd_set_auth_alg(void *priv, int auth_alg)
|
|||
struct wpa_driver_bsd_data *drv = priv;
|
||||
int authmode;
|
||||
|
||||
if ((auth_alg & AUTH_ALG_OPEN_SYSTEM) &&
|
||||
(auth_alg & AUTH_ALG_SHARED_KEY))
|
||||
if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
|
||||
(auth_alg & WPA_AUTH_ALG_SHARED))
|
||||
authmode = IEEE80211_AUTH_AUTO;
|
||||
else if (auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
else if (auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
authmode = IEEE80211_AUTH_SHARED;
|
||||
else
|
||||
authmode = IEEE80211_AUTH_OPEN;
|
||||
|
|
|
@ -1533,11 +1533,11 @@ static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg)
|
|||
struct wpa_driver_hostap_data *drv = priv;
|
||||
int algs = 0;
|
||||
|
||||
if (auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
algs |= 1;
|
||||
if (auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
if (auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
algs |= 2;
|
||||
if (auth_alg & AUTH_ALG_LEAP)
|
||||
if (auth_alg & WPA_AUTH_ALG_LEAP)
|
||||
algs |= 4;
|
||||
if (algs == 0)
|
||||
algs = 1; /* at least one algorithm should be set */
|
||||
|
|
|
@ -355,11 +355,11 @@ static int wpa_driver_ipw_set_auth_alg(void *priv, int auth_alg)
|
|||
struct wpa_driver_ipw_data *drv = priv;
|
||||
int algs = 0;
|
||||
|
||||
if (auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
algs |= 1;
|
||||
if (auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
if (auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
algs |= 2;
|
||||
if (auth_alg & AUTH_ALG_LEAP)
|
||||
if (auth_alg & WPA_AUTH_ALG_LEAP)
|
||||
algs |= 4;
|
||||
if (algs == 0)
|
||||
algs = 1; /* at least one algorithm should be set */
|
||||
|
|
|
@ -1662,10 +1662,10 @@ wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg)
|
|||
struct wpa_driver_madwifi_data *drv = priv;
|
||||
int authmode;
|
||||
|
||||
if ((auth_alg & AUTH_ALG_OPEN_SYSTEM) &&
|
||||
(auth_alg & AUTH_ALG_SHARED_KEY))
|
||||
if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
|
||||
(auth_alg & WPA_AUTH_ALG_SHARED))
|
||||
authmode = IEEE80211_AUTH_AUTO;
|
||||
else if (auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
else if (auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
authmode = IEEE80211_AUTH_SHARED;
|
||||
else
|
||||
authmode = IEEE80211_AUTH_OPEN;
|
||||
|
|
|
@ -1107,8 +1107,8 @@ wpa_driver_ndis_associate(void *priv,
|
|||
}
|
||||
|
||||
if (params->wpa_ie == NULL || params->wpa_ie_len == 0) {
|
||||
if (params->auth_alg & AUTH_ALG_SHARED_KEY) {
|
||||
if (params->auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (params->auth_alg & WPA_AUTH_ALG_SHARED) {
|
||||
if (params->auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
auth_mode = Ndis802_11AuthModeAutoSwitch;
|
||||
else
|
||||
auth_mode = Ndis802_11AuthModeShared;
|
||||
|
|
|
@ -2089,13 +2089,13 @@ retry:
|
|||
* TODO: if multiple auth_alg options enabled, try them one by one if
|
||||
* the AP rejects authentication due to unknown auth alg
|
||||
*/
|
||||
if (params->auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (params->auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
type = NL80211_AUTHTYPE_OPEN_SYSTEM;
|
||||
else if (params->auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
else if (params->auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
type = NL80211_AUTHTYPE_SHARED_KEY;
|
||||
else if (params->auth_alg & AUTH_ALG_LEAP)
|
||||
else if (params->auth_alg & WPA_AUTH_ALG_LEAP)
|
||||
type = NL80211_AUTHTYPE_NETWORK_EAP;
|
||||
else if (params->auth_alg & AUTH_ALG_FT)
|
||||
else if (params->auth_alg & WPA_AUTH_ALG_FT)
|
||||
type = NL80211_AUTHTYPE_FT;
|
||||
else
|
||||
goto nla_put_failure;
|
||||
|
@ -3427,13 +3427,13 @@ static int wpa_driver_nl80211_connect(
|
|||
NLA_PUT(msg, NL80211_ATTR_IE, params->wpa_ie_len,
|
||||
params->wpa_ie);
|
||||
|
||||
if (params->auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (params->auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
type = NL80211_AUTHTYPE_OPEN_SYSTEM;
|
||||
else if (params->auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
else if (params->auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
type = NL80211_AUTHTYPE_SHARED_KEY;
|
||||
else if (params->auth_alg & AUTH_ALG_LEAP)
|
||||
else if (params->auth_alg & WPA_AUTH_ALG_LEAP)
|
||||
type = NL80211_AUTHTYPE_NETWORK_EAP;
|
||||
else if (params->auth_alg & AUTH_ALG_FT)
|
||||
else if (params->auth_alg & WPA_AUTH_ALG_FT)
|
||||
type = NL80211_AUTHTYPE_FT;
|
||||
else
|
||||
goto nla_put_failure;
|
||||
|
|
|
@ -1406,8 +1406,8 @@ wpa_driver_ralink_associate(void *priv,
|
|||
#endif /* CONFIG_WPS */
|
||||
|
||||
if (params->wpa_ie == NULL || params->wpa_ie_len == 0) {
|
||||
if (params->auth_alg & AUTH_ALG_SHARED_KEY) {
|
||||
if (params->auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (params->auth_alg & WPA_AUTH_ALG_SHARED) {
|
||||
if (params->auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
auth_mode = Ndis802_11AuthModeAutoSwitch;
|
||||
else
|
||||
auth_mode = Ndis802_11AuthModeShared;
|
||||
|
|
|
@ -1907,9 +1907,9 @@ wpa_driver_wext_auth_alg_fallback(struct wpa_driver_wext_data *drv,
|
|||
if (!drv->use_crypt) {
|
||||
iwr.u.encoding.flags |= IW_ENCODE_DISABLED;
|
||||
} else {
|
||||
if (params->auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (params->auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
iwr.u.encoding.flags |= IW_ENCODE_OPEN;
|
||||
if (params->auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
if (params->auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
iwr.u.encoding.flags |= IW_ENCODE_RESTRICTED;
|
||||
}
|
||||
|
||||
|
@ -2034,11 +2034,11 @@ static int wpa_driver_wext_set_auth_alg(void *priv, int auth_alg)
|
|||
struct wpa_driver_wext_data *drv = priv;
|
||||
int algs = 0, res;
|
||||
|
||||
if (auth_alg & AUTH_ALG_OPEN_SYSTEM)
|
||||
if (auth_alg & WPA_AUTH_ALG_OPEN)
|
||||
algs |= IW_AUTH_ALG_OPEN_SYSTEM;
|
||||
if (auth_alg & AUTH_ALG_SHARED_KEY)
|
||||
if (auth_alg & WPA_AUTH_ALG_SHARED)
|
||||
algs |= IW_AUTH_ALG_SHARED_KEY;
|
||||
if (auth_alg & AUTH_ALG_LEAP)
|
||||
if (auth_alg & WPA_AUTH_ALG_LEAP)
|
||||
algs |= IW_AUTH_ALG_LEAP;
|
||||
if (algs == 0) {
|
||||
/* at least one algorithm should be set */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue