Author: nbd
Date: 2015-01-24 20:27:22 +0100 (Sat, 24 Jan 2015)
New Revision: 44100

Modified:
   trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
   trunk/package/network/services/hostapd/files/netifd.sh
Log:
mac80211/hostapd: fix HT mode setup for RSN ad-hoc networks

Signed-off-by: Felix Fietkau <[email protected]>

Modified: trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
===================================================================
--- trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
2015-01-24 18:12:09 UTC (rev 44099)
+++ trunk/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh 
2015-01-24 19:27:22 UTC (rev 44100)
@@ -490,6 +490,38 @@
        wpa_supplicant_run "$ifname" ${hostapd_ctrl:+-H $hostapd_ctrl}
 }
 
+mac80211_setup_adhoc_htmode() {
+       case "$htmode" in
+               VHT20|HT20) ibss_htmode=HT20;;
+               HT40*|VHT40|VHT80|VHT160)
+                       case "$hwmode" in
+                               a)
+                                       case "$(( ($channel / 4) % 2 ))" in
+                                               1) ibss_htmode="HT40+" ;;
+                                               0) ibss_htmode="HT40-";;
+                                       esac
+                               ;;
+                               *)
+                                       case "$htmode" in
+                                               HT40+) ibss_htmode="HT40+";;
+                                               HT40-) ibss_htmode="HT40-";;
+                                               *)
+                                                       if [ "$channel" -lt 7 
]; then
+                                                               
ibss_htmode="HT40+"
+                                                       else
+                                                               
ibss_htmode="HT40-"
+                                                       fi
+                                               ;;
+                                       esac
+                               ;;
+                       esac
+                       [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
+               ;;
+               *) ibss_htmode="" ;;
+       esac
+
+}
+
 mac80211_setup_adhoc() {
        json_get_vars bssid ssid key mcast_rate
 
@@ -523,35 +555,6 @@
        mcval=
        [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
 
-       case "$htmode" in
-               VHT20|HT20) ibss_htmode=HT20;;
-               HT40*|VHT40|VHT80|VHT160)
-                       case "$hwmode" in
-                               a)
-                                       case "$(( ($channel / 4) % 2 ))" in
-                                               1) ibss_htmode="HT40+" ;;
-                                               0) ibss_htmode="HT40-";;
-                                       esac
-                               ;;
-                               *)
-                                       case "$htmode" in
-                                               HT40+) ibss_htmode="HT40+";;
-                                               HT40-) ibss_htmode="HT40-";;
-                                               *)
-                                                       if [ "$channel" -lt 7 
]; then
-                                                               
ibss_htmode="HT40+"
-                                                       else
-                                                               
ibss_htmode="HT40-"
-                                                       fi
-                                               ;;
-                                       esac
-                               ;;
-                       esac
-                       [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
-               ;;
-               *) ibss_htmode="" ;;
-       esac
-
        iw dev "$ifname" ibss join "$ssid" $freq $ibss_htmode fixed-freq $bssid 
\
                ${beacon_int:+beacon-interval $beacon_int} \
                ${brstr:+basic-rates $brstr} \
@@ -602,6 +605,7 @@
                ;;
                adhoc)
                        wireless_vif_parse_encryption
+                       mac80211_setup_adhoc_htmode
                        if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
                                mac80211_setup_supplicant || failed=1
                        else

Modified: trunk/package/network/services/hostapd/files/netifd.sh
===================================================================
--- trunk/package/network/services/hostapd/files/netifd.sh      2015-01-24 
18:12:09 UTC (rev 44099)
+++ trunk/package/network/services/hostapd/files/netifd.sh      2015-01-24 
19:27:22 UTC (rev 44100)
@@ -596,7 +596,8 @@
        }
 
        local ht_str
-       [ -n "$ht" ] && append network_data "htmode=$ht" "$N$T"
+       [[ "$_w_mode" = adhoc ]] || ibss_htmode=
+       [ -n "$ibss_htmode" ] && append network_data "htmode=$ibss_htmode" 
"$N$T"
 
        cat >> "$_config" <<EOF
 network={
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to