[OpenWrt-Devel] Question about mac80211.sh and MAC address generation

Kristian Evensen kristian.evensen at gmail.com
Sat Jul 7 09:18:49 EDT 2018


Hi,

I have created a small tool which uses the MAC address to identify an
interface, and then collects some statistics about the interface. This
tool has worked fine for a long time, but lately I have noticed
strange values when running on some mt7620-boards. The problem turns
out to be the MAC generation algorithm in mac80211.sh, which creates a
MAC address that conflicts with the WAN interface.

All of the problematic boards have two wifi interfaces configured on
one radio, and the address_mask is 00:00:00:00:00:07. The MAC address
of eth0 (LAN) and wlan0 are the same, while the MAC of eth0.2 (WAN) is
LAN + 1. When the address for the second wifi interface is created,
the last byte of the MAC is set to b6 ^ 1. I suspect the intention
behind this calculation is to subtract index from b6. However, in my
case, the value of b6 is such that the XOR-operation causes b6 to be
increased by one, colliding with the MAC address of WAN. One example
of a "bad" b6 value is 0xb8.

What would be the proper way to work-around or fix this issue? While I
have several options wrt my tool, I am probably not the only one that
will be (or has been) hit by this behavior. Thus, some change to the
MAC generation might be desirable.

My current system-wide work-around is to also set the LA bit of b1,
which prevents a collision on all my devices. However, I am not sure
if that is acceptable, as you loose one valid MAC address.

BR,
Kristian

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list