parse the a/g mode setting in /etc/config/wireless when setting up hostapd (instead...
[openwrt/svn-archive/archive.git] / package / hostapd / files / hostapd.sh
index 147736bdc6b4fdc59a9d1bb2b5f6f3fde6431c27..7a67cec949c03f72ac0cae27b7c57a2a6088f85a 100644 (file)
@@ -39,7 +39,11 @@ hostapd_setup_vif() {
        case "$enc" in
                *psk*|*PSK*)
                        config_get psk "$vif" key
-                       append hostapd_cfg "wpa_passphrase=$psk" "$N"
+                       if [ ${#psk} -eq 64 ]; then
+                               append hostapd_cfg "wpa_psk=$psk" "$N"
+                       else
+                               append hostapd_cfg "wpa_passphrase=$psk" "$N"
+                       fi
                ;;
                *wpa*|*WPA*)
                        # required fields? formats?
@@ -70,10 +74,17 @@ hostapd_setup_vif() {
        config_get ssid "$vif" ssid
        config_get device "$vif" device
        config_get channel "$device" channel
+       config_get agmode "$device" agmode
+       case "$agmode" in
+               11a) agmode=a;;
+               11b) agmode=b;;
+               11g) agmode=g;;
+               *) agmode=;;
+       esac
        cat > /var/run/hostapd-$ifname.conf <<EOF
 driver=$driver
 interface=$ifname
-hw_mode=g
+hw_mode=${agmode:-g}
 channel=$channel
 ${bridge:+bridge=$bridge}
 ssid=$ssid