Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6dad6a2 authored by Thomas Pedersen's avatar Thomas Pedersen Committed by Johannes Berg
Browse files

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: default avatarThomas Pedersen <thomas@cozybit.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent eef941e6
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1435,7 +1435,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,


	switch (sdata->vif.type) {
	switch (sdata->vif.type) {
	case NL80211_IFTYPE_MESH_POINT:
	case NL80211_IFTYPE_MESH_POINT:
		if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED)
		if (sdata->u.mesh.user_mpm)
			statype = CFG80211_STA_MESH_PEER_USER;
			statype = CFG80211_STA_MESH_PEER_USER;
		else
		else
			statype = CFG80211_STA_MESH_PEER_KERNEL;
			statype = CFG80211_STA_MESH_PEER_KERNEL;
@@ -1729,6 +1729,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
	ifmsh->mesh_sp_id = setup->sync_method;
	ifmsh->mesh_sp_id = setup->sync_method;
	ifmsh->mesh_pp_id = setup->path_sel_proto;
	ifmsh->mesh_pp_id = setup->path_sel_proto;
	ifmsh->mesh_pm_id = setup->path_metric;
	ifmsh->mesh_pm_id = setup->path_metric;
	ifmsh->user_mpm = setup->user_mpm;
	ifmsh->security = IEEE80211_MESH_SEC_NONE;
	ifmsh->security = IEEE80211_MESH_SEC_NONE;
	if (setup->is_authenticated)
	if (setup->is_authenticated)
		ifmsh->security |= IEEE80211_MESH_SEC_AUTHED;
		ifmsh->security |= IEEE80211_MESH_SEC_AUTHED;
+1 −0
Original line number Original line Diff line number Diff line
@@ -588,6 +588,7 @@ struct ieee80211_if_mesh {
		IEEE80211_MESH_SEC_AUTHED = 0x1,
		IEEE80211_MESH_SEC_AUTHED = 0x1,
		IEEE80211_MESH_SEC_SECURED = 0x2,
		IEEE80211_MESH_SEC_SECURED = 0x2,
	} security;
	} security;
	bool user_mpm;
	/* Extensible Synchronization Framework */
	/* Extensible Synchronization Framework */
	const struct ieee80211_mesh_sync_ops *sync_ops;
	const struct ieee80211_mesh_sync_ops *sync_ops;
	s64 sync_offset_clockdrift_max;
	s64 sync_offset_clockdrift_max;
+2 −1
Original line number Original line Diff line number Diff line
@@ -569,7 +569,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
	wiphy->features |= NL80211_FEATURE_SK_TX_STATUS |
	wiphy->features |= NL80211_FEATURE_SK_TX_STATUS |
			   NL80211_FEATURE_SAE |
			   NL80211_FEATURE_SAE |
			   NL80211_FEATURE_HT_IBSS |
			   NL80211_FEATURE_HT_IBSS |
			   NL80211_FEATURE_VIF_TXPOWER;
			   NL80211_FEATURE_VIF_TXPOWER |
			   NL80211_FEATURE_USERSPACE_MPM;


	if (!ops->hw_scan)
	if (!ops->hw_scan)
		wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
		wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
+1 −1
Original line number Original line Diff line number Diff line
@@ -156,7 +156,7 @@ void mesh_sta_cleanup(struct sta_info *sta)
	 * an update.
	 * an update.
	 */
	 */
	changed = mesh_accept_plinks_update(sdata);
	changed = mesh_accept_plinks_update(sdata);
	if (sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
	if (!sdata->u.mesh.user_mpm) {
		changed |= mesh_plink_deactivate(sta);
		changed |= mesh_plink_deactivate(sta);
		del_timer_sync(&sta->plink_timer);
		del_timer_sync(&sta->plink_timer);
	}
	}
+7 −2
Original line number Original line Diff line number Diff line
@@ -437,8 +437,9 @@ mesh_sta_info_alloc(struct ieee80211_sub_if_data *sdata, u8 *addr,
{
{
	struct sta_info *sta = NULL;
	struct sta_info *sta = NULL;


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


	if (sdata->u.mesh.user_mpm)
		/* userspace must register for these */
		return;

	if (is_multicast_ether_addr(mgmt->da)) {
	if (is_multicast_ether_addr(mgmt->da)) {
		mpl_dbg(sdata,
		mpl_dbg(sdata,
			"Mesh plink: ignore frame from multicast address\n");
			"Mesh plink: ignore frame from multicast address\n");
Loading