diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-28 22:16:59 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-10-31 09:58:29 +0000 |
| commit | 015663a3188727e2a16900cf5496c931770979a2 (patch) | |
| tree | 2b9855f90e4d496949aff99db79956f2b25a6873 /python | |
| parent | 153dd688b327c922ec4b371db1fdd11b8ee8cf9e (diff) | |
| download | vyos-1x-015663a3188727e2a16900cf5496c931770979a2.tar.gz vyos-1x-015663a3188727e2a16900cf5496c931770979a2.zip | |
wwan: T3871: stop reporting a modem as replaced hardware every boot
A modem that reports no permanent address is given a random one by its
driver at every probe. That address was read as if it identified the
hardware, so it never matched what was recorded and the modem was taken for
a different card in the same socket on each boot, warning the operator to
check a port nobody had touched. The map also kept being rewritten with the
address of the boot before, so it could never settle.
Keep no address for a modem, and compare one only where there is one. An
address recorded by an earlier version is dropped on the next pass, so a
machine already carrying one needs nothing done to it.
A card whose address really did change is still reported.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ifconfig/ifname_store.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/ifname_store.py b/python/vyos/ifconfig/ifname_store.py index 961a81d15..e9c204e6c 100644 --- a/python/vyos/ifconfig/ifname_store.py +++ b/python/vyos/ifconfig/ifname_store.py @@ -249,15 +249,18 @@ def discover_devices(sys_class_net: str = '/sys/class/net') -> list: if is_wireless(entry.name, sys_class_net): continue - mac = permanent_mac(entry.name, sys_class_net) - if not mac: + # a modem is given a random address at each probe, so it says nothing + # about which modem this is - there is nothing here worth recording + wwan = is_wwan(entry.name, sys_class_net) + mac = '' if wwan else permanent_mac(entry.name, sys_class_net) + if not mac and not wwan: continue devices.append({ 'name': entry.name, 'mac': mac, 'wireless': is_wireless(entry.name, sys_class_net), - 'wwan': is_wwan(entry.name, sys_class_net), + 'wwan': wwan, 'label_index': (port_label_index(entry.name, sys_class_net) if is_vmware_nic(entry.name, sys_class_net) else _LABEL_UNKNOWN), @@ -485,7 +488,8 @@ def resolve(devices: list, store: dict, adopt: bool = True) -> tuple: for name, key in entries.items(): for device in remaining: if (device_matches(device['properties'], key) - and seen.get(name, device['mac']) == device['mac'] + and (not device['mac'] + or seen.get(name, device['mac']) == device['mac']) and _name_fits(name, device)): claim(device, name, 'matched') break @@ -577,6 +581,8 @@ def resolve(devices: list, store: dict, adopt: bool = True) -> tuple: for name, device in assigned.items(): if device['mac']: new_hardware[name] = device['mac'] + else: + new_hardware.pop(name, None) plan = {device['name']: name for name, device in assigned.items() if device['name'] != name} |
