hostapd: generate unique SSID for SoftAP
If two or more targets are in the same environment, all of them will broadcast the same SSID, which may be a problem when a client wants to connect to a specific device. Use the last bytes of the non-virtual wireless MAC for the name of the SSID, a random value with no hexadecimal characters is used if the MAC is not available. Also drop 'wpa2aes' from the SSID. https://jira.digi.com/browse/DEL-4129 Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
parent
1daf4d91d4
commit
7ef80dd7ad
|
|
@ -4,7 +4,7 @@ interface=wlan1
|
||||||
driver=nl80211
|
driver=nl80211
|
||||||
|
|
||||||
# WPA2-AES encryption
|
# WPA2-AES encryption
|
||||||
ssid=ap-wlan1-wpa2aes_a
|
ssid=ap-wlan1-##MAC##
|
||||||
auth_algs=1
|
auth_algs=1
|
||||||
wpa=2
|
wpa=2
|
||||||
wpa_key_mgmt=WPA-PSK
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ interface=wlan0
|
||||||
driver=nl80211
|
driver=nl80211
|
||||||
|
|
||||||
# WPA2-AES encryption
|
# WPA2-AES encryption
|
||||||
ssid=ap-wlan0-wpa2aes_a
|
ssid=ap-wlan0-##MAC##
|
||||||
auth_algs=1
|
auth_algs=1
|
||||||
wpa=2
|
wpa=2
|
||||||
wpa_key_mgmt=WPA-PSK
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,30 @@ do_install_append_ccimx6ul() {
|
||||||
install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir}
|
install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkg_postinst_${PN}() {
|
||||||
|
# Append the last two bytes of the wlan0 MAC address to the SSID of the
|
||||||
|
# hostAP configuration files
|
||||||
|
# (execute on first boot)
|
||||||
|
if [ -n "$D" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the last two bytes of the wlan0 MAC address
|
||||||
|
MAC="$(cut -d ':' -f5,6 /sys/class/net/wlan0/address | tr -d ':')"
|
||||||
|
|
||||||
|
# If wlan0 is not available, use a random value with no hexadecimal characters
|
||||||
|
if [ -z "${MAC}" ]; then
|
||||||
|
MAC="$(cat /dev/urandom | tr -dc 'G-Z' | fold -w 4 | head -n 1)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "${sysconfdir}" -type f -name 'hostapd_wlan?.conf' -exec \
|
||||||
|
sed -i -e "s,##MAC##,${MAC},g" {} \;
|
||||||
|
|
||||||
|
# Create the symlinks in the different runlevels
|
||||||
|
if type update-rc.d >/dev/null 2>/dev/null; then
|
||||||
|
update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Do not autostart hostapd daemon, it will conflict with wpa-supplicant.
|
# Do not autostart hostapd daemon, it will conflict with wpa-supplicant.
|
||||||
INITSCRIPT_PARAMS = "remove"
|
INITSCRIPT_PARAMS = "remove"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue