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: if state.mtu is not None:
return True return True
profile = state.ethernet_profile return self._partial_profile_is_usable(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
def _has_config_mismatch(self, source_ifname: str, states: dict[str, MemberLinkState]) -> bool: def _has_config_mismatch(self, source_ifname: str, states: dict[str, MemberLinkState]) -> bool:
"""Return whether any sibling differs from the chosen source configuration.""" """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.""" """Return whether a profile contains enough data to drive synchronization."""
if profile is None: if profile is None:
return False return False
if profile.autoneg is True: if profile.autoneg is None:
return True return False
return profile.autoneg is False and profile.speed_mbps is not None and profile.duplex is not None return profile.speed_mbps is not None and profile.duplex is not None
def _materialize_profile( def _materialize_profile(
self, self,
@@ -708,37 +703,36 @@ class BridgeLinkStateWatcher:
target_profile = target.ethernet_profile target_profile = target.ethernet_profile
if source_profile is None or target_profile is None or source_profile == target_profile: if source_profile is None or target_profile is None or source_profile == target_profile:
return None 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): if not self._should_attempt_sync(source_ifname, target_ifname, source_profile):
return None return None
change_summary: Optional[str] = None change_summary: Optional[str] = None
commands: list[tuple[list[str], str]] = [] commands: list[tuple[list[str], str]] = []
if source_profile.autoneg is True: 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
# 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
# stays enabled locally. Mirror that effective mode while keeping autoneg enabled # on the sibling so its far-end peer can still negotiate successfully.
# on the sibling so its far-end peer can still negotiate successfully. commands.append(
commands.append( (
[
_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/"
_ETHTOOL_BIN, f"{source_profile.duplex}/autoneg-on"
"-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"
),
)
) )
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: 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 # 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. # still rely on autoneg, and forcing a fixed mode here can leave the link down.