diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-11-15 17:16:32 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-11-15 16:30:04 +0000 |
commit | 1b5c6d088673ed6813f9f0e59bd1bb9101b84d51 (patch) | |
tree | 0fc4f9f3513453cdd8571c405820a0be95388c4a /setup-interfaces.in | |
parent | 1d27c58523e498d60e9214867b0e3cf2d278900b (diff) | |
download | alpine-conf-1b5c6d088673ed6813f9f0e59bd1bb9101b84d51.zip |
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
Diffstat (limited to 'setup-interfaces.in')
-rw-r--r-- | setup-interfaces.in | 11 |
1 files changed, 6 insertions, 5 deletions
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):" |