ifcfg-rh: split setting ETHTOOL_OPTS from write_wired_setting()

Will be used later, because we will not only have ethtool options
in conjunction with wired settings.
This commit is contained in:
Thomas Haller
2018-08-02 13:33:10 +02:00
parent 1bcf104782
commit cd442112c6
3 changed files with 27 additions and 12 deletions

View File

@@ -1042,13 +1042,8 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{
NMSettingWired *s_wired;
const char *const*s390_subchannels;
const char *duplex;
guint32 mtu, num_opts, speed, i;
GString *str = NULL;
guint32 mtu, num_opts, i;
const char *const*macaddr_blacklist;
gboolean auto_negotiate;
NMSettingWiredWakeOnLan wol;
const char *wol_password;
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired) {
@@ -1131,8 +1126,27 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
svSetValueStr (ifcfg, "OPTIONS", tmp->str);
}
/* Stuff ETHTOOL_OPT with required options */
str = NULL;
svSetValueStr (ifcfg, "TYPE", TYPE_ETHERNET);
return TRUE;
}
static gboolean
write_ethtool_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{
NMSettingWired *s_wired;
const char *duplex;
guint32 speed;
GString *str = NULL;
gboolean auto_negotiate;
NMSettingWiredWakeOnLan wol;
const char *wol_password;
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired)
return TRUE;
auto_negotiate = nm_setting_wired_get_auto_negotiate (s_wired);
speed = nm_setting_wired_get_speed (s_wired);
duplex = nm_setting_wired_get_duplex (s_wired);
@@ -1194,8 +1208,6 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
} else
svUnsetValue (ifcfg, "ETHTOOL_OPTS");
svSetValueStr (ifcfg, "TYPE", TYPE_ETHERNET);
return TRUE;
}
@@ -2960,6 +2972,9 @@ do_write_construct (NMConnection *connection,
if (!write_proxy_setting (connection, ifcfg, error))
return FALSE;
if (!write_ethtool_setting (connection, ifcfg, error))
return FALSE;
if (!write_user_setting (connection, ifcfg, error))
return FALSE;

View File

@@ -1,7 +1,7 @@
ETHTOOL_OPTS="autoneg off speed 10 duplex half"
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
ETHTOOL_OPTS="autoneg off speed 10 duplex half"
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no

View File

@@ -1,7 +1,7 @@
ETHTOOL_OPTS="wol umgs sopass 00:00:00:11:22:33"
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
ETHTOOL_OPTS="wol umgs sopass 00:00:00:11:22:33"
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no