X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=package%2Fkernel%2Fmac80211%2Ffiles%2Flib%2Fnetifd%2Fwireless%2Fmac80211.sh;h=f59c4982159d5be5f11ce01b58cbad963399827f;hb=23a885bf89a204f91e4f17ed96f1a9fc7f50ea34;hp=dd2b09c4a00d5fe16e1558aad516c73fcb229738;hpb=2568db3fff7be1be848d490a7f53af42ec14b257;p=openwrt%2Fstaging%2Fhauke.git diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index dd2b09c4a0..f59c498215 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -62,6 +62,7 @@ drv_mac80211_init_iface_config() { config_add_string 'macaddr:macaddr' ifname config_add_boolean wds powersave enable + config_add_string wds_bridge config_add_int maxassoc config_add_int max_listen_int config_add_int dtim_period @@ -328,6 +329,8 @@ $base_cfg EOF json_select .. + radio_md5sum=$(md5sum $hostapd_conf_file | cut -d" " -f1) + echo "radio_config_id=${radio_md5sum}" >> $hostapd_conf_file } mac80211_hostapd_setup_bss() { @@ -340,12 +343,15 @@ mac80211_hostapd_setup_bss() { append hostapd_cfg "$type=$ifname" "$N" hostapd_set_bss_options hostapd_cfg "$vif" || return 1 - json_get_vars wds dtim_period max_listen_int start_disabled + json_get_vars wds wds_bridge dtim_period max_listen_int start_disabled set_default wds 0 set_default start_disabled 0 - [ "$wds" -gt 0 ] && append hostapd_cfg "wds_sta=1" "$N" + [ "$wds" -gt 0 ] && { + append hostapd_cfg "wds_sta=1" "$N" + [ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N" + } [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N" cat >> /var/run/hostapd-$phy.conf < "$file" done } @@ -908,11 +916,18 @@ drv_mac80211_setup() { iw phy "$phy" set antenna_gain $antenna_gain iw phy "$phy" set distance "$distance" + if [ -n "$txpower" ]; then + iw phy "$phy" set txpower fixed "${txpower%%.*}00" + else + iw phy "$phy" set txpower auto + fi + [ -n "$frag" ] && iw phy "$phy" set frag "${frag%%.*}" [ -n "$rts" ] && iw phy "$phy" set rts "${rts%%.*}" has_ap= hostapd_ctrl= + ap_ifname= hostapd_noscan= for_each_interface "ap" mac80211_check_ap @@ -925,7 +940,7 @@ drv_mac80211_setup() { for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif NEWAPLIST= for_each_interface "ap" mac80211_prepare_vif - NEW_MD5=$(md5sum ${hostapd_conf_file}) + NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file}) OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5) if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then mac80211_vap_cleanup hostapd "${OLDAPLIST}" @@ -934,13 +949,21 @@ drv_mac80211_setup() { local add_ap=0 local primary_ap=${NEWAPLIST%% *} [ -n "$hostapd_ctrl" ] && { + local no_reload=1 if [ -n "$(ubus list | grep hostapd.$primary_ap)" ]; then [ "${NEW_MD5}" = "${OLD_MD5}" ] || { ubus call hostapd.$primary_ap reload + no_reload=$? + mac80211_vap_cleanup hostapd "${OLDAPLIST}" + [ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap || return } - else + fi + if [ "$no_reload" != "0" ]; then add_ap=1 + ubus wait_for hostapd.$phy ubus call hostapd.${phy} config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}" + local hostapd_pid=$(ubus call service list '{"name": "hostapd"}' | jsonfilter -l 1 -e "@['hostapd'].instances['hostapd-${phy}'].pid") + wireless_add_process "$hostapd_pid" "/usr/sbin/hostapd" 1 fi ret="$?" [ "$ret" != 0 ] && { @@ -975,7 +998,7 @@ drv_mac80211_setup() { wireless_set_up } -list_phy_interfaces() { +_list_phy_interfaces() { local phy="$1" if [ -d "/sys/class/ieee80211/${phy}/device/net" ]; then ls "/sys/class/ieee80211/${phy}/device/net" 2>/dev/null; @@ -984,6 +1007,15 @@ list_phy_interfaces() { fi } +list_phy_interfaces() { + local phy="$1" + + for dev in $(_list_phy_interfaces "$phy"); do + readlink "/sys/class/net/${dev}/phy80211" | grep -q "/${phy}\$" || continue + echo "$dev" + done +} + drv_mac80211_teardown() { wireless_process_kill_all