Skip to content
This repository was archived by the owner on Sep 30, 2021. It is now read-only.

Commit 5676e43

Browse files
committed
Check for adapters which don't support 802.11w and thus can't do WPA3
While WPA3 is "mostly" a pure-software feature, it requires 802.11w (protected management frames) which require hardware support. Detect adapters that don't support this and prevent them from attempting WPA3.
1 parent e7d7a29 commit 5676e43

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

create_ap

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,18 @@ get_adapter_kernel_module() {
303303
echo ${MODULE##*/}
304304
}
305305

306+
can_do_80211w() {
307+
local PHY
308+
PHY=$(get_phy_device "$1")
309+
[[ $? -ne 0 ]] && return 1
310+
if [[ $USE_IWCONFIG -eq 1 ]]; then
311+
# https://askubuntu.com/a/1445236
312+
grep -q MFP_CAPABLE /sys/kernel/debug/ieee80211/${PHY}/hwflags
313+
else
314+
iw phy $PHY info | grep -q 'CMAC (00-0f-ac:6)'
315+
fi
316+
}
317+
306318
can_be_sta_and_ap() {
307319
# iwconfig does not provide this information, assume false
308320
[[ $USE_IWCONFIG -eq 1 ]] && return 1
@@ -1491,6 +1503,16 @@ if ! can_be_sta_and_ap ${WIFI_IFACE}; then
14911503
fi
14921504
fi
14931505

1506+
if [[ "$WPA_VERSION" = *3* ]] && ! can_do_80211w ${WIFI_IFACE}; then
1507+
if [[ "$WPA_VERSION" = 3 ]]; then
1508+
echo "ERROR: Your adapter does not support protected management frames (802.11w), no WPA3" >&2
1509+
exit 1
1510+
else
1511+
echo "WARN: Your adapter does not support protected management frames (802.11w), disabling WPA3" >&2
1512+
WPA_VERSION="${WPA_VERSION/3}"
1513+
fi
1514+
fi
1515+
14941516
HOSTAPD=$(which hostapd)
14951517

14961518
if [[ ! -x "$HOSTAPD" ]]; then

0 commit comments

Comments
 (0)