aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2020-10-16 23:24:19 +0300
committerPetr Štetiar <ynezz@true.cz>2020-12-22 18:59:10 +0100
commit39c8bc4422f0404af5b85c10eeb2c4098d919cdb (patch)
treec40638122a458169bb3a5ea627f4a8ea3e10112a
parenta9deace10c0f4c9e82091f579e96aa83f5b7aeb6 (diff)
downloadupstream-39c8bc4422f0404af5b85c10eeb2c4098d919cdb.tar.gz
upstream-39c8bc4422f0404af5b85c10eeb2c4098d919cdb.tar.bz2
upstream-39c8bc4422f0404af5b85c10eeb2c4098d919cdb.zip
mac80211: fix MAC address allocations when local bit set on base addr
Testing with hwsim reveals two problems: 1. phyX/addresses has two addresses and mac80211_get_addr keeps returning the last one when asked for more; 2. The base address has the local bit set and the operation unsets it. Fix both. Fixes: 866790fd827cb0187353cdf484eb46a9b38fb6ba Reported-by: Zero_Chaos Signed-off-by: Paul Fertser <fercerpav@gmail.com>
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 6ca12084cf..e12a804271 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -409,7 +409,7 @@ mac80211_generate_mac() {
[ "$mask" = "00:00:00:00:00:00" ] && {
mask="ff:ff:ff:ff:ff:ff";
- [ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt 1 ] && {
+ [ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt $id ] && {
addr="$(mac80211_get_addr "$phy" "$id")"
[ -n "$addr" ] && {
echo "$addr"
@@ -429,7 +429,7 @@ mac80211_generate_mac() {
[ "$((0x$mask1))" -gt 0 ] && {
b1="0x$1"
[ "$id" -gt 0 ] && \
- b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2) | 0x2)))
+ b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2))
printf "%02x:%s:%s:%s:%s:%s" $b1 $2 $3 $4 $5 $6
return
}