mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 13:40:11 +01:00
device: enforce specific speed/duplex modes in link auto-configuration
This commit is contained in:
parent
356addb9e6
commit
064ea1c58e
1 changed files with 12 additions and 13 deletions
|
|
@ -780,13 +780,11 @@ link_negotiation_set (NMDevice *device)
|
|||
s_wired = (NMSettingWired *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_WIRED);
|
||||
if (s_wired) {
|
||||
autoneg = nm_setting_wired_get_auto_negotiate (s_wired);
|
||||
if (!autoneg) {
|
||||
speed = nm_setting_wired_get_speed (s_wired);
|
||||
duplex = link_duplex_to_platform (nm_setting_wired_get_duplex (s_wired));
|
||||
if (!speed && !duplex) {
|
||||
_LOGD (LOGD_DEVICE, "set-link: ignore link negotiation");
|
||||
return;
|
||||
}
|
||||
speed = nm_setting_wired_get_speed (s_wired);
|
||||
duplex = link_duplex_to_platform (nm_setting_wired_get_duplex (s_wired));
|
||||
if (!autoneg && !speed && !duplex) {
|
||||
_LOGD (LOGD_DEVICE, "set-link: ignore link negotiation");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -797,17 +795,18 @@ link_negotiation_set (NMDevice *device)
|
|||
}
|
||||
|
||||
/* If link negotiation setting are already in place do nothing and return with success */
|
||||
if ( (!!autoneg == !!link_autoneg)
|
||||
&& (!speed || (speed == link_speed))
|
||||
&& (!duplex || (duplex == link_duplex))) {
|
||||
if ( !!autoneg == !!link_autoneg
|
||||
&& speed == link_speed
|
||||
&& duplex == link_duplex) {
|
||||
_LOGD (LOGD_DEVICE, "set-link: link negotiation is already configured");
|
||||
return;
|
||||
}
|
||||
|
||||
if (autoneg)
|
||||
_LOGD (LOGD_DEVICE, "set-link: configure autonegotiation");
|
||||
if (autoneg && !speed && !duplex)
|
||||
_LOGD (LOGD_DEVICE, "set-link: configure auto-negotiation");
|
||||
else {
|
||||
_LOGD (LOGD_DEVICE, "set-link: configure static negotiation (%u Mbit%s - %s duplex%s)",
|
||||
_LOGD (LOGD_DEVICE, "set-link: configure %snegotiation (%u Mbit%s - %s duplex%s)",
|
||||
autoneg ? "auto-" : "static ",
|
||||
speed ?: link_speed,
|
||||
speed ? "" : "*",
|
||||
duplex
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue