about summary refs log tree commit diff
path: root/libnm-util
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-util')
-rw-r--r--libnm-util/nm-setting-bond.c29
-rw-r--r--libnm-util/nm-setting-bridge-port.c2
-rw-r--r--libnm-util/nm-setting-dcb.c4
-rw-r--r--libnm-util/nm-setting-ip4-config.c2
-rw-r--r--libnm-util/nm-setting-ip6-config.c2
-rw-r--r--libnm-util/nm-setting-ppp.c4
-rw-r--r--libnm-util/nm-setting-wired.c4
-rw-r--r--libnm-util/nm-setting.c2
-rw-r--r--libnm-util/nm-utils.c9
-rw-r--r--libnm-util/nm-version.h14
10 files changed, 48 insertions, 24 deletions
diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c
index 8a11bc23..f56cb428 100644
--- a/libnm-util/nm-setting-bond.c
+++ b/libnm-util/nm-setting-bond.c
@@ -258,19 +258,34 @@ validate_list (const char *name, const char *value, const BondDefault *def)
 static gboolean
 validate_ip (const char *name, const char *value)
 {
-	char **ips, **iter;
-	gboolean success = TRUE;
+	gs_free char *value_clone = NULL;
 	struct in_addr addr;
 
 	if (!value || !value[0])
 		return FALSE;
 
-	ips = g_strsplit_set (value, ",", 0);
-	for (iter = ips; iter && *iter && success; iter++)
-		success = !!inet_aton (*iter, &addr);
-	g_strfreev (ips);
+	value_clone = g_strdup (value);
+	value = value_clone;
+	for (;;) {
+		char *eow;
 
-	return success;
+		/* we do not skip over empty words. E.g
+		 * "192.168.1.1," is an error.
+		 *
+		 * ... for no particular reason. */
+
+		eow = strchr (value, ',');
+		if (eow)
+			*eow = '\0';
+
+		if (inet_pton (AF_INET, value, &addr) != 1)
+			return FALSE;
+
+		if (!eow)
+			break;
+		value = eow + 1;
+	}
+	return TRUE;
 }
 
 static gboolean
diff --git a/libnm-util/nm-setting-bridge-port.c b/libnm-util/nm-setting-bridge-port.c
index 24417059..41d5a6f8 100644
--- a/libnm-util/nm-setting-bridge-port.c
+++ b/libnm-util/nm-setting-bridge-port.c
@@ -264,7 +264,7 @@ nm_setting_bridge_port_class_init (NMSettingBridgePortClass *setting_class)
 	/**
 	 * NMSettingBridgePort:hairpin-mode:
 	 *
-	 * Enables or disabled "hairpin mode" for the port, which allows frames to
+	 * Enables or disables "hairpin mode" for the port, which allows frames to
 	 * be sent back out through the port the frame was received on.
 	 *
 	 * Since: 0.9.8
diff --git a/libnm-util/nm-setting-dcb.c b/libnm-util/nm-setting-dcb.c
index f5c3ab0b..eaed4ff5 100644
--- a/libnm-util/nm-setting-dcb.c
+++ b/libnm-util/nm-setting-dcb.c
@@ -1155,7 +1155,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
 	 * An array of 8 uint values, where the array index corresponds to the
 	 * Priority Group ID (0 - 7) and the value indicates the percentage of link
 	 * bandwidth allocated to that group.  Allowed values are 0 - 100, and the
-	 * sum of all values must total 100 percent.
+	 * sum of all values must total 100 percents.
 	 *
 	 * Since: 0.9.10
 	 **/
@@ -1173,7 +1173,7 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class)
 	 * Priority (0 - 7) and the value indicates the percentage of bandwidth of
 	 * the priority's assigned group that the priority may use.  The sum of all
 	 * percentages for priorities which belong to the same group must total 100
-	 * percent.
+	 * percents.
 	 *
 	 * Since: 0.9.10
 	 **/
diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c
index 6018af06..74f4d312 100644
--- a/libnm-util/nm-setting-ip4-config.c
+++ b/libnm-util/nm-setting-ip4-config.c
@@ -1256,7 +1256,7 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class)
 	 * NMSettingIP4Config:route-metric:
 	 *
 	 * The default metric for routes that don't explicitly specify a metric.
-	 * The default value -1 means that the metric is choosen automatically
+	 * The default value -1 means that the metric is chosen automatically
 	 * based on the device type.
 	 * The metric applies to dynamic routes, manual (static) routes that
 	 * don't have an explicit metric setting, address prefix routes, and
diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c
index 37bdd0ed..1566fe99 100644
--- a/libnm-util/nm-setting-ip6-config.c
+++ b/libnm-util/nm-setting-ip6-config.c
@@ -1204,7 +1204,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class)
 	 * NMSettingIP6Config:route-metric:
 	 *
 	 * The default metric for routes that don't explicitly specify a metric.
-	 * The default value -1 means that the metric is choosen automatically
+	 * The default value -1 means that the metric is chosen automatically
 	 * based on the device type.
 	 * The metric applies to dynamic routes, manual (static) routes that
 	 * don't have an explicit metric setting, address prefix routes, and
diff --git a/libnm-util/nm-setting-ppp.c b/libnm-util/nm-setting-ppp.c
index d574bcea..54b070be 100644
--- a/libnm-util/nm-setting-ppp.c
+++ b/libnm-util/nm-setting-ppp.c
@@ -685,7 +685,7 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class)
 	/**
 	 * NMSettingPPP:require-mppe:
 	 *
-	 * If %TRUE, MPPE (Microsoft Point-to-Point Encrpytion) will be required for
+	 * If %TRUE, MPPE (Microsoft Point-to-Point Encryption) will be required for
 	 * the PPP session.  If either 64-bit or 128-bit MPPE is not available the
 	 * session will fail.  Note that MPPE is not used on mobile broadband
 	 * connections.
@@ -701,7 +701,7 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class)
 	/**
 	 * NMSettingPPP:require-mppe-128:
 	 *
-	 * If %TRUE, 128-bit MPPE (Microsoft Point-to-Point Encrpytion) will be
+	 * If %TRUE, 128-bit MPPE (Microsoft Point-to-Point Encryption) will be
 	 * required for the PPP session, and the "require-mppe" property must also
 	 * be set to %TRUE.  If 128-bit MPPE is not available the session will fail.
 	 **/
diff --git a/libnm-util/nm-setting-wired.c b/libnm-util/nm-setting-wired.c
index 6866d0b1..85ba0f5e 100644
--- a/libnm-util/nm-setting-wired.c
+++ b/libnm-util/nm-setting-wired.c
@@ -865,9 +865,9 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class)
 	/**
 	 * NMSettingWired:port:
 	 *
-	 * Specific port type to use if multiple the device supports multiple
+	 * Specific port type to use if the device supports multiple
 	 * attachment methods.  One of "tp" (Twisted Pair), "aui" (Attachment Unit
-	 * Interface), "bnc" (Thin Ethernet) or "mii" (Media Independent Interface.
+	 * Interface), "bnc" (Thin Ethernet) or "mii" (Media Independent Interface).
 	 * If the device supports only one port type, this setting is ignored.
 	 **/
 	g_object_class_install_property
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index 53e8f343..3bcefbc5 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -402,7 +402,7 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
 			continue;
 		}
 
-		nm_g_object_set_property ((GObject *) setting, prop_name, src_value, NULL);
+		(void) nm_g_object_set_property ((GObject *) setting, prop_name, src_value, NULL);
 	}
 
 	g_type_class_unref (class);
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c
index 04deecf9..fba87c5a 100644
--- a/libnm-util/nm-utils.c
+++ b/libnm-util/nm-utils.c
@@ -1102,7 +1102,7 @@ nm_utils_ip4_netmask_to_prefix (guint32 netmask)
 guint32
 nm_utils_ip4_prefix_to_netmask (guint32 prefix)
 {
-	return prefix < 32 ? ~htonl(0xFFFFFFFF >> prefix) : 0xFFFFFFFF;
+	return _nm_utils_ip4_prefix_to_netmask (prefix);
 }
 
 
@@ -1121,12 +1121,7 @@ nm_utils_ip4_prefix_to_netmask (guint32 prefix)
 guint32
 nm_utils_ip4_get_default_prefix (guint32 ip)
 {
-	if (((ntohl (ip) & 0xFF000000) >> 24) <= 127)
-		return 8;  /* Class A - 255.0.0.0 */
-	else if (((ntohl (ip) & 0xFF000000) >> 24) <= 191)
-		return 16;  /* Class B - 255.255.0.0 */
-
-	return 24;  /* Class C - 255.255.255.0 */
+	return _nm_utils_ip4_get_default_prefix (ip);
 }
 
 /**
diff --git a/libnm-util/nm-version.h b/libnm-util/nm-version.h
index d4c66ea0..7173bc6b 100644
--- a/libnm-util/nm-version.h
+++ b/libnm-util/nm-version.h
@@ -132,4 +132,18 @@
 # define NM_AVAILABLE_IN_1_8
 #endif
 
+#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_10
+# define NM_DEPRECATED_IN_1_10           G_DEPRECATED
+# define NM_DEPRECATED_IN_1_10_FOR(f)    G_DEPRECATED_FOR(f)
+#else
+# define NM_DEPRECATED_IN_1_10
+# define NM_DEPRECATED_IN_1_10_FOR(f)
+#endif
+
+#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_10
+# define NM_AVAILABLE_IN_1_10            G_UNAVAILABLE(1,10)
+#else
+# define NM_AVAILABLE_IN_1_10
+#endif
+
 #endif  /* NM_VERSION_H */