diff options
| author | Iain Lane <iain@orangesquash.org.uk> | 2018-09-24 09:29:55 +0100 |
|---|---|---|
| committer | Iain Lane <iain@orangesquash.org.uk> | 2018-09-24 09:29:55 +0100 |
| commit | e152ec7bf4ba252ff9d3eb13eabd417b931dac9a (patch) | |
| tree | c323cf856ee0bb8e44590670dd54c19653a55748 /libnm-core/nm-setting-wired.c | |
| parent | ee9c73a923909e23a649407be77e25235d769e25 (diff) | |
Import Upstream version 1.12.2
Diffstat (limited to 'libnm-core/nm-setting-wired.c')
| -rw-r--r-- | libnm-core/nm-setting-wired.c | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c index 9d255e1d..5da9ce7d 100644 --- a/libnm-core/nm-setting-wired.c +++ b/libnm-core/nm-setting-wired.c @@ -762,32 +762,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) * with legacy nm-connection-editor which used to save "full" duplex connection as default */ - if (priv->auto_negotiate) { - if (priv->duplex) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("when link autonegotiation is enabled no duplex value is accepted")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_DUPLEX); - return NM_SETTING_VERIFY_NORMALIZABLE; - } - if (priv->speed) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("when link autonegotiation is enabled speed should be 0")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_SPEED); - return NM_SETTING_VERIFY_NORMALIZABLE; - } - } else { - if ( ((priv->speed) && (!priv->duplex)) - || ((!priv->speed) && (priv->duplex))) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("both speed and duplex are required for static link configuration")); - return NM_SETTING_VERIFY_NORMALIZABLE; - } + if ( ((priv->speed) && (!priv->duplex)) + || ((!priv->speed) && (priv->duplex))) { + + g_set_error_literal (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + priv->auto_negotiate ? + _("both speed and duplex should have a valid value or both should be unset") + : _("both speed and duplex are required for static link configuration")); + return NM_SETTING_VERIFY_NORMALIZABLE; } return TRUE; @@ -829,7 +813,7 @@ nm_setting_wired_init (NMSettingWired *setting) { NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (setting); - priv->s390_options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + priv->s390_options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); /* We use GArray rather than GPtrArray so it will automatically be NULL-terminated */ priv->mac_address_blacklist = g_array_new (TRUE, FALSE, sizeof (char *)); @@ -1033,8 +1017,16 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class) /** * NMSettingWired:speed: * - * Can be set to a value greater than zero only when "auto-negotiate" is "off". - * In that case, statically configures the device to use that specified speed. + * When a value grater than 0 is set, configures the device to use + * the specified speed. If "auto-negotiate" is "yes" the specified + * speed will be the only one advertised during link negotiation: + * this works only for BASE-T 802.3 specifications and is useful for + * enforcing gigabit speeds, as in this case link negotiation is + * mandatory. + * If the value is unset (0, the default), the link configuration will be + * either skipped (if "auto-negotiate" is "no", the default) or will + * be auto-negotiated (if "auto-negotiate" is "yes") and the local device + * will advertise all the supported speeds. * In Mbit/s, ie 100 == 100Mbit/s. * Must be set together with the "duplex" property when non-zero. * Before specifying a speed value be sure your device supports it. @@ -1057,8 +1049,16 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class) /** * NMSettingWired:duplex: * - * Can be specified only when "auto-negotiate" is "off". In that case, statically - * configures the device to use that specified duplex mode, either "half" or "full". + * When a value is set, either "half" or "full", configures the device + * to use the specified duplex mode. If "auto-negotiate" is "yes" the + * specified duplex mode will be the only one advertised during link + * negotiation: this works only for BASE-T 802.3 specifications and is + * useful for enforcing gigabits modes, as in these cases link negotiation + * is mandatory. + * If the value is unset (the default), the link configuration will be + * either skipped (if "auto-negotiate" is "no", the default) or will + * be auto-negotiated (if "auto-negotiate" is "yes") and the local device + * will advertise all the supported duplex modes. * Must be set together with the "speed" property if specified. * Before specifying a duplex mode be sure your device supports it. **/ @@ -1079,9 +1079,14 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class) /** * NMSettingWired:auto-negotiate: * - * If %TRUE, enforce auto-negotiation of port speed and duplex mode. If - * %FALSE, "speed" and "duplex" properties should be both set or link configuration - * will be skipped. + * When %TRUE, enforce auto-negotiation of speed and duplex mode. + * If "speed" and "duplex" properties are both specified, only that + * single mode will be advertised and accepted during the link + * auto-negotiation process: this works only for BASE-T 802.3 specifications + * and is useful for enforcing gigabits modes, as in these cases link + * negotiation is mandatory. + * When %FALSE, "speed" and "duplex" properties should be both set or + * link configuration will be skipped. **/ /* ---ifcfg-rh--- * property: auto-negotiate @@ -1363,14 +1368,12 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class) G_PARAM_STATIC_STRINGS)); /** - * NMSettingWired:s390-options: + * NMSettingWired:s390-options: (type GHashTable(utf8,utf8)): * * Dictionary of key/value pairs of s390-specific device options. Both keys * and values must be strings. Allowed keys include "portno", "layer2", * "portname", "protocol", among others. Key names must contain only * alphanumeric characters (ie, [a-zA-Z0-9]). - * - * Type: GHashTable(utf8,utf8) **/ /* ---ifcfg-rh--- * property: s390-options |