mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 07:50:17 +01:00
ifcfg-rh: also check BONDING_OPTS to determine the connection type
Connections with "TYPE=Ethernet" and "BONDING_OPTS=..." are regarded by initscripts as bond masters. To maintain the best compatibility, do the same. https://bugzilla.redhat.com/show_bug.cgi?id=1434555
This commit is contained in:
parent
c06308a10c
commit
e044071825
4 changed files with 41 additions and 0 deletions
|
|
@ -2054,6 +2054,7 @@ EXTRA_DIST += \
|
|||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-dynamic-wep-leap \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-dynamic-wep-leap \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-infiniband \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-eth-type \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-main \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib \
|
||||
|
|
|
|||
|
|
@ -5352,6 +5352,16 @@ connection_from_file_full (const char *filename,
|
|||
}
|
||||
}
|
||||
|
||||
if (nm_streq0 (type, TYPE_ETHERNET)) {
|
||||
gs_free char *bond_options = NULL;
|
||||
|
||||
if (svGetValueStr (parsed, "BONDING_OPTS", &bond_options)) {
|
||||
/* initscripts consider these as bond masters */
|
||||
g_free (type);
|
||||
type = g_strdup (TYPE_BOND);
|
||||
}
|
||||
}
|
||||
|
||||
if (svGetValueBoolean (parsed, "BONDING_MASTER", FALSE) &&
|
||||
strcasecmp (type, TYPE_BOND)) {
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
DEVICE=bond0
|
||||
NM_CONTROLLED=yes
|
||||
TYPE=Ethernet
|
||||
BONDING_OPTS="miimon=213 mode=4 lacp_rate=1"
|
||||
BONDING_MASTER=yes
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=none
|
||||
|
|
@ -7526,6 +7526,28 @@ test_read_bond_main (void)
|
|||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_bond_eth_type (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingBond *s_bond;
|
||||
|
||||
connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-eth-type",
|
||||
NULL, TYPE_ETHERNET,NULL);
|
||||
|
||||
g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "bond0");
|
||||
|
||||
/* ===== Bonding SETTING ===== */
|
||||
|
||||
s_bond = nm_connection_get_setting_bond (connection);
|
||||
g_assert (s_bond);
|
||||
|
||||
g_assert_cmpstr (nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_MIIMON), ==, "213");
|
||||
g_assert_cmpstr (nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_LACP_RATE), ==, "1");
|
||||
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_write_bond_main (void)
|
||||
{
|
||||
|
|
@ -9328,6 +9350,7 @@ int main (int argc, char **argv)
|
|||
g_test_add_data_func (TPATH "fcoe/write-vn2vn", (gpointer) NM_SETTING_DCB_FCOE_MODE_VN2VN, test_write_fcoe_mode);
|
||||
|
||||
g_test_add_func (TPATH "bond/read-master", test_read_bond_main);
|
||||
g_test_add_func (TPATH "bond/read-master-eth-type", test_read_bond_eth_type);
|
||||
g_test_add_func (TPATH "bond/read-slave", test_read_bond_slave);
|
||||
g_test_add_func (TPATH "bond/read-slave-ib", test_read_bond_slave_ib);
|
||||
g_test_add_func (TPATH "bond/write-master", test_write_bond_main);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue