On 2011-12-22 2:25 PM, Helmut Schaa wrote:
> On Thu, Dec 22, 2011 at 2:13 PM, Felix Fietkau <[email protected]> wrote:
>> On 2011-12-22 1:57 PM, Helmut Schaa wrote:
>>> Any ideas how to resolve that issue for wifi interfaces?
>> The proper solution is switching to netifd (which will be the default as
>> soon as the remaining proto handlers have been ported).
> 
> Nice!
> 
>> As for the
>> legacy scripts. First we should figure out why it tries to apply the MAC
>> address in the first place. Please show me your /etc/config/network and
>> /etc/config/wireless that you're using as a test case.
> 
> Here you go:
> 
> /etc/config/network:
> 
> config 'interface' 'loopback'
>         option 'ifname' 'lo'
>         option 'proto' 'static'
>         option 'ipaddr' '127.0.0.1'
>         option 'netmask' '255.0.0.0'
> 
> config 'interface' 'lan'
>         option 'ifname' 'eth0'
>         option 'proto' 'dhcp'
>         option 'type' 'bridge'
>         option 'hostname' ''
>         option 'macaddr' 'xx:xx:xx:xx:xx:x8'
> 
> /etc/config/wireless:
> 
> config 'wifi-device' 'radio0'
>         option 'type' 'mac80211'
>         option 'channel' '1'
>         option 'hwmode' '11ng'
>         option 'htmode' 'HT20'
>         list 'ht_capab' 'SHORT-GI-20'
>         list 'ht_capab' 'SHORT-GI-40'
>         list 'ht_capab' 'TX-STBC'
>         list 'ht_capab' 'RX-STBC12'
>         option 'macaddr' 'xx:xx:xx:xx:xx:x0'
> 
> config 'wifi-iface'
>         option network lan
>         option ssid xxxxxxxxxx
>         option encryption none
>         option mode ap
>         option device radio0
> 
> Looking at the commit, there is one change that seems to
> introduce the problem.
> 
> -               # Change interface MAC address if requested
> -               [ -n "$vifmac" ] && {
> -                       ifconfig "$iface" down
> -                       ifconfig "$iface" hw ether "$vifmac" up
> -               }
> 
> Previously only the function argument  was used for setting the mac address
> which is empty in case of wifi interfaces.
> 
> +               local mtu macaddr txqueuelen
> +               config_get mtu "$config" mtu
> +               [ -n "$macaddr" ] || config_get macaddr "$config" macaddr
> 
> Now however,  if the function argument is empty we will read the macaddr
> from the config which will force the up/down cycle.
> 
> +               config_get txqueuelen "$config" txqueuelen
> +               [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down
> +               $DEBUG ifconfig "$iface" ${macaddr:+hw ether
> "$macaddr"} ${mtu:+mtu $mtu} ${txqueuelen:+txqueuelen $txqueuelen} up
> +
> +               [ "$proto" = none ] || ifconfig "$iface" 0.0.0.0
> 
> Any special reason you've added the "config_get macaddr" thing?
The config_get thing was already present in a different codepath that
did pretty much the same thing, but at an even more inconvenient point
in time, where it was messing up the state for the gianfar driver, but
maybe there it wasn't done for member interfaces of bridges.

I'd suggest passing an argument or variable to setup_interface from
/sbin/wifi, to tell it to not change the mac address, as a stopgap
solution until netifd gets enabled by default.

- Felix
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to