Changeset 25837


Ignore:
Timestamp:
2011-03-02T22:08:28+01:00 (7 years ago)
Author:
nbd
Message:

mac80211: allow AP configuration of beacon interval, DTIM period, maximum permissible STA listen interval, and basic rates

This introduces beacon_int and basic_rate (per wifi-device), and
dtim_period and max_listen_int (per wifi-iface) for mac80211. These
configure the beacon interval, basic rate specification, DTIM period
(one DTIM per this many beacon frames), and maximum listen interval
that a STA will be permitted to associate with. All of the new
settings are optional; if they're absent, the existing hostapd (or, in
the case of basic_rate, driver) defaults will be used.

The existing bintval property only used for type adhoc is moved from
wifi-iface to wifi-device, and is renamed to beacon_interval because
bintval isn't a great name. The beacon interval is property of the
wifi-device; while the choice between wifi-device and wifi-iface may
not be relevant with an adhoc network, there's no reason to configure
the same property one way for type adhoc and another for type ap. This
change isn't expected to cause many problems, as bintval was added
recently, in r25111.

Similarly, the list of basic rates, also added for type adhoc in
r25111, is a property of the device and not the interface. Further, it
ought to be represented in UCI as a list, not a string dependent on
the format that iw uses. I’ve moved it onto the device, renamed it to
basic_rate, and made it configurable for APs via hostapd. Finally, I
adapted it to use the same kb/s representation as mcast_rate; there's
precedent for this format in that it's also how madwifi interprets
mcast_rate.

Neither bintval nor basicrates were ever documented in the UCI
wireless configuration page on the wiki. When this change is
committed, I'll update the documentation as needed.

Signed-off-by: Mark Mentovai <mark@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/mac80211/files/lib/wifi/mac80211.sh

    r25192 r25837  
    1414        config_get hwmode "$device" hwmode 
    1515        config_get channel "$device" channel 
     16        config_get beacon_int "$device" beacon_int 
     17        config_get basic_rate_list "$device" basic_rate 
    1618        config_get_bool noscan "$device" noscan 
    1719        [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" 
     
    5254                done 
    5355        } 
     56 
     57        local br brval brstr 
     58        [ -n "$basic_rate_list" ] && { 
     59                for br in $basic_rate_list; do 
     60                        brval="$(($br / 100))" 
     61                        [ -n "$brstr" ] && brstr="$brstr " 
     62                        brstr="$brstr$brval" 
     63                done 
     64        } 
     65         
    5466        cat >> "$cfgfile" <<EOF 
    5567ctrl_interface=/var/run/hostapd-$phy 
     
    93105${hwmode:+hw_mode=$hwmode} 
    94106${channel:+channel=$channel} 
     107${beacon_int:+beacon_int=$beacon_int} 
    95108${country:+country_code=$country} 
    96109${noscan:+noscan=$noscan} 
     110${brstr:+basic_rates=$brstr} 
    97111$base_cfg 
    98112 
     
    128142        config_get macaddr "$vif" macaddr 
    129143        config_get maxassoc "$vif" maxassoc 
     144        config_get dtim_period "$vif" dtim_period 
     145        config_get max_listen_int "$vif" max_listen_int 
    130146        config_get_bool hidden "$vif" hidden 0 
    131147        config_get_bool wmm "$vif" wmm 1 
     
    135151bssid=$macaddr 
    136152ignore_broadcast_ssid=$hidden 
     153${dtim_period:+dtim_period=$dtim_period} 
     154${max_listen_int:+max_listen_interval=$max_listen_int} 
    137155${maxassoc:+max_num_sta=$maxassoc} 
    138156EOF 
     
    391409                                        config_get bssid "$vif" bssid 
    392410                                        config_get ssid "$vif" ssid 
    393                                         config_get bintval "$vif" bintval 
    394                                         config_get basicrates "$vif" basicrates 
     411                                        config_get beacon_int "$device" beacon_int 
     412                                        config_get basic_rate_list "$device" basic_rate 
    395413                                        config_get encryption "$vif" encryption 
    396414                                        config_get key "$vif" key 1 
     
    417435                                        } 
    418436 
     437                                        local br brval brsub brstr 
     438                                        [ -n "$basic_rate_list" ] && { 
     439                                                for br in $basic_rate_list; do 
     440                                                        brval="$(($br / 1000))" 
     441                                                        brsub="$((($br / 100) % 10))" 
     442                                                        [ "$brsub" -gt 0 ] && brval="$brval.$brsub" 
     443                                                        [ -n "$brstr" ] && brstr="$brstr," 
     444                                                        brstr="$brstr$brval" 
     445                                                done 
     446                                        } 
     447 
    419448                                        local mcval="" 
    420449                                        [ -n "$mcast_rate" ] && { 
     
    426455                                        iw dev "$ifname" ibss join "$ssid" $freq \ 
    427456                                                ${fixed:+fixed-freq} $bssid \ 
    428                                                 ${bintval:+beacon-interval $bintval} \ 
    429                                                 ${basicrates:+basic-rates $basicrates} \ 
     457                                                ${beacon_int:+beacon-interval $beacon_int} \ 
     458                                                ${brstr:+basic-rates $brstr} \ 
    430459                                                ${mcval:+mcast-rate $mcval} \ 
    431460                                                ${keyspec:+keys $keyspec} 
Note: See TracChangeset for help on using the changeset viewer.