Search Linux Wireless

Re: rt28xx AP-mode problem with commit 3edaf3e61fda3aa9ff8d38445bf92f2bec23bf63 "mac80211: manage AP netdev carrier state"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg wrote:
> [dropping openwrt list, it keeps bothering me that I should subscribe]
> 
> On Fri, 2012-05-18 at 03:18 +0200, Tobias Diedrich wrote:
> 
> > One more clue:
> > I think this has to do with the order in which the OpenWRT wifi
> > script does things:
> > 
> > hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf
> > hostapd_ctrl=/var/run/hostapd-phy0/wlan0
> > ifconfig wlan0
> > ifconfig wlan0 down
> > ifconfig wlan0 hw ether 1c:af:f7:49:50:56 up
> > ifconfig wlan0 0.0.0.0
> > ifconfig wlan0
> > ifconfig br-lan
> > ifconfig wlan0 0.0.0.0
> > ifconfig wlan0 hw ether 1c:af:f7:49:50:56 up
> > iw dev wlan0 set txpower fixed 2000
> 
> Wow, ok, setting the interface down while the AP is up really isn't a
> valid use of it. I'm actually amazed that it ever works at all when you
> do this. Either this should be done the other way around, or hostapd
> needs to get some smarts about it. For example, with the start-AP
> function transition, I'm not sure even *beacon* after you do this...

I think the problem here is you can have multiple logical interfaces per phy
devices, so the init script has to start hostapd first and do setup
setup for the interfaces after that.  And you can't change the mac
address as long as the interface is up.  This naturally leads to
- start hostapd
- for each interface
 - down the interface
 - set mac address
 - up the interface

Which seems to be exactly what the scripts are doing from what I can
see:

|hostapd -P /var/run/wifi-$phy.pid -B /var/run/hostapd-$phy.conf || {
|        echo "Failed to start hostapd for $phy"
|        return
|}
|sleep 2
|
|for vif in $vifs; do
|        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

mac80211_start_vif in turn calls start_net, which calls setup_interface, which
calls prepare_interface, which does the mac-address setup among other things.

|prepare_interface() {
[...]
|    [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down
|    $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} ${txqueuelen:+txqueuelen $txqueuelen} up
[...]

-- 
Tobias						PGP: http://8ef7ddba.uguu.de
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux