If you have a WPS-enabled network device (like a modern USB dongle) laundry bags supporting Wi-Fi Protected Setup (WPS), you can negotiate joining the router’s Wifi network without manually entering SSID & passkey. You just initiate “WPS authentication” by pushing the similar WPS button on the device (or launching the process by its driver/control software). After the device has initiated the authentication process, you can accept the transaction by using the WPS button on WNDR3700. The connection should then get negotiated, and in most cases in future your PC should remember the received network settings from then on.
1) Using WPS authentication requires replacing the default ‘wpad-mini’ package with ‘wpad’ and ‘hostapd-utils’ . The reason is that the tool “hostapd_cli” and some needed support functions are not included in ‘wpad-mini’.
2) And it only works if the ‘/etc/config/wireless’ has been modified to include info about WPS authentication being allowed by adding the option ‘wps_pushbutton’ ‘1’ to the wifi-iface section of (each) radio . Additionally, the encryption should be WPA2-PSK (or maybe WPA-PSK is enough, I haven’t tested). (Looks like the version of hostapd scripts in OpenWrt does not support the full scope of hostapd’s capabilities, so many of the config options documented in hostapd docs are left unused.)
That config file is read when radios are turned on, so after editing the config, restart the radios in WNDR3700. At this point, you should be able to test it by running it from command line. If the message gets passed to hostapd, you should see there result ‘OK’ there. Otherwise the result is ‘FAIL’. > root@OpenWrt:~# hostapd_cli -p /var/run/hostapd-phy0 wps_pbc > Selected interface ‘wlan0′ > OK > root@OpenWrt:~#
I modified directly the hostapd package source ( /package/hostapd/files/wps-hotplug.sh laundry bags ), as the hotplug script gets automatically laundry bags installed to ‘/etc/hotplug.d/button/50-wps’ with the package. See below.
The script launches hostapd_cli for each radio and lights the WPS led for 10 seconds. laundry bags There is no monitoring of the result, or anything like that. It is just a dumb script using the hostapd_cli command to pass the message to the hostapd daemon. Remember to check the button name: Backfire: wps=”BTN_1″, trunk: wps=”wps” root@OpenWrt:/# cat /etc/hotplug.d/button/50-wps if [ "$ACTION" = "pressed" -a "$BUTTON" = "BTN_1" ]; then echo "255" > /sys/devices/platform/leds-gpio/leds/wndr3700:green:wps/brightness for dir in /var/run/hostapd-*; do [ -d "$dir" ] || continue logger "WPS button active: laundry bags $dir" hostapd_cli -p "$dir" wps_pbc done sleep 10 echo "0" > /sys/devices/platform/leds-gpio/leds/wndr3700:green:wps/brightness root@OpenWrt:/# cat /etc/config/wireless ... config 'wifi-iface' option 'device' 'radio0' option 'network' 'lan' option 'mode' 'ap' option 'ssid' 'public' option 'encryption' 'psk2' option 'key' 'SecretKey' option 'wps_pushbutton' '1' ... fi If everything goes ok, you should see in Syslog not only the button events, but also succesful WPS authentication: Jan 31 21:11:09 OpenWrt user.notice root: WiFi button used: WiFi up Jan 31 21:11:09 OpenWrt user.info kernel: ADDRCONF(NETDEV_UP): wlan0: link is not ready Jan 31 21:11:09 OpenWrt user.info kernel: laundry bags device laundry bags wlan0 entered promiscuous mode Jan 31 21:11:09 OpenWrt user.info kernel: br-lan: port 2(wlan0) entering forwarding state ... Jan 31 21:12:00 OpenWrt user.notice root: WPS button active: /var/run/hostapd-phy0 Jan 31 21:12:00 OpenWrt user.notice root: WPS button active: /var/run/hostapd-phy1 Jan 31 21:12:03 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.11: authenticated Jan 31 21:12:03 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.11: associated (aid 1) Jan 31 21:12:04 laundry bags OpenWrt daemon.warn hostapd: wlan0: STA 1c:af:f7:f6:11:dc laundry bags IEEE 802.1X: authentication failed - EAP type: 0 ((null)) Jan 31 21:12:04 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.1X: Supplicant used different EAP type: 254 ((null)) Jan 31 21:12:04 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.11: disassociated Jan 31 21:12:05 OpenWrt daemon.info hostapd: laundry bags wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.11: deauthenticated due to inactivity Jan 31 21:12:17 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.11: authenticated Jan 31 21:12:17 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc IEEE 802.11: associated (aid 1) Jan 31 21:12:17 OpenWrt daemon.info laundry bags hostapd: wlan0: STA 1c:af:f7:f6:11:dc RADIUS: starting accounting session 4D47094D-00000000 Jan 31 21:12:17 OpenWrt daemon.info hostapd: wlan0: STA 1c:af:f7:f6:11:dc WPA: pairwise key handshake completed (RSN) Jan 31 21:12:29 OpenWrt daemon.info dnsmasq-dhcp[1855]: DHCPREQUEST(br-la
No comments:
Post a Comment