Skip to content

Commit a6dad6a

Browse files
twpedersenjmberg-intel
authored andcommitted
mac80211: support userspace MPM
Earlier mac80211 would check whether some kind of mesh security was enabled, when the real question was "is the MPM in userspace"? Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent eef941e commit a6dad6a

6 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎net/mac80211/cfg.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
14351435

14361436
switch (sdata->vif.type) {
14371437
case NL80211_IFTYPE_MESH_POINT:
1438-
if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED)
1438+
if (sdata->u.mesh.user_mpm)
14391439
statype = CFG80211_STA_MESH_PEER_USER;
14401440
else
14411441
statype = CFG80211_STA_MESH_PEER_KERNEL;
@@ -1729,6 +1729,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
17291729
ifmsh->mesh_sp_id = setup->sync_method;
17301730
ifmsh->mesh_pp_id = setup->path_sel_proto;
17311731
ifmsh->mesh_pm_id = setup->path_metric;
1732+
ifmsh->user_mpm = setup->user_mpm;
17321733
ifmsh->security = IEEE80211_MESH_SEC_NONE;
17331734
if (setup->is_authenticated)
17341735
ifmsh->security |= IEEE80211_MESH_SEC_AUTHED;

‎net/mac80211/ieee80211_i.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ struct ieee80211_if_mesh {
588588
IEEE80211_MESH_SEC_AUTHED = 0x1,
589589
IEEE80211_MESH_SEC_SECURED = 0x2,
590590
} security;
591+
bool user_mpm;
591592
/* Extensible Synchronization Framework */
592593
const struct ieee80211_mesh_sync_ops *sync_ops;
593594
s64 sync_offset_clockdrift_max;

‎net/mac80211/main.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
569569
wiphy->features |= NL80211_FEATURE_SK_TX_STATUS |
570570
NL80211_FEATURE_SAE |
571571
NL80211_FEATURE_HT_IBSS |
572-
NL80211_FEATURE_VIF_TXPOWER;
572+
NL80211_FEATURE_VIF_TXPOWER |
573+
NL80211_FEATURE_USERSPACE_MPM;
573574

574575
if (!ops->hw_scan)
575576
wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |

‎net/mac80211/mesh.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void mesh_sta_cleanup(struct sta_info *sta)
156156
* an update.
157157
*/
158158
changed = mesh_accept_plinks_update(sdata);
159-
if (sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
159+
if (!sdata->u.mesh.user_mpm) {
160160
changed |= mesh_plink_deactivate(sta);
161161
del_timer_sync(&sta->plink_timer);
162162
}

‎net/mac80211/mesh_plink.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,9 @@ mesh_sta_info_alloc(struct ieee80211_sub_if_data *sdata, u8 *addr,
437437
{
438438
struct sta_info *sta = NULL;
439439

440-
/* Userspace handles peer allocation when security is enabled */
441-
if (sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED)
440+
/* Userspace handles station allocation */
441+
if (sdata->u.mesh.user_mpm ||
442+
sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED)
442443
cfg80211_notify_new_peer_candidate(sdata->dev, addr,
443444
elems->ie_start,
444445
elems->total_len,
@@ -670,6 +671,10 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
670671
if (len < IEEE80211_MIN_ACTION_SIZE + 3)
671672
return;
672673

674+
if (sdata->u.mesh.user_mpm)
675+
/* userspace must register for these */
676+
return;
677+
673678
if (is_multicast_ether_addr(mgmt->da)) {
674679
mpl_dbg(sdata,
675680
"Mesh plink: ignore frame from multicast address\n");

‎net/mac80211/rx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
25432543
case WLAN_SP_MESH_PEERING_CONFIRM:
25442544
if (!ieee80211_vif_is_mesh(&sdata->vif))
25452545
goto invalid;
2546-
if (sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE)
2546+
if (sdata->u.mesh.user_mpm)
25472547
/* userspace handles this frame */
25482548
break;
25492549
goto queue;

0 commit comments

Comments
 (0)