mac80211: tweak mac address allocation
authorFelix Fietkau <nbd@openwrt.org>
Sat, 13 Jul 2013 11:39:48 +0000 (11:39 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 13 Jul 2013 11:39:48 +0000 (11:39 +0000)
Apparently there are some broken devices out there that have the local
bit already set in the factory MAC address. Move the | 0x2 over to the
other side of the xor operation to fix this without affecting devices
with proper addresses.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 37269

package/kernel/mac80211/files/lib/wifi/mac80211.sh

index a052a1cbfb9584ed86fd3fc150bef22686156ea7..20f6bfa93cb55c74312d09edd51f82bd399a88c4 100644 (file)
@@ -284,7 +284,7 @@ mac80211_generate_mac() {
        [ "$((0x$mask1))" -gt 0 ] && {
                b1="0x$1"
                [ "$id" -gt 0 ] && \
-                       b1=$((($b1 | 0x2) ^ (($id - 1) << 2)))
+                       b1=$(($b1 ^ ((($id - 1) << 2) | 0x2)))
                printf "%02x:%s:%s:%s:%s:%s" $b1 $2 $3 $4 $5 $6
                return
        }