summary refs log tree commit diff
path: root/libnm-core
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-core')
-rw-r--r--libnm-core/nm-setting-bond.c2
-rw-r--r--libnm-core/nm-setting-bridge-port.c31
-rw-r--r--libnm-core/nm-setting-wireless.c10
-rw-r--r--libnm-core/nm-utils.c4
4 files changed, 16 insertions, 31 deletions
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c
index a01adc12..904ebbfc 100644
--- a/libnm-core/nm-setting-bond.c
+++ b/libnm-core/nm-setting-bond.c
@@ -499,7 +499,7 @@ _nm_setting_bond_mode_from_string (const char *str)
 
 #define BIT(x) (1 << (x))
 
-const static struct {
+static const struct {
 	const char *option;
 	NMBondMode unsupp_modes;
 } bond_unsupp_modes[] = {
diff --git a/libnm-core/nm-setting-bridge-port.c b/libnm-core/nm-setting-bridge-port.c
index 331fa5ae..0116a836 100644
--- a/libnm-core/nm-setting-bridge-port.c
+++ b/libnm-core/nm-setting-bridge-port.c
@@ -115,33 +115,6 @@ nm_setting_bridge_port_get_hairpin_mode (NMSettingBridgePort *setting)
 static gboolean
 verify (NMSetting *setting, NMConnection *connection, GError **error)
 {
-	NMSettingBridgePortPrivate *priv = NM_SETTING_BRIDGE_PORT_GET_PRIVATE (setting);
-
-	if (priv->priority > BR_MAX_PORT_PRIORITY) {
-		g_set_error (error,
-		             NM_CONNECTION_ERROR,
-		             NM_CONNECTION_ERROR_INVALID_PROPERTY,
-		             _("'%d' is not a valid value for the property (should be <= %d)"),
-		             priv->priority, BR_MAX_PORT_PRIORITY);
-		g_prefix_error (error, "%s.%s: ",
-		                NM_SETTING_BRIDGE_PORT_SETTING_NAME,
-		                NM_SETTING_BRIDGE_PORT_PRIORITY);
-		return FALSE;
-	}
-
-	if (priv->path_cost > BR_MAX_PATH_COST) {
-		g_set_error (error,
-		             NM_CONNECTION_ERROR,
-		             NM_CONNECTION_ERROR_INVALID_PROPERTY,
-		             _("'%d' is not a valid value for the property (should be <= %d)"),
-		             priv->path_cost, BR_MAX_PATH_COST);
-		g_prefix_error (error, "%s.%s: ",
-		                NM_SETTING_BRIDGE_PORT_SETTING_NAME,
-		                NM_SETTING_BRIDGE_PORT_PATH_COST);
-		return FALSE;
-	}
-
-
 	if (connection) {
 		NMSettingConnection *s_con;
 		const char *slave_type;
@@ -202,10 +175,10 @@ set_property (GObject *object, guint prop_id,
 
 	switch (prop_id) {
 	case PROP_PRIORITY:
-		priv->priority = (guint16) (g_value_get_uint (value) & 0xFFFF);
+		priv->priority = g_value_get_uint (value);
 		break;
 	case PROP_PATH_COST:
-		priv->path_cost = (guint16) (g_value_get_uint (value) & 0xFFFF);
+		priv->path_cost = g_value_get_uint (value);
 		break;
 	case PROP_HAIRPIN_MODE:
 		priv->hairpin_mode = g_value_get_boolean (value);
diff --git a/libnm-core/nm-setting-wireless.c b/libnm-core/nm-setting-wireless.c
index 1d129f66..8ae84d4c 100644
--- a/libnm-core/nm-setting-wireless.c
+++ b/libnm-core/nm-setting-wireless.c
@@ -982,6 +982,7 @@ set_property (GObject *object, guint prop_id,
 	NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE (object);
 	const char * const *blacklist;
 	const char *mac;
+	gboolean bool_val;
 	int i;
 
 	switch (prop_id) {
@@ -1017,9 +1018,18 @@ set_property (GObject *object, guint prop_id,
 		                                                                  ETH_ALEN);
 		break;
 	case PROP_CLONED_MAC_ADDRESS:
+		bool_val = !!priv->cloned_mac_address;
 		g_free (priv->cloned_mac_address);
 		priv->cloned_mac_address = _nm_utils_hwaddr_canonical_or_invalid (g_value_get_string (value),
 		                                                                  ETH_ALEN);
+		if (bool_val && !priv->cloned_mac_address) {
+			/* cloned-mac-address was set before but was now explicitly cleared.
+			 * In this case, we also clear mac-address-randomization flag */
+			if (priv->mac_address_randomization != NM_SETTING_MAC_RANDOMIZATION_DEFAULT) {
+				priv->mac_address_randomization = NM_SETTING_MAC_RANDOMIZATION_DEFAULT;
+				g_object_notify (object, NM_SETTING_WIRELESS_MAC_ADDRESS);
+			}
+		}
 		break;
 	case PROP_GENERATE_MAC_ADDRESS_MASK:
 		g_free (priv->generate_mac_address_mask);
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 5b4566bf..478a548d 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -819,6 +819,8 @@ _nm_utils_slist_to_strv (GSList *slist, gboolean deep_copy)
 	int len, i;
 
 	len = g_slist_length (slist);
+	if (!len)
+		return NULL;
 	strv = g_new (char *, len + 1);
 
 	if (deep_copy) {
@@ -1068,7 +1070,7 @@ nm_utils_security_valid (NMUtilsSecurityType type,
 	case NMU_SEC_LEAP: /* require PRIVACY bit for LEAP? */
 		if (adhoc)
 			return FALSE;
-		/* Fall through */
+		/* fall through */
 	case NMU_SEC_STATIC_WEP:
 		g_assert (have_ap);
 		if (!(ap_flags & NM_802_11_AP_FLAGS_PRIVACY))