none fix
All checks were successful
Build and Deploy MITM Webserver / traffic_target (push) Successful in 0s
Build and Deploy MITM Webserver / build (push) Successful in 9s

This commit is contained in:
2026-03-09 17:58:06 +01:00
parent c592671e6f
commit a6825dd790

View File

@@ -438,12 +438,7 @@ class BridgeLinkStateWatcher:
if state.mtu is not None:
return True
profile = state.ethernet_profile
if profile is None:
return False
if profile.autoneg is True:
return True
return profile.autoneg is False and profile.speed_mbps is not None and profile.duplex is not None
return self._partial_profile_is_usable(state.ethernet_profile)
def _has_config_mismatch(self, source_ifname: str, states: dict[str, MemberLinkState]) -> bool:
"""Return whether any sibling differs from the chosen source configuration."""
@@ -625,9 +620,9 @@ class BridgeLinkStateWatcher:
"""Return whether a profile contains enough data to drive synchronization."""
if profile is None:
return False
if profile.autoneg is True:
return True
return profile.autoneg is False and profile.speed_mbps is not None and profile.duplex is not None
if profile.autoneg is None:
return False
return profile.speed_mbps is not None and profile.duplex is not None
def _materialize_profile(
self,
@@ -708,37 +703,36 @@ class BridgeLinkStateWatcher:
target_profile = target.ethernet_profile
if source_profile is None or target_profile is None or source_profile == target_profile:
return None
if not self._partial_profile_is_usable(source_profile):
return None
if not self._should_attempt_sync(source_ifname, target_ifname, source_profile):
return None
change_summary: Optional[str] = None
commands: list[tuple[list[str], str]] = []
if source_profile.autoneg is True:
if source_profile.speed_mbps is not None and source_profile.duplex is not None:
# A remote peer can pull this port down to a lower negotiated speed while autoneg
# stays enabled locally. Mirror that effective mode while keeping autoneg enabled
# on the sibling so its far-end peer can still negotiate successfully.
commands.append(
# A remote peer can pull this port down to a lower negotiated speed while autoneg
# stays enabled locally. Mirror that effective mode while keeping autoneg enabled
# on the sibling so its far-end peer can still negotiate successfully.
commands.append(
(
[
_ETHTOOL_BIN,
"-s",
target_ifname,
"speed",
str(source_profile.speed_mbps),
"duplex",
source_profile.duplex,
"autoneg",
"on",
],
(
[
_ETHTOOL_BIN,
"-s",
target_ifname,
"speed",
str(source_profile.speed_mbps),
"duplex",
source_profile.duplex,
"autoneg",
"on",
],
(
f"{target_ifname} link={source_profile.speed_mbps}Mb/"
f"{source_profile.duplex}/autoneg-on"
),
)
f"{target_ifname} link={source_profile.speed_mbps}Mb/"
f"{source_profile.duplex}/autoneg-on"
),
)
else:
commands.append(([_ETHTOOL_BIN, "-s", target_ifname, "autoneg", "on"], f"{target_ifname} link=autoneg-on"))
)
elif source_profile.autoneg is False and source_profile.speed_mbps is not None and source_profile.duplex is not None:
# Do not force autoneg off on sibling ports. The far-end peer on that segment may
# still rely on autoneg, and forcing a fixed mode here can leave the link down.