diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2016-09-08 14:19:25 +0200 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2016-11-22 15:24:47 +0100 |
commit | 16fdef33dd4bf37d8b085a2a0c03c12da5dd04b1 (patch) | |
tree | 745146a3aaa657d0855b655ad217bd13422c5bfd | |
parent | e196137f3a8eca16fec4d67c0318932924171084 (diff) | |
download | NetworkManager-16fdef33dd4bf37d8b085a2a0c03c12da5dd04b1.tar.gz |
nmcli: add get functions for 802-3.speed and 802-3.duplex properties
-rw-r--r-- | clients/cli/settings.c | 26 | ||||
-rw-r--r-- | libnm-core/nm-connection.c | 10 | ||||
-rw-r--r-- | libnm-core/nm-setting-wired.c | 2 |
3 files changed, 30 insertions, 8 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c index d1e3ded932..875d435815 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -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) @@ -1813,6 +1811,30 @@ DEFINE_GETTER (nmc_property_wired_get_s390_options, NM_SETTING_WIRED_S390_OPTION 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) { NMSettingWired *s_wired = NM_SETTING_WIRED (setting); diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index e9b66dad2f..7bb7d4d9d0 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -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; } } diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c index 04b0f5ebbe..6a23ce4312 100644 --- a/libnm-core/nm-setting-wired.c +++ b/libnm-core/nm-setting-wired.c @@ -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--- |