about summary refs log tree commit diff
path: root/libnm-core/nm-setting-wired.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2018-08-24 11:00:09 +0200
committerSebastien Bacher <seb128@ubuntu.com>2018-08-24 11:06:47 +0200
commitb7db94545968c37886b7111d8c85f62eb063fbb4 (patch)
tree7c2aedd497b1fdcb26bf9d49f98cc63a530baf2e /libnm-core/nm-setting-wired.c
parent9d5cdc3adde9e7e57bf5a0e754e563b6a9e8e513 (diff)
parentcaf1db9d6fbc056cc6c76a24574890f6c7895f3d (diff)
Import Debian changes 1.12.2-0ubuntu3
network-manager (1.12.2-0ubuntu3) cosmic; urgency=medium

  * debian/rules:
    - use --with-libnm-glib, the default reversed since that's a legacy
      library but we still need it for unity-control-center

network-manager (1.12.2-0ubuntu2) cosmic; urgency=medium

  * debian/patches/git-newglib-test.patch:
    - backport upstream commit to fix the tests with the new glib 

network-manager (1.12.2-0ubuntu1) cosmic; urgency=medium

  * New upstream version
  * d/p/libnm-register-empty-NMClient-and-NetworkManager-when-loa.patch,
    d/p/e91f1a7d2a6b8400b6b331d5b72287dcb5164a39.patch,
    d/p/git_thunderbolt_connect.patch:
    - removed, those changes are in the new version
  * Backport Debian changes
  * Update symbols file for libnm0
  * Enable iwd support
  * Drop version requirements when oldstable ships a newer version
  * Drop dh_strip override, the dbgsym migration is done
  * Rebase patches
  * Make sure the example server.conf is actually installed
  * Update install path for plugins, it now includes a version number
  * Drop libnl3 build dependency.
    Upstream has copied the code directly from libnl3 for the few functions it
    needs with a few small modifications.
  * Drop libiw build dependency.
    Hasn't been needed for a long time and was simply a left over from older
    releases.
  * Bump Standards-Version to 4.1.5
  * Fix compile error due to NM_AVAILABLE_IN_1_12_2 macro (Closes: #905372)
Diffstat (limited to 'libnm-core/nm-setting-wired.c')
-rw-r--r--libnm-core/nm-setting-wired.c77
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