setup-interfaces - parsing iw scan broken (alpine 3.17)
My WiFi SSID does not appear in the list given by setup-interfaces, and I am forbidden to enter a name which is not in that list.
summary
The reason: A line SSID List
in the iw scan
output causes the awk pattern matching to fail.
The awk pattern can be fixed to solve the problem (see below)
Details
In the script setup-interfaces
in the function find_essids() a call to (iw dev wlan0 scan; echo BSS)
is passed to awk -F ": ".
This awk line causes the problem. Ideally it would match SSID: (with colon) but it cannot since $1 is split on colon awk -F ": "
.
$1 ~ /SSID/ { ssid=$2 }
Instead we can match on $0 and add the colon to the pattern.
$0 ~ /SSID:/ { ssid=$2 }
This problematic scan output contains line SSID List
which confuses the awk SSID check.
BSS xxxxx
...
SSID: NeverSeen
...
Extended capabilities:
* TFS
* WNM-Sleep Mode
* TIM Broadcast
* BSS Transition
* SSID List
* Operating Mode Notification
...
* Authentication suites: PSK