mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
wifi: cfg80211: fix regulatory disconnect with OCB/NAN
Since regulatory disconnect was added, OCB and NAN interface types were added, which made it completely unusable for any driver that allowed OCB/NAN. Add OCB/NAN (though NAN doesn't do anything, we don't have any info) and also remove all the logic that opts out, so it won't be broken again if/when new interface types are added. Fixes:6e0bd6c35b
("cfg80211: 802.11p OCB mode handling") Fixes:cb3b7d8765
("cfg80211: add start / stop NAN commands") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Link: https://lore.kernel.org/r/20230616222844.2794d1625a26.I8e78a3789a29e6149447b3139df724a6f1b46fc3@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -140,17 +140,6 @@ struct regulatory_request {
|
|||||||
* otherwise initiating radiation is not allowed. This will enable the
|
* otherwise initiating radiation is not allowed. This will enable the
|
||||||
* relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
|
* relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
|
||||||
* option
|
* option
|
||||||
* @REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make sure
|
|
||||||
* all interfaces on this wiphy reside on allowed channels. If this flag
|
|
||||||
* is not set, upon a regdomain change, the interfaces are given a grace
|
|
||||||
* period (currently 60 seconds) to disconnect or move to an allowed
|
|
||||||
* channel. Interfaces on forbidden channels are forcibly disconnected.
|
|
||||||
* Currently these types of interfaces are supported for enforcement:
|
|
||||||
* NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
|
|
||||||
* NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR,
|
|
||||||
* NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO,
|
|
||||||
* NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device
|
|
||||||
* includes any modes unsupported for enforcement checking.
|
|
||||||
* @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
|
* @REGULATORY_WIPHY_SELF_MANAGED: for devices that employ wiphy-specific
|
||||||
* regdom management. These devices will ignore all regdom changes not
|
* regdom management. These devices will ignore all regdom changes not
|
||||||
* originating from their own wiphy.
|
* originating from their own wiphy.
|
||||||
@@ -177,7 +166,7 @@ enum ieee80211_regulatory_flags {
|
|||||||
REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
|
REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
|
||||||
REGULATORY_COUNTRY_IE_IGNORE = BIT(4),
|
REGULATORY_COUNTRY_IE_IGNORE = BIT(4),
|
||||||
REGULATORY_ENABLE_RELAX_NO_IR = BIT(5),
|
REGULATORY_ENABLE_RELAX_NO_IR = BIT(5),
|
||||||
REGULATORY_IGNORE_STALE_KICKOFF = BIT(6),
|
/* reuse bit 6 next time */
|
||||||
REGULATORY_WIPHY_SELF_MANAGED = BIT(7),
|
REGULATORY_WIPHY_SELF_MANAGED = BIT(7),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -756,22 +756,6 @@ int wiphy_register(struct wiphy *wiphy)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* if a wiphy has unsupported modes for regulatory channel enforcement,
|
|
||||||
* opt-out of enforcement checking
|
|
||||||
*/
|
|
||||||
if (wiphy->interface_modes & ~(BIT(NL80211_IFTYPE_STATION) |
|
|
||||||
BIT(NL80211_IFTYPE_P2P_CLIENT) |
|
|
||||||
BIT(NL80211_IFTYPE_AP) |
|
|
||||||
BIT(NL80211_IFTYPE_MESH_POINT) |
|
|
||||||
BIT(NL80211_IFTYPE_P2P_GO) |
|
|
||||||
BIT(NL80211_IFTYPE_ADHOC) |
|
|
||||||
BIT(NL80211_IFTYPE_P2P_DEVICE) |
|
|
||||||
BIT(NL80211_IFTYPE_NAN) |
|
|
||||||
BIT(NL80211_IFTYPE_AP_VLAN) |
|
|
||||||
BIT(NL80211_IFTYPE_MONITOR)))
|
|
||||||
wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF;
|
|
||||||
|
|
||||||
if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
|
if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
|
||||||
(wiphy->regulatory_flags &
|
(wiphy->regulatory_flags &
|
||||||
(REGULATORY_CUSTOM_REG |
|
(REGULATORY_CUSTOM_REG |
|
||||||
|
@@ -2391,9 +2391,17 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
|
|||||||
case NL80211_IFTYPE_P2P_DEVICE:
|
case NL80211_IFTYPE_P2P_DEVICE:
|
||||||
/* no enforcement required */
|
/* no enforcement required */
|
||||||
break;
|
break;
|
||||||
|
case NL80211_IFTYPE_OCB:
|
||||||
|
if (!wdev->u.ocb.chandef.chan)
|
||||||
|
continue;
|
||||||
|
chandef = wdev->u.ocb.chandef;
|
||||||
|
break;
|
||||||
|
case NL80211_IFTYPE_NAN:
|
||||||
|
/* we have no info, but NAN is also pretty universal */
|
||||||
|
continue;
|
||||||
default:
|
default:
|
||||||
/* others not implemented for now */
|
/* others not implemented for now */
|
||||||
WARN_ON(1);
|
WARN_ON_ONCE(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2452,8 +2460,6 @@ static void reg_check_chans_work(struct work_struct *work)
|
|||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
|
|
||||||
list_for_each_entry(rdev, &cfg80211_rdev_list, list)
|
list_for_each_entry(rdev, &cfg80211_rdev_list, list)
|
||||||
if (!(rdev->wiphy.regulatory_flags &
|
|
||||||
REGULATORY_IGNORE_STALE_KICKOFF))
|
|
||||||
reg_leave_invalid_chans(&rdev->wiphy);
|
reg_leave_invalid_chans(&rdev->wiphy);
|
||||||
|
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
Reference in New Issue
Block a user