summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-30 14:22:38 +0200
committerChristian Poessinger <christian@poessinger.com>2020-03-30 14:22:41 +0200
commitb183d43341fed17033c2526f1cd5c9c70bf10e0e (patch)
treea1818c94c24b21a18607f2017ecd2f349030d7dd
parent3a46ad00f55873e1372f24a01f3c2698e6568623 (diff)
downloadvyos-1x-b183d43341fed17033c2526f1cd5c9c70bf10e0e.tar.gz
vyos-1x-b183d43341fed17033c2526f1cd5c9c70bf10e0e.zip
wireless: T2151: support phys that provide multiple mac addresses
A user reported a PHY that provides two consecutive MAC addresses, this case has been added as I was not aware of such cards. As we manipulate the MAC address anyways its safe to take only the first one.
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index 82a80d247..b6e62b0aa 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -1398,7 +1398,10 @@ def generate(wifi):
# http://wiki.stocksy.co.uk/wiki/Multiple_SSIDs_with_hostapd
# generate locally administered MAC address from used phy interface
with open('/sys/class/ieee80211/{}/addresses'.format(wifi['phy']), 'r') as f:
- tmp = EUI(f.read().rstrip()).value
+ # some PHYs tend to have multiple interfaces and thus supply multiple MAC
+ # addresses - we only need the first one for our calculation
+ tmp = f.readline().rstrip()
+ tmp = EUI(tmp).value
# mask last nibble from the MAC address
tmp &= 0xfffffffffff0
# set locally administered bit in MAC address