mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 08:10:17 +01:00
Revert "initrd: set the bootif MAC in existing connection with ifname"
This reverts commit 389575a6b1.
When the command line contains BOOTIF and there is another ip=
argument specifying an interface name, we can follow 2 approaches:
a) BOOTIF creates a new distinct connection with DHCP
(the behaviour before the commit)
b) the connection generated for ip= will be also be bound to the
BOOTIF MAC (the behavior introduced by the commit)
Restore a) because we can't be sure that the MAC address refers to the
same interface. In that case it's preferable to generate a different
connection.
https://bugzilla.redhat.com/show_bug.cgi?id=1915493#c35
This commit is contained in:
parent
7adac95fc8
commit
c21d4ce125
2 changed files with 33 additions and 8 deletions
|
|
@ -1234,11 +1234,12 @@ nmi_cmdline_reader_parse(const char * sysfs_dir,
|
|||
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
|
||||
if (nm_setting_wired_get_mac_address(s_wired)
|
||||
&& !nm_utils_hwaddr_matches(nm_setting_wired_get_mac_address(s_wired),
|
||||
-1,
|
||||
bootif,
|
||||
-1)) {
|
||||
if (nm_connection_get_interface_name(connection)
|
||||
|| (nm_setting_wired_get_mac_address(s_wired)
|
||||
&& !nm_utils_hwaddr_matches(nm_setting_wired_get_mac_address(s_wired),
|
||||
-1,
|
||||
bootif,
|
||||
-1))) {
|
||||
connection = reader_create_connection(reader,
|
||||
"bootif_connection",
|
||||
"BOOTIF Connection",
|
||||
|
|
|
|||
|
|
@ -1982,7 +1982,7 @@ static void
|
|||
test_bootif_hwtype(void)
|
||||
{
|
||||
const char *const *ARGV0 = NM_MAKE_STRV("ip=eth0:dhcp", "BOOTIF=01-00-53-AB-cd-02-03");
|
||||
const char *const *ARGV1 = NM_MAKE_STRV("BOOTIF=00-00-53-Ab-cD-02-03", "ip=:::::eth0:dhcp");
|
||||
const char *const *ARGV1 = NM_MAKE_STRV("ip=eth0:dhcp", "BOOTIF=00-00-53-Ab-cD-02-03");
|
||||
const char *const *ARGV[] = {ARGV0, ARGV1};
|
||||
guint i;
|
||||
|
||||
|
|
@ -1994,15 +1994,15 @@ test_bootif_hwtype(void)
|
|||
NMSettingIPConfig * s_ip6;
|
||||
|
||||
connections = _parse_cons(ARGV[i]);
|
||||
g_assert_cmpint(g_hash_table_size(connections), ==, 1);
|
||||
g_assert_cmpint(g_hash_table_size(connections), ==, 2);
|
||||
|
||||
connection = g_hash_table_lookup(connections, "eth0");
|
||||
nmtst_assert_connection_verifies_without_normalization(connection);
|
||||
g_assert_cmpstr(nm_connection_get_id(connection), ==, "eth0");
|
||||
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
g_assert(!nm_setting_wired_get_mac_address(s_wired));
|
||||
g_assert(s_wired);
|
||||
g_assert_cmpstr(nm_setting_wired_get_mac_address(s_wired), ==, "00:53:AB:CD:02:03");
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config(connection);
|
||||
g_assert(s_ip4);
|
||||
|
|
@ -2018,6 +2018,30 @@ test_bootif_hwtype(void)
|
|||
==,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_AUTO);
|
||||
g_assert(!nm_setting_ip_config_get_ignore_auto_dns(s_ip6));
|
||||
|
||||
connection = g_hash_table_lookup(connections, "bootif_connection");
|
||||
nmtst_assert_connection_verifies_without_normalization(connection);
|
||||
g_assert_cmpstr(nm_connection_get_id(connection), ==, "BOOTIF Connection");
|
||||
|
||||
s_wired = nm_connection_get_setting_wired(connection);
|
||||
g_assert_cmpstr(nm_setting_wired_get_mac_address(s_wired), ==, "00:53:AB:CD:02:03");
|
||||
g_assert(s_wired);
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config(connection);
|
||||
g_assert(s_ip4);
|
||||
g_assert_cmpstr(nm_setting_ip_config_get_method(s_ip4),
|
||||
==,
|
||||
NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||
g_assert(!nm_setting_ip_config_get_ignore_auto_dns(s_ip4));
|
||||
g_assert(nm_setting_ip_config_get_may_fail(s_ip4));
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config(connection);
|
||||
g_assert(s_ip6);
|
||||
g_assert_cmpstr(nm_setting_ip_config_get_method(s_ip6),
|
||||
==,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_AUTO);
|
||||
g_assert(!nm_setting_ip_config_get_ignore_auto_dns(s_ip6));
|
||||
g_assert(nm_setting_ip_config_get_may_fail(s_ip6));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue