mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 17:00:08 +01:00
initrd/ibft-reader: don't set con.interface-name in iBFT connections
If an argument in form ip=eth0:ibft is specified, we'd first create a wired connection with con.interface-name and then proceed completing it from the iBFT block. At that point we also add the MAC address, so the interface-name is no longer necessary.. Worse even, for VLAN connections, it results in an attempt to create a VLAN with the same name as the parent wired device. Ooops. Let's just drop it. MAC address is guarranteed to be there and does the right thing for both plain wired devices as well as VLANs.
This commit is contained in:
parent
de818bf610
commit
59ead70952
3 changed files with 28 additions and 0 deletions
|
|
@ -296,6 +296,7 @@ connection_setting_add (GHashTable *nic,
|
|||
NM_SETTING_CONNECTION_TYPE, type,
|
||||
NM_SETTING_CONNECTION_UUID, uuid,
|
||||
NM_SETTING_CONNECTION_ID, id,
|
||||
NM_SETTING_CONNECTION_INTERFACE_NAME, NULL,
|
||||
NULL);
|
||||
|
||||
g_free (uuid);
|
||||
|
|
|
|||
|
|
@ -767,6 +767,27 @@ test_team (void)
|
|||
g_assert_cmpint (nm_setting_connection_get_multi_connect (s_con), ==, NM_CONNECTION_MULTI_CONNECT_SINGLE);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ibft_ip_dev (void)
|
||||
{
|
||||
const char *const*ARGV = NM_MAKE_STRV ("ip=eth0:ibft");
|
||||
gs_unref_hashtable GHashTable *connections = NULL;
|
||||
NMSettingConnection *s_con;
|
||||
NMConnection *connection;
|
||||
|
||||
connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV);
|
||||
g_assert (connections);
|
||||
g_assert_cmpint (g_hash_table_size (connections), ==, 1);
|
||||
|
||||
connection = g_hash_table_lookup (connections, "eth0");
|
||||
g_assert (connection);
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
g_assert (s_con);
|
||||
g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_VLAN_SETTING_NAME);
|
||||
g_assert_cmpstr (nm_setting_connection_get_interface_name (s_con), ==, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ibft (void)
|
||||
{
|
||||
|
|
@ -782,11 +803,13 @@ test_ibft (void)
|
|||
g_assert (connection);
|
||||
nmtst_assert_connection_verifies_without_normalization (connection);
|
||||
g_assert_cmpstr (nm_connection_get_id (connection), ==, "iBFT VLAN Connection 0");
|
||||
g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, NULL);
|
||||
|
||||
connection = g_hash_table_lookup (connections, "ibft2");
|
||||
g_assert (connection);
|
||||
nmtst_assert_connection_verifies_without_normalization (connection);
|
||||
g_assert_cmpstr (nm_connection_get_id (connection), ==, "iBFT Connection 2");
|
||||
g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1045,6 +1068,7 @@ int main (int argc, char **argv)
|
|||
g_test_add_func ("/initrd/cmdline/team", test_team);
|
||||
g_test_add_func ("/initrd/cmdline/bridge", test_bridge);
|
||||
g_test_add_func ("/initrd/cmdline/bridge/default", test_bridge_default);
|
||||
g_test_add_func ("/initrd/cmdline/ibft/ip_dev", test_ibft_ip_dev);
|
||||
g_test_add_func ("/initrd/cmdline/ibft", test_ibft);
|
||||
g_test_add_func ("/initrd/cmdline/ignore_extra", test_ignore_extra);
|
||||
g_test_add_func ("/initrd/cmdline/rd_znet", test_rd_znet);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ test_read_ibft_dhcp (void)
|
|||
g_assert (s_con);
|
||||
g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_WIRED_SETTING_NAME);
|
||||
g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "iBFT Connection 1");
|
||||
g_assert_cmpstr (nm_setting_connection_get_interface_name (s_con), ==, NULL);
|
||||
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
|
||||
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
||||
|
||||
|
|
@ -109,6 +110,7 @@ test_read_ibft_static (void)
|
|||
g_assert (s_con);
|
||||
g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_WIRED_SETTING_NAME);
|
||||
g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "iBFT Connection 0");
|
||||
g_assert_cmpstr (nm_setting_connection_get_interface_name (s_con), ==, NULL);
|
||||
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
|
||||
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
||||
|
||||
|
|
@ -178,6 +180,7 @@ test_read_ibft_vlan (void)
|
|||
s_con = nm_connection_get_setting_connection (connection);
|
||||
g_assert (s_con);
|
||||
g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_VLAN_SETTING_NAME);
|
||||
g_assert_cmpstr (nm_setting_connection_get_interface_name (s_con), ==, NULL);
|
||||
|
||||
/* ===== WIRED SETTING ===== */
|
||||
s_wired = nm_connection_get_setting_wired (connection);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue