about summary refs log tree commit diff
path: root/libnm-core/nm-utils-private.h
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2019-05-10 15:07:08 +0200
committerSebastien Bacher <seb128@ubuntu.com>2019-05-22 13:41:30 +0200
commitd57a1dd26f8e9859252b0983c2d2ec3b95eb5714 (patch)
tree46f1146e87af8cc7b58b751f7e575bd0abb2f59d /libnm-core/nm-utils-private.h
parentad9ed8bfb963266b4eea524131845f406cfc55d7 (diff)
parent85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (diff)
Import Debian changes 1.18.0-1ubuntu1
network-manager (1.18.0-1ubuntu1) eoan; urgency=medium

  * Update to 1.18, merge on Debian, new version includes nwe support for
    policy routing rules and for VLAN filtering for Linux bridge.
  * Remaining Ubuntu changes
    - Use systemd-resolved instead of dnsmasq
    - debian/control:
      + Depend on isc-dhcp-client instead of recommends
      + Recommend network-manager-pptp
      + Suggest avahi-autoipd for IPv4LL support
    - debian/rules, debian/network-manager.postinst:
      + Don't restart NetworkManager on upgrade but recommend restarting
        the computer
    - debian/rules, debian/network-manager.postinst:
      + Don't install sysvinit scripts or migrate from sysvinit
    - debian/network-manager.postinst:
      + Don't add the netdev group.
      + drop in an empty override file for NetworkManager to manage all
        devices for upgrade from any version, as long as there is no
        netplan configuration yet.
    - debian/default-wifi-powersave-on.conf, debian/rules:
      + Install a config file to enable WiFi powersave
    - Enable build tests
    - Add autopkgtests
    - debian/source_network-manager.py, debian/network-manager.install,
      debian/network-manager.links: Add apport hook
    - Add network-manager-config-connectivity-ubuntu package
    - NetworkManager.conf: disable MAC randomization feature. There is no
      easy way for desktop users to disable this feature yet. And there are
      reports that it doesn't work well with some systems.
    - Update Vcs links to point to Ubuntu branch
    - Add patches. See patch descriptions for more details:
      + Provide-access-to-some-of-NM-s-interfaces-to-whoopsie.patch
      + Update-dnsmasq-parameters.patch
      + Disable-general-with-expect.patch
      + libnm-Check-self-still-NMManager-or-not.patch
      + dns-manager-don-t-merge-split-DNS-search-domains.patch (but disabled)
      + Read-system-connections-from-run.patch
    - debian/tests/urfkill-integration - don't stop/start network manager
    - Revert "Add Conflicts to network-manager-dev against deprecated libraries"
      This reverts commit b4acc5e03e2b821e1cccc69529bb70826c741942.  We're still
      building libnm-glib for now, so these packages have a use in Ubuntu.
  * Removed delta, not needed anymore
    - debian/network-manager.maintscript
      + Remove /etc/dbus-1/system.d/nm-ofono.conf
Diffstat (limited to 'libnm-core/nm-utils-private.h')
-rw-r--r--libnm-core/nm-utils-private.h80
1 files changed, 46 insertions, 34 deletions
diff --git a/libnm-core/nm-utils-private.h b/libnm-core/nm-utils-private.h
index 46af26ed..a1a1369a 100644
--- a/libnm-core/nm-utils-private.h
+++ b/libnm-core/nm-utils-private.h
@@ -103,8 +103,31 @@ void        _nm_utils_format_variant_attributes_full (GString *str,
                                                       char key_value_separator);
 gboolean    _nm_sriov_vf_parse_vlans (NMSriovVF *vf, const char *str, GError **error);
 
+GVariant *  _nm_utils_bridge_vlans_to_dbus (NMSetting *setting, const char *property);
+gboolean    _nm_utils_bridge_vlans_from_dbus (NMSetting *setting,
+                                              GVariant *connection_dict,
+                                              const char *property,
+                                              GVariant *value,
+                                              NMSettingParseFlags parse_flags,
+                                              GError **error);
+gboolean    _nm_utils_bridge_vlan_verify_list (GPtrArray *vlans,
+                                               gboolean check_normalizable,
+                                               GError **error,
+                                               const char *setting,
+                                               const char *property);
+
 /* JSON to GValue conversion macros */
 
