From e572fa331c299e3a90c16c93c925d14d97bca0ce Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 12 May 2009 11:55:18 +0300 Subject: [PATCH] nl80211: Add MFP flag configuration for station mode This fixes IEEE 802.11w use with driver_nl80211.c in station mode. --- src/common/nl80211_copy.h | 21 ++++++++++++++++++++- src/drivers/driver_nl80211.c | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/common/nl80211_copy.h b/src/common/nl80211_copy.h index 7ae6e12e3..58c4ee182 100644 --- a/src/common/nl80211_copy.h +++ b/src/common/nl80211_copy.h @@ -234,7 +234,9 @@ * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those * should be fixed rather than automatically determined. Can only be * executed on a network interface that is UP, and fixed BSSID/FREQ - * may be rejected. + * may be rejected. Another optional parameter is the beacon interval, + * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not + * given defaults to 100 TU (102.4ms). * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is * determined by the network interface. * @@ -492,6 +494,11 @@ enum nl80211_commands { * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this * is used, e.g., with %NL80211_CMD_AUTHENTICATE event * + * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is + * used for the association (&enum nl80211_mfp, represented as a u32); + * this attribute can be used + * with %NL80211_CMD_ASSOCIATE request + * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ @@ -594,6 +601,8 @@ enum nl80211_attrs { NL80211_ATTR_TIMED_OUT, + NL80211_ATTR_USE_MFP, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -1177,4 +1186,14 @@ enum nl80211_key_type { NL80211_KEYTYPE_PEERKEY, }; +/** + * enum nl80211_mfp - Management frame protection state + * @NL80211_MFP_NO: Management frame protection not used + * @NL80211_MFP_REQUIRED: Management frame protection required + */ +enum nl80211_mfp { + NL80211_MFP_NO, + NL80211_MFP_REQUIRED, +}; + #endif /* __LINUX_NL80211_H */ diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 51e03465c..2c6bb2d67 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -3110,6 +3110,11 @@ static int wpa_driver_nl80211_associate( NLA_PUT(msg, NL80211_ATTR_IE, params->wpa_ie_len, params->wpa_ie); +#ifdef CONFIG_IEEE80211W + if (params->mgmt_frame_protection == MGMT_FRAME_PROTECTION_REQUIRED) + NLA_PUT_U32(msg, NL80211_ATTR_USE_MFP, NL80211_MFP_REQUIRED); +#endif /* CONFIG_IEEE80211W */ + ret = send_and_recv_msgs(drv, msg, NULL, NULL); msg = NULL; if (ret) {