The mac80211.sh script does not properly differentiate between certain interface types and the way they get a MAC adress and a channel assigned. This patch adds correct handling of monitor, ad-hoc and combinations of it to avoid error messages.
Signed-off-by: Thomas Huehn <tho...@net.t-labs.tu-berlin.de> --- package/mac80211/files/lib/wifi/mac80211.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 6dfe2a2..df84472 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -329,6 +329,7 @@ enable_mac80211() { export channel fixed # convert channel to frequency local freq="$(get_freq "$phy" "${fixed:+$channel}")" + local interface_type="monitor_only" wifi_fixup_hwmode "$device" "g" for vif in $vifs; do @@ -345,16 +346,19 @@ enable_mac80211() { case "$mode" in adhoc) iw phy "$phy" interface add "$ifname" type adhoc + interface_type="mixed" ;; ap) # Hostapd will handle recreating the interface and # it's accompanying monitor apidx="$(($apidx + 1))" [ "$apidx" -gt 1 ] || iw phy "$phy" interface add "$ifname" type managed + interface_type="mixed" ;; mesh) config_get mesh_id "$vif" mesh_id iw phy "$phy" interface add "$ifname" type mp mesh_id "$mesh_id" + interface_type="mixed" ;; monitor) iw phy "$phy" interface add "$ifname" type monitor @@ -367,6 +371,7 @@ enable_mac80211() { config_get_bool powersave "$vif" powersave 0 [ "$powersave" -gt 0 ] && powersave="on" || powersave="off" iw "$ifname" set power_save "$powersave" + interface_type="mixed" ;; esac @@ -379,7 +384,10 @@ enable_mac80211() { vif_mac="$(mac80211_generate_mac $macidx $macaddr)" macidx="$(($macidx + 1))" } - [ "$mode" = "ap" ] || ifconfig "$ifname" hw ether "$vif_mac" + if [ ! "$mode" = "ap" -a ! "$mode" = "monitor" ] || + [ "$mode" = "monitor" -a "$interface_type" = "monitor_only" ]; then + ifconfig "$ifname" hw ether "$vif_mac" + fi config_set "$vif" macaddr "$vif_mac" # !! ap !! @@ -390,7 +398,8 @@ enable_mac80211() { # # ALL station functionality will be passed to wpa_supplicant # - if [ ! "$mode" = "ap" ]; then + if [ ! "$mode" = "ap" -a ! "$mode" = "adhoc" -a ! "$mode" = "monitor" ] || + [ "$mode" = "monitor" -a "$interface_type" = "monitor_only" ]; then # We attempt to set the channel for all interfaces, although # mac80211 may not support it or the driver might not yet # for ap mode this is handled by hostapd -- 1.7.11.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel