UPSTREAM: cfg80211: Update Transition Disable policy during port authorization

In case of 4way handshake offload, transition disable policy
updated by the AP during EAPOL 3/4 is not updated to the upper layer.
This results in mismatch between transition disable policy
between the upper layer and the driver. This patch addresses this
issue by updating transition disable policy as part of port
authorization indication.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 271996243
Change-Id: Iac5d22a2c3999c7bdddc3a1f683fef82ed8ff918
(cherry picked from commit 0ff57171d6d225558c81a69439d5323e35b40549)
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
This commit is contained in:
Vinayak Yadawad 2022-09-07 18:14:48 +05:30 committed by Greg Kroah-Hartman
parent c59181f352
commit ef554cf3fc
8 changed files with 31 additions and 10 deletions

View File

@ -6005,7 +6005,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
brcmf_dbg(CONN, "Report roaming result\n"); brcmf_dbg(CONN, "Report roaming result\n");
if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) { if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) {
cfg80211_port_authorized(ndev, profile->bssid, GFP_KERNEL); cfg80211_port_authorized(ndev, profile->bssid, NULL, 0, GFP_KERNEL);
brcmf_dbg(CONN, "Report port authorized\n"); brcmf_dbg(CONN, "Report port authorized\n");
} }

View File

@ -7684,6 +7684,8 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
* *
* @dev: network device * @dev: network device
* @bssid: the BSSID of the AP * @bssid: the BSSID of the AP
* @td_bitmap: transition disable policy
* @td_bitmap_len: Length of transition disable policy
* @gfp: allocation flags * @gfp: allocation flags
* *
* This function should be called by a driver that supports 4 way handshake * This function should be called by a driver that supports 4 way handshake
@ -7694,7 +7696,7 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
* indicate the 802.11 association. * indicate the 802.11 association.
*/ */
void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
gfp_t gfp); const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);
/** /**
* cfg80211_disconnected - notify cfg80211 that connection was dropped * cfg80211_disconnected - notify cfg80211 that connection was dropped

View File

@ -2749,6 +2749,8 @@ enum nl80211_commands {
* When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
* timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
* the incoming frame RX timestamp. * the incoming frame RX timestamp.
* @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent
* (re)associations.
* @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined * @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use * @__NL80211_ATTR_AFTER_LAST: internal use
@ -3276,6 +3278,7 @@ enum nl80211_attrs {
NL80211_ATTR_TX_HW_TIMESTAMP, NL80211_ATTR_TX_HW_TIMESTAMP,
NL80211_ATTR_RX_HW_TIMESTAMP, NL80211_ATTR_RX_HW_TIMESTAMP,
NL80211_ATTR_TD_BITMAP,
/* add attributes here, update the policy in nl80211.c */ /* add attributes here, update the policy in nl80211.c */

View File

@ -271,6 +271,8 @@ struct cfg80211_event {
} ij; } ij;
struct { struct {
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
const u8 *td_bitmap;
u8 td_bitmap_len;
} pa; } pa;
}; };
}; };
@ -409,7 +411,8 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
bool wextev); bool wextev);
void __cfg80211_roamed(struct wireless_dev *wdev, void __cfg80211_roamed(struct wireless_dev *wdev,
struct cfg80211_roam_info *info); struct cfg80211_roam_info *info);
void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid); void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid,
const u8 *td_bitmap, u8 td_bitmap_len);
int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev); struct wireless_dev *wdev);
void cfg80211_autodisconnect_wk(struct work_struct *work); void cfg80211_autodisconnect_wk(struct work_struct *work);

View File

@ -17947,7 +17947,8 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
} }
void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev, void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *bssid) struct net_device *netdev, const u8 *bssid,
const u8 *td_bitmap, u8 td_bitmap_len)
{ {
struct sk_buff *msg; struct sk_buff *msg;
void *hdr; void *hdr;
@ -17967,6 +17968,11 @@ void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid)) nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid))
goto nla_put_failure; goto nla_put_failure;
if ((td_bitmap_len > 0) && td_bitmap)
if (nla_put(msg, NL80211_ATTR_TD_BITMAP,
td_bitmap_len, td_bitmap))
goto nla_put_failure;
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,

View File

@ -83,7 +83,8 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
struct net_device *netdev, struct net_device *netdev,
struct cfg80211_roam_info *info, gfp_t gfp); struct cfg80211_roam_info *info, gfp_t gfp);
void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev, void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *bssid); struct net_device *netdev, const u8 *bssid,
const u8 *td_bitmap, u8 td_bitmap_len);
void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
struct net_device *netdev, u16 reason, struct net_device *netdev, u16 reason,
const u8 *ie, size_t ie_len, bool from_ap); const u8 *ie, size_t ie_len, bool from_ap);

View File

@ -1280,7 +1280,8 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
} }
EXPORT_SYMBOL(cfg80211_roamed); EXPORT_SYMBOL(cfg80211_roamed);
void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid) void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid,
const u8 *td_bitmap, u8 td_bitmap_len)
{ {
ASSERT_WDEV_LOCK(wdev); ASSERT_WDEV_LOCK(wdev);
@ -1293,11 +1294,11 @@ void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid)
return; return;
nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev, nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev,
bssid); bssid, td_bitmap, td_bitmap_len);
} }
void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
gfp_t gfp) const u8 *td_bitmap, u8 td_bitmap_len, gfp_t gfp)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
@ -1307,12 +1308,15 @@ void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
if (WARN_ON(!bssid)) if (WARN_ON(!bssid))
return; return;
ev = kzalloc(sizeof(*ev), gfp); ev = kzalloc(sizeof(*ev) + td_bitmap_len, gfp);
if (!ev) if (!ev)
return; return;
ev->type = EVENT_PORT_AUTHORIZED; ev->type = EVENT_PORT_AUTHORIZED;
memcpy(ev->pa.bssid, bssid, ETH_ALEN); memcpy(ev->pa.bssid, bssid, ETH_ALEN);
ev->pa.td_bitmap = ((u8 *)ev) + sizeof(*ev);
ev->pa.td_bitmap_len = td_bitmap_len;
memcpy((void *)ev->pa.td_bitmap, td_bitmap, td_bitmap_len);
/* /*
* Use the wdev event list so that if there are pending * Use the wdev event list so that if there are pending

View File

@ -990,7 +990,9 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev)
__cfg80211_leave(wiphy_to_rdev(wdev->wiphy), wdev); __cfg80211_leave(wiphy_to_rdev(wdev->wiphy), wdev);
break; break;
case EVENT_PORT_AUTHORIZED: case EVENT_PORT_AUTHORIZED:
__cfg80211_port_authorized(wdev, ev->pa.bssid); __cfg80211_port_authorized(wdev, ev->pa.bssid,
ev->pa.td_bitmap,
ev->pa.td_bitmap_len);
break; break;
} }
wdev_unlock(wdev); wdev_unlock(wdev);