mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 22:40:16 +01:00
ifcfg-rh: don't write out a fake minimal IP4 config for bond slaves
The writer had code to fake up a simple IP4 config if the connection didn't already have one. Make sure we don't do that in the bond case.
This commit is contained in:
parent
6c38f0cfd1
commit
51f2bd0198
4 changed files with 24 additions and 18 deletions
|
|
@ -3663,21 +3663,6 @@ bond_connection_from_ifcfg (const char *file,
|
|||
return connection;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
disabling_ip4_config_allowed (NMConnection *connection)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
g_assert (s_con);
|
||||
|
||||
/* bonding slaves are allowed to have no ip configuration */
|
||||
if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_bond_device (const char *name, shvarFile *parsed)
|
||||
{
|
||||
|
|
@ -4107,7 +4092,7 @@ connection_from_file (const char *filename,
|
|||
can_disable_ip4 = TRUE;
|
||||
}
|
||||
|
||||
if (disabling_ip4_config_allowed (connection))
|
||||
if (utils_disabling_ip4_config_allowed (connection))
|
||||
can_disable_ip4 = TRUE;
|
||||
|
||||
s_ip4 = make_ip4_setting (parsed, network_file, iscsiadm_path, can_disable_ip4, &error);
|
||||
|
|
|
|||
|
|
@ -360,3 +360,17 @@ gone:
|
|||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
utils_disabling_ip4_config_allowed (NMConnection *connection)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
g_assert (s_con);
|
||||
|
||||
/* bonding slaves are allowed to have no ip configuration */
|
||||
if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#define _UTILS_H_
|
||||
|
||||
#include <glib.h>
|
||||
#include <nm-connection.h>
|
||||
#include "shvar.h"
|
||||
#include "common.h"
|
||||
|
||||
|
|
@ -47,5 +48,7 @@ shvarFile *utils_get_route6_ifcfg (const char *parent, gboolean should_create);
|
|||
|
||||
gboolean utils_has_route_file_new_syntax (const char *filename);
|
||||
|
||||
gboolean utils_disabling_ip4_config_allowed (NMConnection *connection);
|
||||
|
||||
#endif /* _UTILS_H_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -1910,6 +1910,7 @@ write_connection (NMConnection *connection,
|
|||
GError **error)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIP4Config *s_ip4;
|
||||
NMSettingIP6Config *s_ip6;
|
||||
gboolean success = FALSE;
|
||||
shvarFile *ifcfg = NULL;
|
||||
|
|
@ -2011,8 +2012,11 @@ write_connection (NMConnection *connection,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!write_ip4_setting (connection, ifcfg, error))
|
||||
goto out;
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (s_ip4 || !utils_disabling_ip4_config_allowed (connection)) {
|
||||
if (!write_ip4_setting (connection, ifcfg, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (s_ip6) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue