History

nl80211: add FILS related parameters to ROAM event

In case of FILS shared key offload the parameters can change upon roaming of which user-space needs to be notified.

Arend Van Spriel committed 8 years ago

Commit e841b7b1 parent 76804d24 files · +59 −10Browse files

Unified · Split

4 files
  1. include/net/cfg80211.h +2 −0
  2. include/uapi/linux/nl80211.h +2 −1
  3. net/wireless/nl80211.c +14 −2
  4. net/wireless/sme.c +41 −7
include/net/cfg80211.h+2−0
@@ -5624,6 +5624,7 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, · 5623 unmodified lines
56245624 * @req_ie_len: association request IEs length
56255625 * @resp_ie: association response IEs (may be %NULL)
56265626 * @resp_ie_len: assoc response IEs length
5627+ * @fils: FILS related roaming information.
56275628 */
56285629 struct cfg80211_roam_info {
56295630 struct ieee80211_channel *channel;
@@ -5633,6 +5634,7 @@ struct cfg80211_roam_info { · 3 unmodified lines
56335634 size_t req_ie_len;
56345635 const u8 *resp_ie;
56355636 size_t resp_ie_len;
5637+ struct cfg80211_fils_resp_params fils;
56365638 };
56375639
56385640 /**
include/uapi/linux/nl80211.h+2−1
@@ -215,7 +215,8 @@ · 214 unmodified lines
215215 * as specified in IETF RFC 6696.
216216 *
217217 * When FILS shared key authentication is completed, driver needs to provide the
218− * below additional parameters to userspace.
218+ * below additional parameters to userspace, which can be either after setting
219+ * up a connection or after roaming.
219220 * %NL80211_ATTR_FILS_KEK - used for key renewal
220221 * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges
221222 * %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated
net/wireless/nl80211.c+14−2
@@ -14264,7 +14264,9 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, · 14263 unmodified lines
1426414264 void *hdr;
1426514265 const u8 *bssid = info->bss ? info->bss->bssid : info->bssid;
1426614266
14267− msg = nlmsg_new(100 + info->req_ie_len + info->resp_ie_len, gfp);
14267+ msg = nlmsg_new(100 + info->req_ie_len + info->resp_ie_len +
14268+ info->fils.kek_len + info->fils.pmk_len +
14269+ (info->fils.pmkid ? WLAN_PMKID_LEN : 0), gfp);
1426814270 if (!msg)
1426914271 return;
1427014272
@@ -14282,7 +14284,17 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, · 11 unmodified lines
1428214284 info->req_ie)) ||
1428314285 (info->resp_ie &&
1428414286 nla_put(msg, NL80211_ATTR_RESP_IE, info->resp_ie_len,
14285− info->resp_ie)))
14287+ info->resp_ie)) ||
14288+ (info->fils.update_erp_next_seq_num &&
14289+ nla_put_u16(msg, NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM,
14290+ info->fils.erp_next_seq_num)) ||
14291+ (info->fils.kek &&
14292+ nla_put(msg, NL80211_ATTR_FILS_KEK, info->fils.kek_len,
14293+ info->fils.kek)) ||
14294+ (info->fils.pmk &&
14295+ nla_put(msg, NL80211_ATTR_PMK, info->fils.pmk_len, info->fils.pmk)) ||
14296+ (info->fils.pmkid &&
14297+ nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, info->fils.pmkid)))
1428614298 goto nla_put_failure;
1428714299
1428814300 genlmsg_end(msg, hdr);
net/wireless/sme.c+41−7
@@ -932,6 +932,7 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, · 931 unmodified lines
932932 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
933933 struct cfg80211_event *ev;
934934 unsigned long flags;
935+ u8 *next;
935936
936937 if (!info->bss) {
937938 info->bss = cfg80211_get_bss(wdev->wiphy, info->channel,
@@ -944,19 +945,52 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, · 6 unmodified lines
944945 if (WARN_ON(!info->bss))
945946 return;
946947
947− ev = kzalloc(sizeof(*ev) + info->req_ie_len + info->resp_ie_len, gfp);
948+ ev = kzalloc(sizeof(*ev) + info->req_ie_len + info->resp_ie_len +
949+ info->fils.kek_len + info->fils.pmk_len +
950+ (info->fils.pmkid ? WLAN_PMKID_LEN : 0), gfp);
948951 if (!ev) {
949952 cfg80211_put_bss(wdev->wiphy, info->bss);
950953 return;
951954 }
952955
953956 ev->type = EVENT_ROAMED;
954− ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev);
955− ev->rm.req_ie_len = info->req_ie_len;
956− memcpy((void *)ev->rm.req_ie, info->req_ie, info->req_ie_len);
957− ev->rm.resp_ie = ((u8 *)ev) + sizeof(*ev) + info->req_ie_len;
958− ev->rm.resp_ie_len = info->resp_ie_len;
959− memcpy((void *)ev->rm.resp_ie, info->resp_ie, info->resp_ie_len);
957+ next = ((u8 *)ev) + sizeof(*ev);
958+ if (info->req_ie_len) {
959+ ev->rm.req_ie = next;
960+ ev->rm.req_ie_len = info->req_ie_len;
961+ memcpy((void *)ev->rm.req_ie, info->req_ie, info->req_ie_len);
962+ next += info->req_ie_len;
963+ }
964+ if (info->resp_ie_len) {
965+ ev->rm.resp_ie = next;
966+ ev->rm.resp_ie_len = info->resp_ie_len;
967+ memcpy((void *)ev->rm.resp_ie, info->resp_ie,
968+ info->resp_ie_len);
969+ next += info->resp_ie_len;
970+ }
971+ if (info->fils.kek_len) {
972+ ev->rm.fils.kek = next;
973+ ev->rm.fils.kek_len = info->fils.kek_len;
974+ memcpy((void *)ev->rm.fils.kek, info->fils.kek,
975+ info->fils.kek_len);
976+ next += info->fils.kek_len;
977+ }
978+ if (info->fils.pmk_len) {
979+ ev->rm.fils.pmk = next;
980+ ev->rm.fils.pmk_len = info->fils.pmk_len;
981+ memcpy((void *)ev->rm.fils.pmk, info->fils.pmk,
982+ info->fils.pmk_len);
983+ next += info->fils.pmk_len;
984+ }
985+ if (info->fils.pmkid) {
986+ ev->rm.fils.pmkid = next;
987+ memcpy((void *)ev->rm.fils.pmkid, info->fils.pmkid,
988+ WLAN_PMKID_LEN);
989+ next += WLAN_PMKID_LEN;
990+ }
991+ ev->rm.fils.update_erp_next_seq_num = info->fils.update_erp_next_seq_num;
992+ if (info->fils.update_erp_next_seq_num)
993+ ev->rm.fils.erp_next_seq_num = info->fils.erp_next_seq_num;
960994 ev->rm.bss = info->bss;
961995
962996 spin_lock_irqsave(&wdev->event_lock, flags);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t