Hello!
With changeset 28298 for
trunk/package/mac80211/files/lib/wifi/mac80211.sh (09/25/11 by jow) you
introduced a change to the MAC address generation for virtual interfaces
which I think is not optimal:
"[package] mac80211: rework mac address generation for virtual
interfaces; set locally administered bit on generated macs and
change the last two bytes isntead of the first one"
Now, If you have two wirless LAN cards which have sequentially numbered
MAC addresses (e.g. AA:BB:CC:DD:EE:01 and AA:BB:CC:DD:EE:02, either on
the same board or two devices close to each other) and you want to use
virtual interfaces on both this easily leads to clashes: 2 VAP using the
same MAC address.
I believe the old method was more robust and thus propose the following
change (patch below).
Best greetings,
Bruno
---
commit 297256680b3870b498a737498ef2d2fdd424f783
Author: Bruno Randolf <b...@thinktube.com>
Date: Thu Jul 26 20:21:22 2012 +0100
mac80211: generate MAC adresses in the upper byte
This way it's easier to avoid duplicate MAC adresses.
diff --git a/package/mac80211/files/lib/wifi/mac80211.sh
b/package/mac80211/files/lib/wifi/mac
index 1a4d7c1..cc7c9bb 100644
--- a/package/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/mac80211/files/lib/wifi/mac80211.sh
@@ -273,17 +273,17 @@ get_freq() {
}
mac80211_generate_mac() {
- local off="$1"
- local mac="$2"
- local oIFS="$IFS"; IFS=":"; set -- $mac; IFS="$oIFS"
+ local macidx="$1"
+ local mac_1="${2%%:*}"
+ local mac_2="${2#*:}"
- local b2mask=0x00
- [ $off -gt 0 ] && b2mask=0x02
+ if [ "$macidx" -gt 0 ]; then
+ offset="$(( 2 + $macidx * 4 ))"
+ else
+ offset="0"
+ fi
- printf "%02x:%s:%s:%s:%02x:%02x" \
- $(( 0x$1 | $b2mask )) $2 $3 $4 \
- $(( (0x$5 + ($off / 0x100)) % 0x100 )) \
- $(( (0x$6 + $off) % 0x100 ))
+ printf "%02x:$mac_2" $((0x$mac_1 + $offset))
}
enable_mac80211() {
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel