Add the necessary feature flags and a scan flag to support using random MAC addresses for scan while unassociated. The configuration for this supports an arbitrary MAC address value and mask, so that any kind of configuration (e.g. fixed OUI or full 46-bit random) can be requested. Full 46-bit random is the default when no other configuration is passed. Also add a small helper function to use the addr/mask correctly.
Showing the changes to include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -1686,6 +1686,8 @@ enum nl80211_commands { · 1685 unmodified lines | |||
| 1686 | * | 1686 | * |
| 1687 | * @NL80211_ATTR_OPER_CLASS: operating class | 1687 | * @NL80211_ATTR_OPER_CLASS: operating class |
| 1688 | * | 1688 | * |
| 1689 | * @NL80211_ATTR_MAC_MASK: MAC address mask | ||
| 1690 | * | ||
| 1689 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available | 1691 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
| 1690 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1692 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 1691 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1693 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| @@ -2041,6 +2043,8 @@ enum nl80211_attrs { · 349 unmodified lines | |||
| 2041 | 2043 | ||
| 2042 | NL80211_ATTR_OPER_CLASS, | 2044 | NL80211_ATTR_OPER_CLASS, |
| 2043 | 2045 | ||
| 2046 | NL80211_ATTR_MAC_MASK, | ||
| 2047 | |||
| 2044 | /* add attributes here, update the policy in nl80211.c */ | 2048 | /* add attributes here, update the policy in nl80211.c */ |
| 2045 | 2049 | ||
| 2046 | __NL80211_ATTR_AFTER_LAST, | 2050 | __NL80211_ATTR_AFTER_LAST, |
| @@ -4139,6 +4143,18 @@ enum nl80211_ap_sme_features { · 2092 unmodified lines | |||
| 4139 | * See 'macaddr' field in the vif_params (cfg80211.h). | 4143 | * See 'macaddr' field in the vif_params (cfg80211.h). |
| 4140 | * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when | 4144 | * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when |
| 4141 | * operating as a TDLS peer. | 4145 | * operating as a TDLS peer. |
| 4146 | * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a | ||
| 4147 | * random MAC address during scan (if the device is unassociated); the | ||
| 4148 | * %NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC | ||
| 4149 | * address mask/value will be used. | ||
| 4150 | * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports | ||
| 4151 | * using a random MAC address for every scan iteration during scheduled | ||
| 4152 | * scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may | ||
| 4153 | * be set for scheduled scan and the MAC address mask/value will be used. | ||
| 4154 | * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a | ||
| 4155 | * random MAC address for every scan iteration during "net detect", i.e. | ||
| 4156 | * scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may | ||
| 4157 | * be set for scheduled scan and the MAC address mask/value will be used. | ||
| 4142 | */ | 4158 | */ |
| 4143 | enum nl80211_feature_flags { | 4159 | enum nl80211_feature_flags { |
| 4144 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 4160 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
| @@ -4170,6 +4186,9 @@ enum nl80211_feature_flags { · 25 unmodified lines | |||
| 4170 | NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26, | 4186 | NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26, |
| 4171 | NL80211_FEATURE_MAC_ON_CREATE = 1 << 27, | 4187 | NL80211_FEATURE_MAC_ON_CREATE = 1 << 27, |
| 4172 | NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28, | 4188 | NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28, |
| 4189 | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29, | ||
| 4190 | NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30, | ||
| 4191 | NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31, | ||
| 4173 | }; | 4192 | }; |
| 4174 | 4193 | ||
| 4175 | /** | 4194 | /** |
| @@ -4218,11 +4237,21 @@ enum nl80211_connect_failed_reason { · 42 unmodified lines | |||
| 4218 | * dangerous because will destroy stations performance as a lot of frames | 4237 | * dangerous because will destroy stations performance as a lot of frames |
| 4219 | * will be lost while scanning off-channel, therefore it must be used only | 4238 | * will be lost while scanning off-channel, therefore it must be used only |
| 4220 | * when really needed | 4239 | * when really needed |
| 4240 | * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or | ||
| 4241 | * for scheduled scan: a different one for every scan iteration). When the | ||
| 4242 | * flag is set, depending on device capabilities the @NL80211_ATTR_MAC and | ||
| 4243 | * @NL80211_ATTR_MAC_MASK attributes may also be given in which case only | ||
| 4244 | * the masked bits will be preserved from the MAC address and the remainder | ||
| 4245 | * randomised. If the attributes are not given full randomisation (46 bits, | ||
| 4246 | * locally administered 1, multicast 0) is assumed. | ||
| 4247 | * This flag must not be requested when the feature isn't supported, check | ||
| 4248 | * the nl80211 feature flags for the device. | ||
| 4221 | */ | 4249 | */ |
| 4222 | enum nl80211_scan_flags { | 4250 | enum nl80211_scan_flags { |
| 4223 | NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, | 4251 | NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, |
| 4224 | NL80211_SCAN_FLAG_FLUSH = 1<<1, | 4252 | NL80211_SCAN_FLAG_FLUSH = 1<<1, |
| 4225 | NL80211_SCAN_FLAG_AP = 1<<2, | 4253 | NL80211_SCAN_FLAG_AP = 1<<2, |
| 4254 | NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3, | ||
| 4226 | }; | 4255 | }; |
| 4227 | 4256 | ||
| 4228 | /** | 4257 | /** |