diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-07 19:57:00 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-10-31 09:58:29 +0000 |
| commit | 9f75f7bf6c143ee3ba7522d281f3a930634cbd83 (patch) | |
| tree | 4f00ad53269b8e0fcd47da8a97da5b0aa532b23f /python | |
| parent | ccac4ac565796934fa217dbcb6f470819ffb2d36 (diff) | |
| download | vyos-1x-9f75f7bf6c143ee3ba7522d281f3a930634cbd83.tar.gz vyos-1x-9f75f7bf6c143ee3ba7522d281f3a930634cbd83.zip | |
interfaces: T3871: report a name which changed hands between known cards
Cards rearranged among themselves, or a map edited by hand, leave every name
matched to a card the store knows - just not the one it had. That was filed
as an ordinary match, indistinguishable from a machine where nothing moved,
while the addresses configured under those names had quietly changed cable.
Report it separately. Which name goes to which card is unchanged, the slot
still decides; only the account of what happened is.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ifconfig/ifname_store.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/ifname_store.py b/python/vyos/ifconfig/ifname_store.py index 5f25235ae..d30d39a7f 100644 --- a/python/vyos/ifconfig/ifname_store.py +++ b/python/vyos/ifconfig/ifname_store.py @@ -357,7 +357,8 @@ def resolve(devices: list, store: dict) -> tuple: seen = {n: m for n, m in seen.items() if n not in misfiled} assigned = {} # final name -> device - report = {'matched': {}, 'moved': {}, 'replaced': {}, 'bootstrapped': {}} + report = {'matched': {}, 'reassigned': {}, 'moved': {}, + 'replaced': {}, 'bootstrapped': {}} # A recorded name stays off-limits even while its slot is empty, so new # hardware cannot inherit an absent interface's name and configuration. @@ -382,7 +383,8 @@ def resolve(devices: list, store: dict) -> tuple: # a card the store already knows about, sitting in this name's slot. The # cards were rearranged among themselves, or the map was edited by hand - # either way the map is what decides names, so the slot wins and the - # address on record simply follows. + # address on record simply follows. The name changes hands, so it is + # reported apart from a card which simply stayed where it was. known = {mac for mac in seen.values() if mac} for name, key in entries.items(): if name in assigned: @@ -390,7 +392,7 @@ def resolve(devices: list, store: dict) -> tuple: for device in remaining: if (device_matches(device['properties'], key) and device['mac'] in known): - claim(device, name, 'matched') + claim(device, name, 'reassigned') break # the card moved, and nothing the store knows took its place. Its address |
