From b183d43341fed17033c2526f1cd5c9c70bf10e0e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 30 Mar 2020 14:22:38 +0200 Subject: 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. --- src/conf_mode/interfaces-wireless.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3