summary refs log tree commit diff
path: root/libnm-core
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-08-06 22:46:20 +0200
committerMichael Biebl <biebl@debian.org>2019-08-06 22:46:20 +0200
commit5c79b900b59a5ad162ecc836e424468207ff031e (patch)
tree2f529ff5c2d8531a2bf2973d96e316786eee9799 /libnm-core
parent2e5fa45ddfbb5cffa1e78221f1cea706e2f298af (diff)
New upstream version 1.20.0 upstream/1.20.0
Diffstat (limited to 'libnm-core')
-rw-r--r--libnm-core/nm-connection.h2
-rw-r--r--libnm-core/nm-dbus-interface.h12
-rw-r--r--libnm-core/nm-dbus-types.xml10
-rw-r--r--libnm-core/nm-keyfile.c7
-rw-r--r--libnm-core/nm-setting-ip6-config.c2
-rw-r--r--libnm-core/nm-setting-ip6-config.h2
-rw-r--r--libnm-core/nm-setting-vlan.c41
-rw-r--r--libnm-core/nm-setting-vpn.c2
-rw-r--r--libnm-core/nm-setting-wireguard.c2
-rw-r--r--libnm-core/nm-setting-wireless.h2
-rw-r--r--libnm-core/nm-team-utils.c4
-rw-r--r--libnm-core/nm-team-utils.h2
-rw-r--r--libnm-core/nm-utils.c6
13 files changed, 50 insertions, 44 deletions
diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h
index 4399ad67..2c553e0e 100644
--- a/libnm-core/nm-connection.h
+++ b/libnm-core/nm-connection.h
@@ -112,7 +112,7 @@ NMSetting    *nm_connection_get_setting_by_name (NMConnection *connection,
  * @NM_CONNECTION_SERIALIZE_NO_SECRETS: do not include secrets
  * @NM_CONNECTION_SERIALIZE_ONLY_SECRETS: only serialize secrets
  * @NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED: if set, only secrets that
- *   are agent owned will be serialized.
+ *   are agent owned will be serialized. Since: 1.20
  *
  * These flags determine which properties are serialized when calling when
  * calling nm_connection_to_dbus().
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index 7949fa2d..d74ea2ba 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -292,7 +292,7 @@ typedef enum { /*< flags >*/
  * @NM_WIFI_DEVICE_CAP_FREQ_VALID: device reports frequency capabilities
  * @NM_WIFI_DEVICE_CAP_FREQ_2GHZ: device supports 2.4GHz frequencies
  * @NM_WIFI_DEVICE_CAP_FREQ_5GHZ: device supports 5GHz frequencies
- * @NM_WIFI_DEVICE_CAP_MESH: device supports acting as a mesh point
+ * @NM_WIFI_DEVICE_CAP_MESH: device supports acting as a mesh point. Since: 1.20.
  *
  * 802.11 specific device encryption and authentication capabilities.
  **/
@@ -385,7 +385,7 @@ typedef enum { /*< underscore_name=nm_802_11_ap_security_flags, flags >*/
  *   provides connectivity to clients.
  * @NM_802_11_MODE_AP: the device is an access point/hotspot.  Not valid for
  *   access point objects; used only for hotspot mode on the local machine.
- * @NM_802_11_MODE_MESH: the device is a 802.11s mesh point.
+ * @NM_802_11_MODE_MESH: the device is a 802.11s mesh point. Since: 1.20.
  *
  * Indicates the 802.11 mode an access point or device is currently in.
  **/
@@ -673,7 +673,7 @@ typedef enum {
  * NMConnectionMultiConnect:
  * @NM_CONNECTION_MULTI_CONNECT_DEFAULT: indicates that the per-connection
  *   setting is unspecified. In this case, it will fallback to the default
- *   value, which is @NM_CONNECTION_MULTI_CONNECT_SINGLE.
+ *   value, which is %NM_CONNECTION_MULTI_CONNECT_SINGLE.
  * @NM_CONNECTION_MULTI_CONNECT_SINGLE: the connection profile can only
  *   be active once at each moment. Activating a profile that is already active,
  *   will first deactivate it.
@@ -1045,14 +1045,14 @@ typedef enum { /*< flags >*/
  *   Likewise, when finally deleting the profile, both the storage from /run
  *   and persistent storage are deleted (or if the persistent storage does not
  *   allow deletion, and nmmeta file is written to mark the UUID as deleted).
- * @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACHED: this is almost the same as
- *   @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY, with one difference: when later deleting
+ * @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACHED: this is almost the same
+ *   as %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY, with one difference: when later deleting
  *   the profile, the original profile will not be deleted. Instead a nmmeta
  *   file is written to /run to indicate that the profile is gone.
  *   Note that if such a nmmeta tombstone file exists and hides a file in persistant
  *   storage, then when re-adding the profile with the same UUID, then the original
  *   storage is taken over again.
- * @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY: this is like @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY,
+ * @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY: this is like %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY,
  *   but if the connection has a corresponding file on persistent storage, the file
  *   will be deleted right away. If the profile is later again persisted to disk,
  *   a new, unused filename will be chosen.
diff --git a/libnm-core/nm-dbus-types.xml b/libnm-core/nm-dbus-types.xml
index ad199238..309a88b7 100644
--- a/libnm-core/nm-dbus-types.xml
+++ b/libnm-core/nm-dbus-types.xml
@@ -440,7 +440,7 @@
             <row role="constant">
               <entry role="enum_member_name"><para>NM_WIFI_DEVICE_CAP_MESH</para><para></para></entry>
               <entry role="enum_member_value"><para>= <literal>0x00001000</literal></para><para></para></entry>
-              <entry role="enum_member_description"><para>device supports acting as a mesh point</para><para></para></entry>
+              <entry role="enum_member_description"><para>device supports acting as a mesh point. Since: 1.20.</para><para></para></entry>
             </row>
           </tbody>
         </tgroup>
@@ -610,7 +610,7 @@
             <row role="constant">
               <entry role="enum_member_name"><para>NM_802_11_MODE_MESH</para><para></para></entry>
               <entry role="enum_member_value"><para>= <literal>4</literal></para><para></para></entry>
-              <entry role="enum_member_description"><para>the device is a 802.11s mesh point.</para><para></para></entry>
+              <entry role="enum_member_description"><para>the device is a 802.11s mesh point. Since: 1.20.</para><para></para></entry>
             </row>
           </tbody>
         </tgroup>
@@ -1245,7 +1245,7 @@
             <row role="constant">
               <entry role="enum_member_name"><para>NM_CONNECTION_MULTI_CONNECT_DEFAULT</para><para></para></entry>
               <entry role="enum_member_value"><para>= <literal>0</literal></para><para></para></entry>
-              <entry role="enum_member_description"><para>indicates that the per-connection setting is unspecified. In this case, it will fallback to the default value, which is @NM_CONNECTION_MULTI_CONNECT_SINGLE.</para><para></para></entry>
+              <entry role="enum_member_description"><para>indicates that the per-connection setting is unspecified. In this case, it will fallback to the default value, which is %NM_CONNECTION_MULTI_CONNECT_SINGLE.</para><para></para></entry>
             </row>
             <row role="constant">
               <entry role="enum_member_name"><para>NM_CONNECTION_MULTI_CONNECT_SINGLE</para><para></para></entry>
@@ -1830,12 +1830,12 @@
             <row role="constant">
               <entry role="enum_member_name"><para>NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACHED</para><para></para></entry>
               <entry role="enum_member_value"><para>= <literal>0x4</literal></para><para></para></entry>
-              <entry role="enum_member_description"><para>this is almost the same as @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY, with one difference: when later deleting the profile, the original profile will not be deleted. Instead a nmmeta file is written to /run to indicate that the profile is gone. Note that if such a nmmeta tombstone file exists and hides a file in persistant storage, then when re-adding the profile with the same UUID, then the original storage is taken over again.</para><para></para></entry>
+              <entry role="enum_member_description"><para>this is almost the same as %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY, with one difference: when later deleting the profile, the original profile will not be deleted. Instead a nmmeta file is written to /run to indicate that the profile is gone. Note that if such a nmmeta tombstone file exists and hides a file in persistant storage, then when re-adding the profile with the same UUID, then the original storage is taken over again.</para><para></para></entry>
             </row>
             <row role="constant">
               <entry role="enum_member_name"><para>NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY</para><para></para></entry>
               <entry role="enum_member_value"><para>= <literal>0x8</literal></para><para></para></entry>
-              <entry role="enum_member_description"><para>this is like @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY, but if the connection has a corresponding file on persistent storage, the file will be deleted right away. If the profile is later again persisted to disk, a new, unused filename will be chosen.</para><para></para></entry>
+              <entry role="enum_member_description"><para>this is like %NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY, but if the connection has a corresponding file on persistent storage, the file will be deleted right away. If the profile is later again persisted to disk, a new, unused filename will be chosen.</para><para></para></entry>
             </row>
             <row role="constant">
               <entry role="enum_member_name"><para>NM_SETTINGS_UPDATE2_FLAG_VOLATILE</para><para></para></entry>
diff --git a/libnm-core/nm-keyfile.c b/libnm-core/nm-keyfile.c
index 85a9ea11..b0c7a134 100644
--- a/libnm-core/nm-keyfile.c
+++ b/libnm-core/nm-keyfile.c
@@ -3394,10 +3394,9 @@ _read_setting_wireguard_peer (KeyfileReaderInfo *info)
 		return;
 
 	if (!nm_wireguard_peer_is_valid (peer, TRUE, TRUE, &error)) {
-		if (!handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
-		                  _("peer '%s' is invalid: %s"),
-		                  info->group, error->message))
-			return;
+		handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
+		             _("peer '%s' is invalid: %s"),
+		             info->group, error->message);
 		return;
 	}
 
diff --git a/libnm-core/nm-setting-ip6-config.c b/libnm-core/nm-setting-ip6-config.c
index bafdb373..44379ef7 100644
--- a/libnm-core/nm-setting-ip6-config.c
+++ b/libnm-core/nm-setting-ip6-config.c
@@ -666,7 +666,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass)
 
 	/* ---ifcfg-rh---
 	 * property: dhcp-hostname
-	 * variable: DHCP_HOSTNAME
+	 * variable: DHCPV6_HOSTNAME
 	 * description: Hostname to send the DHCP server.
 	 * ---end---
 	 */
diff --git a/libnm-core/nm-setting-ip6-config.h b/libnm-core/nm-setting-ip6-config.h
index bb590ae4..80449e0c 100644
--- a/libnm-core/nm-setting-ip6-config.h
+++ b/libnm-core/nm-setting-ip6-config.h
@@ -103,6 +103,8 @@ G_BEGIN_DECLS
  * NM_SETTING_IP6_CONFIG_METHOD_DISABLED:
  *
  * IPv6 is disabled for the connection.
+ *
+ * Since: 1.20
  */
 #define NM_SETTING_IP6_CONFIG_METHOD_DISABLED   "disabled"
 
diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c
index a7debbf1..d69a8946 100644
--- a/libnm-core/nm-setting-vlan.c
+++ b/libnm-core/nm-setting-vlan.c
@@ -221,7 +221,7 @@ check_replace_duplicate_priority (GSList *list, guint32 from, guint32 to)
  * the Linux SKB priorities to 802.1p priorities.
  *
  * Returns: %TRUE if the entry was successfully added to the list, or it
- * overwrote the old value, %FALSE if error
+ * overwrote the old value, %FALSE if @str is not a valid mapping.
  */
 gboolean
 nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
@@ -235,11 +235,11 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
 	g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
 	g_return_val_if_fail (str && str[0], FALSE);
 
-	list = get_map (setting, map);
-
 	item = priority_map_new_from_str (map, str);
 	if (!item)
-		g_return_val_if_reached (FALSE);
+		return FALSE;
+
+	list = get_map (setting, map);
 
 	/* Duplicates get replaced */
 	if (check_replace_duplicate_priority (list, item->from, item->to)) {
@@ -264,7 +264,7 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
  * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
  * properties of this setting.
  *
- * Returns: return the number of ingress/egress priority entries, -1 if error
+ * Returns: return the number of ingress/egress priority entries.
  **/
 gint32
 nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
@@ -280,13 +280,13 @@ nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap ma
  * @setting: the #NMSettingVlan
  * @map: the type of priority map
  * @idx: the zero-based index of the ingress/egress priority map entry
- * @out_from: (out): on return the value of the priority map's 'from' item
- * @out_to: (out): on return the value of priority map's 'to' item
+ * @out_from: (out) (allow-none): on return the value of the priority map's 'from' item
+ * @out_to: (out) (allow-none): on return the value of priority map's 'to' item
  *
  * Retrieve one of the entries of the #NMSettingVlan:ingress_priority_map
  * or #NMSettingVlan:egress_priority_map properties of this setting.
  *
- * Returns: %TRUE if a priority map was returned, %FALSE if error
+ * Returns: returns %TRUE if @idx is in range. Otherwise %FALSE.
  **/
 gboolean
 nm_setting_vlan_get_priority (NMSettingVlan *setting,
@@ -295,21 +295,23 @@ nm_setting_vlan_get_priority (NMSettingVlan *setting,
                               guint32 *out_from,
                               guint32 *out_to)
 {
-	GSList *list = NULL;
-	NMVlanQosMapping *item = NULL;
+	NMVlanQosMapping *item;
+	GSList *list;
 
 	g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
-	g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
-	g_return_val_if_fail (out_from != NULL, FALSE);
-	g_return_val_if_fail (out_to != NULL, FALSE);
+	g_return_val_if_fail (NM_IN_SET (map, NM_VLAN_INGRESS_MAP, NM_VLAN_EGRESS_MAP), FALSE);
 
 	list = get_map (setting, map);
-	g_return_val_if_fail (idx < g_slist_length (list), FALSE);
-
 	item = g_slist_nth_data (list, idx);
-	g_assert (item);
-	*out_from = item->from;
-	*out_to = item->to;
+
+	if (!item) {
+		NM_SET_OUT (out_from, 0);
+		NM_SET_OUT (out_to, 0);
+		return FALSE;
+	}
+
+	NM_SET_OUT (out_from, item->from);
+	NM_SET_OUT (out_to, item->to);
 	return TRUE;
 }
 
@@ -331,8 +333,7 @@ nm_setting_vlan_get_priority (NMSettingVlan *setting,
  * If @map is #NM_VLAN_EGRESS_MAP then @from is the Linux SKB priority value and
  * @to is the outgoing 802.1q VLAN Priority Code Point (PCP) value.
  *
- * Returns: %TRUE if the new priority mapping was successfully added to the
- * list, %FALSE if error
+ * Returns: %TRUE.
  */
 gboolean
 nm_setting_vlan_add_priority (NMSettingVlan *setting,
diff --git a/libnm-core/nm-setting-vpn.c b/libnm-core/nm-setting-vpn.c
index 56098392..fc9c5184 100644
--- a/libnm-core/nm-setting-vpn.c
+++ b/libnm-core/nm-setting-vpn.c
@@ -277,7 +277,7 @@ foreach_item_helper (NMSettingVpn *self,
 	}
 
 	for (i = 0; i < len; i++) {
-		nm_assert (keys[i]);
+		nm_assert (keys && keys[i]);
 		keys[i] = g_strdup (keys[i]);
 	}
 	nm_assert (!keys[i]);
diff --git a/libnm-core/nm-setting-wireguard.c b/libnm-core/nm-setting-wireguard.c
index 07a841f4..17c35efc 100644
--- a/libnm-core/nm-setting-wireguard.c
+++ b/libnm-core/nm-setting-wireguard.c
@@ -1922,8 +1922,8 @@ update_one_secret (NMSetting *setting,
 	i_peer = 0;
 	while (g_variant_iter_next (&iter_peers, "@a{sv}", &peer_var)) {
 		_nm_unused gs_unref_variant GVariant *peer_var_unref = peer_var;
+		nm_auto_unref_wgpeer NMWireGuardPeer *peer = NULL;
 		PeerData *pd;
-		NMWireGuardPeer *peer;
 		const char *cstr;
 
 		i_peer++;
diff --git a/libnm-core/nm-setting-wireless.h b/libnm-core/nm-setting-wireless.h
index dcb11e11..d04bad3a 100644
--- a/libnm-core/nm-setting-wireless.h
+++ b/libnm-core/nm-setting-wireless.h
@@ -126,6 +126,8 @@ typedef enum { /*< flags >*/
  * NM_SETTING_WIRELESS_MODE_MESH:
  *
  * Indicates that the connection should create a mesh point.
+ *
+ * Since: 1.20
  */
 #define NM_SETTING_WIRELESS_MODE_MESH   "mesh"
 
diff --git a/libnm-core/nm-team-utils.c b/libnm-core/nm-team-utils.c
index ac834d74..63018b09 100644
--- a/libnm-core/nm-team-utils.c
+++ b/libnm-core/nm-team-utils.c
@@ -1587,8 +1587,8 @@ nm_team_setting_config_get (const NMTeamSetting *self)
 			    || _team_setting_has_fields_any_v (self, attr_lst_runner_pt3, G_N_ELEMENTS (attr_lst_runner_pt3))) {
 				gboolean list_is_empty2 = TRUE;
 
-				if (!list_is_empty)
-					nm_json_aux_gstr_append_delimiter (gstr);
+				nm_assert (list_is_empty);
+
 				nm_json_aux_gstr_append_obj_name (gstr, "runner", '{');
 
 				if (_team_setting_fields_to_json_maybe (self, gstr, !list_is_empty2, attr_lst_runner_pt1, G_N_ELEMENTS (attr_lst_runner_pt1)))
diff --git a/libnm-core/nm-team-utils.h b/libnm-core/nm-team-utils.h
index 7da42a3f..c4631bec 100644
--- a/libnm-core/nm-team-utils.h
+++ b/libnm-core/nm-team-utils.h
@@ -61,7 +61,7 @@ typedef enum {
 	NM_TEAM_ATTRIBUTE_PORT_LACP_KEY,
 	_NM_TEAM_ATTRIBUTE_PORT_NUM,
 
-	_NM_TEAM_ATTRIBUTE_NUM = NM_CONST_MAX (_NM_TEAM_ATTRIBUTE_MASTER_NUM, _NM_TEAM_ATTRIBUTE_PORT_NUM),
+	_NM_TEAM_ATTRIBUTE_NUM = MAX (_NM_TEAM_ATTRIBUTE_MASTER_NUM, _NM_TEAM_ATTRIBUTE_PORT_NUM),
 
 } NMTeamAttribute;
 
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 55b004c8..c16c9004 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -5989,10 +5989,12 @@ _nm_utils_bridge_vlans_from_dbus (NMSetting *setting,
 		if (vid_start > vid_end)
 			continue;
 
-		g_variant_lookup (vlan_var, "pvid", "b", &pvid);
+		if (!g_variant_lookup (vlan_var, "pvid", "b", &pvid))
+			pvid = FALSE;
 		if (pvid && vid_start != vid_end)
 			continue;
-		g_variant_lookup (vlan_var, "untagged", "b", &untagged);
+		if (!g_variant_lookup (vlan_var, "untagged", "b", &untagged))
+			untagged = FALSE;
 
 		vlan = nm_bridge_vlan_new (vid_start, vid_end);
 		nm_bridge_vlan_set_untagged (vlan, untagged);