mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
nmcli: add get functions for 802-3.speed and 802-3.duplex properties
This commit is contained in:
parent
e196137f3a
commit
16fdef33dd
|
@ -1800,8 +1800,6 @@ DEFINE_GETTER (nmc_property_wimax_get_mac_address, NM_SETTING_WIMAX_MAC_ADDRESS)
|
|||
|
||||
/* --- NM_SETTING_WIRED_SETTING_NAME property get functions --- */
|
||||
DEFINE_GETTER (nmc_property_wired_get_port, NM_SETTING_WIRED_PORT)
|
||||
DEFINE_GETTER (nmc_property_wired_get_speed, NM_SETTING_WIRED_SPEED)
|
||||
DEFINE_GETTER (nmc_property_wired_get_duplex, NM_SETTING_WIRED_DUPLEX)
|
||||
DEFINE_GETTER (nmc_property_wired_get_auto_negotiate, NM_SETTING_WIRED_AUTO_NEGOTIATE)
|
||||
DEFINE_GETTER (nmc_property_wired_get_mac_address, NM_SETTING_WIRED_MAC_ADDRESS)
|
||||
DEFINE_GETTER (nmc_property_wired_get_cloned_mac_address, NM_SETTING_WIRED_CLONED_MAC_ADDRESS)
|
||||
|
@ -1812,6 +1810,30 @@ DEFINE_GETTER (nmc_property_wired_get_s390_nettype, NM_SETTING_WIRED_S390_NETTYP
|
|||
DEFINE_GETTER (nmc_property_wired_get_s390_options, NM_SETTING_WIRED_S390_OPTIONS)
|
||||
DEFINE_GETTER (nmc_property_wired_get_wake_on_lan_password, NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD)
|
||||
|
||||
static char *
|
||||
nmc_property_wired_get_speed (NMSetting *setting, NmcPropertyGetType get_type)
|
||||
{
|
||||
NMSettingWired *s_wired = NM_SETTING_WIRED (setting);
|
||||
guint32 speed;
|
||||
|
||||
speed = nm_setting_wired_get_speed (s_wired);
|
||||
return g_strdup_printf ("%d", speed);
|
||||
}
|
||||
|
||||
static char *
|
||||
nmc_property_wired_get_duplex (NMSetting *setting, NmcPropertyGetType get_type)
|
||||
{
|
||||
NMSettingWired *s_wired = NM_SETTING_WIRED (setting);
|
||||
const char *str;
|
||||
|
||||
str = nm_setting_wired_get_duplex (s_wired);
|
||||
if (!str)
|
||||
return NULL;
|
||||
else
|
||||
return g_strdup (str);
|
||||
|
||||
}
|
||||
|
||||
static char *
|
||||
nmc_property_wired_get_mtu (NMSetting *setting, NmcPropertyGetType get_type)
|
||||
{
|
||||
|
|
|
@ -724,16 +724,16 @@ _normalize_ethernet_link_neg (NMConnection *self)
|
|||
|
||||
if (s_wired) {
|
||||
gboolean autoneg = nm_setting_wired_get_auto_negotiate (s_wired);
|
||||
guint speed = nm_setting_wired_get_speed (s_wired);
|
||||
guint32 speed = nm_setting_wired_get_speed (s_wired);
|
||||
const char *duplex = nm_setting_wired_get_duplex (s_wired);
|
||||
|
||||
if ((autoneg) && (speed || duplex)) {
|
||||
if (autoneg && (speed || duplex)) {
|
||||
speed = 0;
|
||||
duplex = NULL;
|
||||
g_object_set (s_wired,
|
||||
NM_SETTING_WIRED_SPEED, speed,
|
||||
NM_SETTING_WIRED_DUPLEX, duplex,
|
||||
NULL);
|
||||
NM_SETTING_WIRED_SPEED, (guint) speed,
|
||||
NM_SETTING_WIRED_DUPLEX, duplex,
|
||||
NULL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1071,7 +1071,7 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class)
|
|||
/* ---ifcfg-rh---
|
||||
* property: auto-negotiate
|
||||
* variable: ETHTOOL_OPTS
|
||||
* description: Wether link speed and duplex autonegotiation is enabled.
|
||||
* description: Whether link speed and duplex autonegotiation is enabled.
|
||||
* It is not saved only if disabled and no values are provided for the
|
||||
* "speed" and "duplex" parameters (skips link configuration).
|
||||
* ---end---
|
||||
|
|
Loading…
Reference in a new issue