mac80211: add uci support for the ad-hoc multicast rate setting
[openwrt/svn-archive/archive.git] / package / mac80211 / files / lib / wifi / mac80211.sh
index f022e262d94c7655e5b755a43e009c54339717c2..2f8fedf24cf844571122c8933661a509d2eb2695 100644 (file)
@@ -222,6 +222,7 @@ enable_mac80211() {
        local macidx=0
        local apidx=0
        fixed=""
+       local hostapd_ctrl=""
 
        [ -n "$country" ] && iw reg set "$country"
        [ "$channel" = "auto" -o "$channel" = "0" ] || {
@@ -344,6 +345,7 @@ enable_mac80211() {
                        config_get mode "$vif" mode
                        config_get ifname "$vif" ifname
                        [ "$mode" = "ap" ] || continue
+                       hostapd_ctrl="${hostapd_ctrl:-/var/run/hostapd-$phy/$ifname}"
                        mac80211_start_vif "$vif" "$ifname"
                done
        }
@@ -360,11 +362,18 @@ enable_mac80211() {
                                adhoc)
                                        config_get bssid "$vif" bssid
                                        config_get ssid "$vif" ssid
-                                       iw dev "$ifname" ibss join "$ssid" $freq ${fixed:+fixed-freq} $bssid
+                                       config_get mcast_rate "$vif" mcast_rate
+                                       local mcval=""
+                                       [ -n "$mcast_rate" ] && {
+                                               mcval="$(($mcast_rate / 1000))"
+                                               mcsub="$(( ($mcast_rate / 100) % 10 ))"
+                                               [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
+                                       }
+                                       iw dev "$ifname" ibss join "$ssid" $freq ${fixed:+fixed-freq} $bssid ${mcval:+mcast-rate $mcval}
                                ;;
                                sta)
                                        if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
-                                               wpa_supplicant_setup_vif "$vif" nl80211 || {
+                                               wpa_supplicant_setup_vif "$vif" nl80211 "${hostapd_ctrl:+-H $hostapd_ctrl}" || {
                                                        echo "enable_mac80211($device): Failed to set up wpa_supplicant for interface $ifname" >&2
                                                        # make sure this wifi interface won't accidentally stay open without encryption
                                                        ifconfig "$ifname" down
@@ -404,7 +413,7 @@ detect_mac80211() {
 
                mode_11n=""
                mode_band="g"
-               channel="5"
+               channel="11"
                ht_cap=0
                for cap in $(iw phy "$dev" info | grep 'Capabilities:' | cut -d: -f2); do
                        ht_cap="$(($ht_cap | $cap))"