For what it's worth, getting the mac address with iproute is trivial.
ip -o link show dev $iface | awk '{print $13;}'
On 5/19/12 4:18 AM, Tobias Diedrich wrote:
> Avoid "ifconfig down" if the macaddr is not going to change.
>
> For wireless interfaces, downing the interface after hostapd has
> been started is unsupported and not guaranteed to work at all, but
> that is exactly was OpenWRT does right now (maybe not for netifd).
>
> And in this case it was alrady set by enable_mac80211 before hostapd
> was started, so it's not going to change in prepare_interface.
>
> Quoting Johannes Berg:
> "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..."
>
>
> Signed-off-by: Tobias Diedrich <[email protected]>
>
> Index: package/base-files-network/files/lib/network/config.sh
> ===================================================================
> --- package/base-files-network/files/lib/network/config.sh (revision 31774)
> +++ package/base-files-network/files/lib/network/config.sh (working copy)
> @@ -184,7 +184,11 @@
> config_get mtu "$config" mtu
> [ -n "$macaddr" ] || config_get macaddr "$config" macaddr
> config_get txqueuelen "$config" txqueuelen
> - [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down
> + local oldmacaddr
> + local uppermacaddr
> + oldmacaddr=`ifconfig "$iface" | head -1 | sed -e 's@.*HWaddr
> \([0-9A-F:]*\).*@\1@'`
> + uppermacaddr=`echo -n "$macaddr" | tr a-f A-F`
> + [ -n "$macaddr" -a "$uppermacaddr" != "$oldmacaddr" ] && $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
>
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel