mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-17 19:50:19 +01:00
initrd: only reset autoneg/speed if specified
The idea of positional arguments is that they might be extended in the future. That means, there might be an option "rd.ethtool:eth0:::foo". Also, if multiple "rd.ethtool:eth0" options are specified on the command line, then the autoneg/speed settings should only be set if present. That means "rd.ethtool:eth0:on:100 rd.ethtool:eth0:::foo" should work as expected and first set autoneg/speed options, but the second argument only sets "foo" (without resetting autoneg/speed).
This commit is contained in:
parent
b7b275dead
commit
2c3f967d1a
2 changed files with 14 additions and 13 deletions
|
|
@ -1210,20 +1210,21 @@ reader_parse_ethtool(Reader *reader, char *argument)
|
|||
"rd.ethtool: autoneg ignored. Cannot disable autoneg without setting speed");
|
||||
}
|
||||
|
||||
if (autoneg == -1)
|
||||
autoneg = FALSE;
|
||||
|
||||
connection = reader_get_connection(reader, interface, NM_SETTING_WIRED_SETTING_NAME, TRUE);
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
|
||||
g_object_set(s_wired,
|
||||
NM_SETTING_WIRED_AUTO_NEGOTIATE,
|
||||
(gboolean) autoneg,
|
||||
NM_SETTING_WIRED_SPEED,
|
||||
speed,
|
||||
NM_SETTING_WIRED_DUPLEX,
|
||||
speed == 0 ? NULL : "full",
|
||||
NULL);
|
||||
if (autoneg != -1 || speed != 0) {
|
||||
if (autoneg == -1)
|
||||
autoneg = FALSE;
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
g_object_set(s_wired,
|
||||
NM_SETTING_WIRED_AUTO_NEGOTIATE,
|
||||
(gboolean) autoneg,
|
||||
NM_SETTING_WIRED_SPEED,
|
||||
speed,
|
||||
NM_SETTING_WIRED_DUPLEX,
|
||||
speed == 0 ? NULL : "full",
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (*argument)
|
||||
_LOGW(LOGD_CORE,
|
||||
|
|
|
|||
|
|
@ -2423,7 +2423,7 @@ test_rd_ethtool(void)
|
|||
NMTST_EXPECT_NM_WARN("cmdline-reader: rd.ethtool: autoneg ignored. Cannot disable autoneg "
|
||||
"without setting speed");
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:on:100", "rd.ethtool=eth0:off"), FALSE, 0);
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:off:100", "rd.ethtool=eth0:"), FALSE, 0);
|
||||
_ethtool_check_v(NM_MAKE_STRV("rd.ethtool=eth0:off:100", "rd.ethtool=eth0:"), FALSE, 100);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue