mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 18:20:22 +01:00
ifcfg-rh: write DEVICE only once
The plugin already writes DEVICE in write_connection_setting(), there is no need to write it again elsewhere.
This commit is contained in:
parent
18f53a8b30
commit
e89ed9b51e
4 changed files with 4 additions and 40 deletions
|
|
@ -1192,19 +1192,11 @@ static gboolean
|
|||
write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error)
|
||||
{
|
||||
NMSettingVlan *s_vlan;
|
||||
NMSettingConnection *s_con;
|
||||
char *tmp;
|
||||
guint32 vlan_flags = 0;
|
||||
gsize s_buf_len;
|
||||
char s_buf[50], *s_buf_ptr;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
if (!s_con) {
|
||||
g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
||||
"Missing connection setting");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s_vlan = nm_connection_get_setting_vlan (connection);
|
||||
if (!s_vlan) {
|
||||
g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
||||
|
|
@ -1214,9 +1206,8 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
|
|||
|
||||
svSetValueStr (ifcfg, "VLAN", "yes");
|
||||
svSetValueStr (ifcfg, "TYPE", TYPE_VLAN);
|
||||
svSetValueStr (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con));
|
||||
svSetValueStr (ifcfg, "PHYSDEV", nm_setting_vlan_get_parent (s_vlan));
|
||||
svSetValueInt64 (ifcfg, "VLAN_ID", nm_setting_vlan_get_id(s_vlan));
|
||||
svSetValueInt64 (ifcfg, "VLAN_ID", nm_setting_vlan_get_id (s_vlan));
|
||||
|
||||
vlan_flags = nm_setting_vlan_get_flags (s_vlan);
|
||||
svSetValueBoolean (ifcfg, "REORDER_HDR", NM_FLAGS_HAS (vlan_flags, NM_VLAN_FLAG_REORDER_HEADERS));
|
||||
|
|
@ -1254,7 +1245,6 @@ static gboolean
|
|||
write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error)
|
||||
{
|
||||
NMSettingBond *s_bond;
|
||||
const char *iface;
|
||||
guint32 i, num_opts;
|
||||
|
||||
s_bond = nm_connection_get_setting_bond (connection);
|
||||
|
|
@ -1264,14 +1254,6 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wir
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
iface = nm_connection_get_interface_name (connection);
|
||||
if (!iface) {
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
||||
"Missing interface name");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
svSetValueStr (ifcfg, "DEVICE", iface);
|
||||
svUnsetValue (ifcfg, "BONDING_OPTS");
|
||||
|
||||
num_opts = nm_setting_bond_get_num_options (s_bond);
|
||||
|
|
@ -1308,7 +1290,6 @@ static gboolean
|
|||
write_team_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error)
|
||||
{
|
||||
NMSettingTeam *s_team;
|
||||
const char *iface;
|
||||
const char *config;
|
||||
|
||||
s_team = nm_connection_get_setting_team (connection);
|
||||
|
|
@ -1318,14 +1299,6 @@ write_team_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
iface = nm_connection_get_interface_name (connection);
|
||||
if (!iface) {
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
||||
"Missing interface name");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
svSetValueStr (ifcfg, "DEVICE", iface);
|
||||
config = nm_setting_team_get_config (s_team);
|
||||
svSetValueStr (ifcfg, "TEAM_CONFIG", config);
|
||||
|
||||
|
|
@ -1372,7 +1345,6 @@ static gboolean
|
|||
write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
||||
{
|
||||
NMSettingBridge *s_bridge;
|
||||
const char *iface;
|
||||
guint32 i;
|
||||
gboolean b;
|
||||
GString *opts;
|
||||
|
|
@ -1385,14 +1357,6 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
iface = nm_connection_get_interface_name (connection);
|
||||
if (!iface) {
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
|
||||
"Missing interface name");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
svSetValueStr (ifcfg, "DEVICE", iface);
|
||||
svUnsetValue (ifcfg, "BRIDGING_OPTS");
|
||||
svSetValueBoolean (ifcfg, "STP", FALSE);
|
||||
svUnsetValue (ifcfg, "DELAY");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
DEVICE=bond0
|
||||
BONDING_OPTS=mode=balance-rr
|
||||
TYPE=Bond
|
||||
BONDING_MASTER=yes
|
||||
|
|
@ -13,4 +12,5 @@ IPV4_FAILURE_FATAL=no
|
|||
IPV6INIT=no
|
||||
NAME="Test Write Bond Main"
|
||||
UUID=${UUID}
|
||||
DEVICE=bond0
|
||||
ONBOOT=yes
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
VLAN=yes
|
||||
TYPE=Vlan
|
||||
DEVICE=vlan43
|
||||
PHYSDEV=eth9
|
||||
VLAN_ID=43
|
||||
REORDER_HDR=yes
|
||||
|
|
@ -19,4 +18,5 @@ IPV4_FAILURE_FATAL=no
|
|||
IPV6INIT=no
|
||||
NAME="Vlan test-vlan-interface"
|
||||
UUID=${UUID}
|
||||
DEVICE=vlan43
|
||||
ONBOOT=yes
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
VLAN=yes
|
||||
DEVICE=enp31s0f1-142
|
||||
PHYSDEV=enp31s0f1
|
||||
VLAN_ID=142
|
||||
REORDER_HDR=yes
|
||||
|
|
@ -7,6 +6,7 @@ GVRP=no
|
|||
MVRP=no
|
||||
NAME=team-slave-enp31s0f1-142
|
||||
UUID=74f435bb-ede4-415a-9d48-f580b60eba04
|
||||
DEVICE=enp31s0f1-142
|
||||
ONBOOT=no
|
||||
TEAM_MASTER=team142
|
||||
DEVICETYPE=TeamPort
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue