X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/2eb1c2d1df2f93d1722ddee225a21561c689f689..b49acf128878f82aa75c023c79a2301ce9bd2adc:/package/hostapd/files/hostapd.sh diff --git a/package/hostapd/files/hostapd.sh b/package/hostapd/files/hostapd.sh index 9ee7657e2..9edb07081 100644 --- a/package/hostapd/files/hostapd.sh +++ b/package/hostapd/files/hostapd.sh @@ -5,6 +5,11 @@ hostapd_set_bss_options() { config_get enc "$vif" encryption config_get wpa_group_rekey "$vif" wpa_group_rekey + config_get_bool ap_isolate "$vif" isolate 0 + + if [ "$ap_isolate" -gt 0 ]; then + append "$var" "ap_isolate=$ap_isolate" "$N" + fi # Examples: # psk-mixed/tkip => WPA1+2 PSK, TKIP @@ -33,7 +38,7 @@ hostapd_set_bss_options() { # explicit override for crypto setting case "$enc" in - *tkip+aes|*tkip+ccmp) crypto="CCMP TKIP";; + *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) crypto="CCMP TKIP";; *aes|*ccmp) crypto="CCMP";; *tkip) crypto="TKIP";; esac @@ -68,6 +73,28 @@ hostapd_set_bss_options() { append "$var" "wpa_group_rekey=300" "$N" append "$var" "wpa_gmk_rekey=640" "$N" ;; + *wep*) + config_get key "$vif" key + key="${key:-1}" + case "$key" in + [1234]) + for idx in 1 2 3 4; do + local zidx + zidx=$(($idx - 1)) + config_get ckey "$vif" "key${idx}" + [ -n "$ckey" ] && \ + append "$var" "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N" + done + append "$var" "wep_default_key=$((key - 1))" "$N" + ;; + *) + append "$var" "wep_key0=$(prepare_key_wep "$key")" "$N" + append "$var" "wep_default_key=0" "$N" + ;; + esac + wpa=0 + crypto= + ;; *) wpa=0 crypto= @@ -84,6 +111,21 @@ hostapd_set_bss_options() { append "$var" "ssid=$ssid" "$N" [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N" [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N" + + [ "$wpa" -ge "2" ] && config_get ieee80211w "$vif" ieee80211w + case "$ieee80211w" in + [012]) + append "$var" "ieee80211w=$ieee80211w" "$N" + [ "$ieee80211w" -gt "0" ] && { + config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout + config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout + [ -n "$ieee80211w_max_timeout" ] && \ + append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" + [ -n "$ieee80211w_retry_timeout" ] && \ + append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N" + } + ;; + esac } hostapd_setup_vif() { @@ -97,7 +139,8 @@ hostapd_setup_vif() { config_get channel "$device" channel config_get hwmode "$device" hwmode case "$hwmode" in - bg) hwmode=g;; + *bg|*gdt|*gst|*fh) hwmode=g;; + *adt|*ast) hwmode=a;; esac [ "$channel" = auto ] && channel= [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" @@ -105,7 +148,7 @@ hostapd_setup_vif() { ctrl_interface=/var/run/hostapd-$ifname driver=$driver interface=$ifname -${hwmode:+hw_mode=$hwmode} +${hwmode:+hw_mode=${hwmode#11}} ${channel:+channel=$channel} $hostapd_cfg EOF