From 1b5c6d088673ed6813f9f0e59bd1bb9101b84d51 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 15 Nov 2022 17:16:32 +0100 Subject: setup-interfaces: use iw instead of wireless-tools also fix so we can join networks without PSK filter out hidden (\x00) SSIDs fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10518 fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10475 --- setup-interfaces.in | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'setup-interfaces.in') diff --git a/setup-interfaces.in b/setup-interfaces.in index 6e4fb35..07427a0 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -122,10 +122,11 @@ find_essids() { export essids_list=wlans # Supports only open or PSK $MOCK ip link set dev "$iface" up - iwlist $iface scanning | awk -F: ' - /ESSID/ { gsub(/"/, "", $2); essid=$2 } - /Authentication Suites/ { gsub(/^ +/, "", $2); printf "%s/%s\n", essid, $2 } - ' | grep -v 802.1x | sort -u >"$essids_list" + (iw dev wlan0 scan; echo BSS) | awk -F": " ' + /^BSS/ { if (ssid) { print ssid "/" auth }; ssid=""; auth="" } + $1 ~ /SSID/ { ssid=$2 } + $1 ~ /Authentication suites/ { auth=$2 }' \ + | grep -E -v '(802.1x|\\x00)' | sort -u >"$essids_list" if [ -s "$essids_list" ]; then # we use / as separator since it is an illegal char in ssids awk -F/ '{print $1}' "$essids_list" @@ -197,7 +198,7 @@ config_iface() { echo "raw_device=\"$raw_device\"" >> $conf fi if is_wifi $iface; then - $MOCK apk add --quiet --no-progress wireless-tools wpa_supplicant || return + $MOCK apk add --quiet --no-progress iw wpa_supplicant || return local wifi_configured=false while ! $wifi_configured; do echo "Available wireless networks (scanning):" -- cgit v1.2.3