+static inline void
+_nm_auto_unset_and_free_gvalue (GValue **ptr)
+{
+	if (*ptr) {
+		g_value_unset (*ptr);
+		g_free (*ptr);
+	}
+}
+#define nm_auto_unset_and_free_gvalue nm_auto(_nm_auto_unset_and_free_gvalue)
+
 typedef struct {
 	const char *key1;
 	const char *key2;
@@ -121,16 +144,13 @@ _nm_utils_json_extract_int (char *conf,
                             _NMUtilsTeamPropertyKeys key,
                             gboolean is_port)
 {
-	gs_free GValue *t_value = NULL;
-	int ret;
+	nm_auto_unset_and_free_gvalue GValue *t_value = NULL;
 
 	t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port);
-	if (!t_value)
+	if (   !t_value
+	    || !G_VALUE_HOLDS_INT (t_value))
 		return key.default_int;
-
-	ret = g_value_get_int (t_value);
-	g_value_unset (t_value);
-	return ret;
+	return g_value_get_int (t_value);
 }
 
 static inline gboolean
@@ -138,16 +158,13 @@ _nm_utils_json_extract_boolean (char *conf,
                                 _NMUtilsTeamPropertyKeys key,
                                 gboolean is_port)
 {
-	gs_free GValue *t_value = NULL;
-	gboolean ret;
+	nm_auto_unset_and_free_gvalue GValue *t_value = NULL;
 
 	t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port);
-	if (!t_value)
+	if (   !t_value
+	    || !G_VALUE_HOLDS_BOOLEAN (t_value))
 		return key.default_bool;
-
-	ret = g_value_get_boolean (t_value);
-	g_value_unset (t_value);
-	return ret;
+	return g_value_get_boolean (t_value);
 }
 
 static inline char *
@@ -155,16 +172,13 @@ _nm_utils_json_extract_string (char *conf,
                                _NMUtilsTeamPropertyKeys key,
                                gboolean is_port)
 {
-	gs_free GValue *t_value = NULL;
-	char *ret;
+	nm_auto_unset_and_free_gvalue GValue *t_value = NULL;
 
 	t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port);
-	if (!t_value)
+	if (   !t_value
+	    || !G_VALUE_HOLDS_STRING (t_value))
 		return g_strdup (key.default_str);
-
-	ret = g_value_dup_string (t_value);
-	g_value_unset (t_value);
-	return ret;
+	return g_value_dup_string (t_value);
 }
 
 static inline char **
@@ -172,39 +186,37 @@ _nm_utils_json_extract_strv (char *conf,
                              _NMUtilsTeamPropertyKeys key,
                              gboolean is_port)
 {
-	gs_free GValue *t_value = NULL;
-	char **ret;
+	nm_auto_unset_and_free_gvalue GValue *t_value = NULL;
 
 	t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port);
-	if (!t_value)
+	if (   !t_value
+	    || !G_TYPE_CHECK_VALUE_TYPE (t_value, G_TYPE_STRV))
 		return NULL;
-
-	ret = g_strdupv (g_value_get_boxed (t_value));
-	g_value_unset (t_value);
-	return ret;
+	return    g_strdupv (g_value_get_boxed (t_value))
+	       ?: g_new0 (char *, 1);
 }
 
 static inline GPtrArray *
 _nm_utils_json_extract_ptr_array (char *conf,
-                             _NMUtilsTeamPropertyKeys key,
-                             gboolean is_port)
+                                  _NMUtilsTeamPropertyKeys key,
+                                  gboolean is_port)
 {
-	gs_free GValue *t_value = NULL;
+	nm_auto_unset_and_free_gvalue GValue *t_value = NULL;
 	GPtrArray *data, *ret;
 	guint i;
 
 	ret = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_team_link_watcher_unref);
+
 	t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port);
-	if (!t_value)
+	if (   !t_value
+	    || !G_TYPE_CHECK_VALUE_TYPE (t_value, G_TYPE_PTR_ARRAY))
 		return ret;
 
 	data = g_value_get_boxed (t_value);
 	if (!data)
 		return ret;
-
 	for (i = 0; i < data->len; i++)
 		g_ptr_array_add (ret, nm_team_link_watcher_dup (data->pdata[i]));
-	g_value_unset (t_value);
 	return ret;
 }