about summary refs log tree commit diff
path: root/src/libnm-core-impl
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-02-13 22:23:40 +0100
committerMichael Biebl <biebl@debian.org>2024-02-13 22:23:40 +0100
commit6681f77b757bbc42ce5c8868ee9142b7ebc8c059 (patch)
treef713e759b7c255ebeea83351f05dd466fd31422f /src/libnm-core-impl
parent70e18d99b8e3e77bb37e218d7ac582130156f8ef (diff)
New upstream version 1.45.91 upstream/1.45.91
Diffstat (limited to 'src/libnm-core-impl')
-rw-r--r--src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in13
-rw-r--r--src/libnm-core-impl/nm-setting-connection.c162
-rw-r--r--src/libnm-core-impl/nm-setting-ip-config.c53
-rw-r--r--src/libnm-core-impl/nm-setting-ip6-config.c13
-rw-r--r--src/libnm-core-impl/nm-setting-private.h24
-rw-r--r--src/libnm-core-impl/nm-setting-team.c2
-rw-r--r--src/libnm-core-impl/nm-setting-wireguard.c5
-rw-r--r--src/libnm-core-impl/nm-setting-wireless.c2
-rw-r--r--src/libnm-core-impl/nm-setting.c5
-rw-r--r--src/libnm-core-impl/nm-utils.c2
-rw-r--r--src/libnm-core-impl/tests/test-general.c4
-rw-r--r--src/libnm-core-impl/tests/test-setting.c24
12 files changed, 254 insertions, 55 deletions
diff --git a/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in b/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in
index e008b135..84220043 100644
--- a/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in
+++ b/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in
@@ -767,6 +767,10 @@
                   dbus-type="b"
                   gprop-type="gboolean"
                   />
+        <property name="autoconnect-ports"
+                  dbus-type="i"
+                  gprop-type="NMTernary"
+                  />
         <property name="autoconnect-priority"
                   dbus-type="i"
                   gprop-type="gint"
@@ -776,6 +780,7 @@
                   gprop-type="gint"
                   />
         <property name="autoconnect-slaves"
+                  is-deprecated="1"
                   dbus-type="i"
                   gprop-type="NMSettingConnectionAutoconnectSlaves"
                   />
@@ -1559,6 +1564,10 @@
                   dbus-type="s"
                   gprop-type="gchararray"
                   />
+        <property name="dhcp-dscp"
+                  dbus-type="s"
+                  gprop-type="gchararray"
+                  />
         <property name="dhcp-fqdn"
                   dbus-type="s"
                   gprop-type="gchararray"
@@ -1690,6 +1699,10 @@
                   dbus-type="i"
                   gprop-type="gint"
                   />
+        <property name="dhcp-dscp"
+                  dbus-type="s"
+                  gprop-type="gchararray"
+                  />
         <property name="dhcp-duid"
                   dbus-type="s"
                   gprop-type="gchararray"
diff --git a/src/libnm-core-impl/nm-setting-connection.c b/src/libnm-core-impl/nm-setting-connection.c
index 892e7d31..616a3e5e 100644
--- a/src/libnm-core-impl/nm-setting-connection.c
+++ b/src/libnm-core-impl/nm-setting-connection.c
@@ -60,6 +60,7 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingConnection,
                              PROP_SLAVE_TYPE,
                              PROP_PORT_TYPE,
                              PROP_AUTOCONNECT_SLAVES,
+                             PROP_AUTOCONNECT_PORTS,
                              PROP_SECONDARIES,
                              PROP_GATEWAY_PING_TIMEOUT,
                              PROP_METERED,
@@ -87,7 +88,7 @@ typedef struct {
     char       *zone;
     char       *mud_url;
     guint64     timestamp;
-    int         autoconnect_slaves;
+    int         autoconnect_ports;
     int         metered;
     gint32      autoconnect_priority;
     gint32      autoconnect_retries;
@@ -828,6 +829,25 @@ nm_setting_connection_get_wait_activation_delay(NMSettingConnection *setting)
 }
 
 /**
+ * nm_setting_connection_get_autoconnect_ports:
+ * @setting: the #NMSettingConnection
+ *
+ * Returns the #NMSettingConnection:autoconnect-ports property of the connection.
+ *
+ * Returns: whether ports of the connection should be activated together
+ *          with the connection.
+ *
+ * Since: 1.46
+ **/
+NMTernary
+nm_setting_connection_get_autoconnect_ports(NMSettingConnection *setting)
+{
+    g_return_val_if_fail(NM_IS_SETTING_CONNECTION(setting), NM_TERNARY_DEFAULT);
+
+    return NM_SETTING_CONNECTION_GET_PRIVATE(setting)->autoconnect_ports;
+}
+
+/**
  * nm_setting_connection_get_autoconnect_slaves:
  * @setting: the #NMSettingConnection
  *
@@ -837,14 +857,15 @@ nm_setting_connection_get_wait_activation_delay(NMSettingConnection *setting)
  *          with the connection.
  *
  * Since: 1.2
+ *
+ * Deprecated: 1.46. Use nm_setting_connection_get_autoconnect_ports() instead, this
+ * is just an alias.
  **/
 NMSettingConnectionAutoconnectSlaves
 nm_setting_connection_get_autoconnect_slaves(NMSettingConnection *setting)
 {
-    g_return_val_if_fail(NM_IS_SETTING_CONNECTION(setting),
-                         NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT);
-
-    return NM_SETTING_CONNECTION_GET_PRIVATE(setting)->autoconnect_slaves;
+    return (NMSettingConnectionAutoconnectSlaves) nm_setting_connection_get_autoconnect_ports(
+        setting);
 }
 
 GArray *
@@ -1911,6 +1932,24 @@ _nm_setting_connection_slave_type_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARG
     return TRUE;
 }
 
+gboolean
+_nm_setting_connection_autoconnect_slaves_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
+{
+    gint32 autoconnect;
+
+    if (!_nm_setting_use_legacy_property(setting,
+                                         connection_dict,
+                                         NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
+                                         NM_SETTING_CONNECTION_AUTOCONNECT_PORTS)) {
+        *out_is_modified = FALSE;
+        return TRUE;
+    }
+    autoconnect = g_variant_get_int32(value);
+
+    g_object_set(setting, NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, autoconnect, NULL);
+    return TRUE;
+}
+
 GVariant *
 _nm_setting_connection_port_type_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
 {
@@ -1952,6 +1991,45 @@ _nm_setting_connection_port_type_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS
     return TRUE;
 }
 
+GVariant *
+_nm_setting_connection_autoconnect_ports_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
+{
+    NMTernary autoconnect;
+
+    /* FIXME: `autoconnect-ports` is an alias of `autoconnect-slaves` property.
+     * Serializing the property to the clients would break them as they won't
+     * be able to drop it if they are not aware of the existance of
+     * `autoconnect-ports`. In order to give them time to adapt their code,
+     * NetworkManager is not serializing `autoconnect-ports` on DBus.
+     */
+    if (_nm_utils_is_manager_process) {
+        return NULL;
+    }
+
+    autoconnect = nm_setting_connection_get_autoconnect_ports(NM_SETTING_CONNECTION(setting));
+
+    return g_variant_new_int32(autoconnect);
+}
+
+gboolean
+_nm_setting_connection_autoconnect_ports_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
+{
+    NMTernary autoconnect;
+
+    /* Ignore 'autoconnect-ports' if we're going to process 'autoconnect-slaves' */
+    if (_nm_setting_use_legacy_property(setting,
+                                        connection_dict,
+                                        NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
+                                        NM_SETTING_CONNECTION_AUTOCONNECT_PORTS)) {
+        *out_is_modified = FALSE;
+        return TRUE;
+    }
+    autoconnect = g_variant_get_int32(value);
+
+    g_object_set(setting, NM_SETTING_CONNECTION_AUTOCONNECT_PORTS, autoconnect, NULL);
+    return TRUE;
+}
+
 /*****************************************************************************/
 
 static void
@@ -2458,7 +2536,8 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
         NMSettingConnectionPrivate,
         controller,
         .direct_string_allow_empty = TRUE,
-        .is_deprecated             = TRUE);
+        .is_deprecated             = TRUE,
+        .direct_is_aliased_field   = TRUE, );
 
     /**
      * NMSettingConnection:controller:
@@ -2518,8 +2597,9 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
                                            _nm_setting_connection_slave_type_from_dbus, ),
         NMSettingConnectionPrivate,
         port_type,
-        .is_deprecated             = 1,
-        .direct_string_allow_empty = TRUE);
+        .is_deprecated             = TRUE,
+        .direct_string_allow_empty = TRUE,
+        .direct_is_aliased_field   = TRUE, );
 
     /**
      * NMSettingConnection:port-type:
@@ -2564,6 +2644,8 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
      * determine the real value. If it is default as well, this fallbacks to 0.
      *
      * Since: 1.2
+     *
+     * Deprecated 1.46. Use #NMSettingConnection:autoconnect-ports instead, this is just an alias.
      **/
     /* ---ifcfg-rh---
      * property: autoconnect-slaves
@@ -2573,15 +2655,60 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
      *   when this connection is activated.
      * ---end---
      */
-    _nm_setting_property_define_direct_enum(properties_override,
-                                            obj_properties,
-                                            NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
-                                            PROP_AUTOCONNECT_SLAVES,
-                                            NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
-                                            NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT,
-                                            NM_SETTING_PARAM_FUZZY_IGNORE,
-                                            NMSettingConnectionPrivate,
-                                            autoconnect_slaves);
+    prop_idx = _nm_setting_property_define_direct_enum(
+        properties_override,
+        obj_properties,
+        NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
+        PROP_AUTOCONNECT_SLAVES,
+        NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
+        NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT,
+        NM_SETTING_PARAM_FUZZY_IGNORE,
+        NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_INT32,
+                                       .direct_type = NM_VALUE_TYPE_ENUM,
+                                       .compare_fcn = _nm_setting_property_compare_fcn_direct,
+                                       .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct,
+                                       .from_dbus_fcn =
+                                           _nm_setting_connection_autoconnect_slaves_from_dbus, ),
+        NMSettingConnectionPrivate,
+        autoconnect_ports,
+        .is_deprecated           = 1,
+        .direct_is_aliased_field = TRUE, );
+
+    /**
+     * NMSettingConnection:autoconnect-ports:
+     *
+     * Whether or not ports of this connection should be automatically brought up
+     * when NetworkManager activates this connection. This only has a real effect
+     * for controller connections. The properties #NMSettingConnection:autoconnect,
+     * #NMSettingConnection:autoconnect-priority and #NMSettingConnection:autoconnect-retries
+     * are unrelated to this setting.
+     * The permitted values are: 0: leave port connections untouched,
+     * 1: activate all the port connections with this connection, -1: default.
+     * If -1 (default) is set, global connection.autoconnect-ports is read to
+     * determine the real value. If it is default as well, this fallbacks to 0.
+     *
+     * Since: 1.46
+     **/
+    _nm_setting_property_define_direct_enum(
+        properties_override,
+        obj_properties,
+        NM_SETTING_CONNECTION_AUTOCONNECT_PORTS,
+        PROP_AUTOCONNECT_PORTS,
+        NM_TYPE_TERNARY,
+        NM_TERNARY_DEFAULT,
+        NM_SETTING_PARAM_FUZZY_IGNORE,
+        NM_SETT_INFO_PROPERT_TYPE_DBUS(
+            G_VARIANT_TYPE_INT32,
+            .direct_type   = NM_VALUE_TYPE_ENUM,
+            .compare_fcn   = _nm_setting_property_compare_fcn_direct,
+            .to_dbus_fcn   = _nm_setting_connection_autoconnect_ports_to_dbus,
+            .from_dbus_fcn = _nm_setting_connection_autoconnect_ports_from_dbus, ),
+        NMSettingConnectionPrivate,
+        autoconnect_ports,
+        .direct_also_notify = obj_properties[PROP_AUTOCONNECT_SLAVES]);
+
+    nm_g_array_index(properties_override, NMSettInfoProperty, prop_idx).direct_also_notify =
+        obj_properties[PROP_AUTOCONNECT_PORTS];
 
     /**
      * NMSettingConnection:secondaries:
@@ -2656,6 +2783,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
                                             NM_TYPE_METERED,
                                             NM_METERED_UNKNOWN,
                                             NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
+                                            NULL,
                                             NMSettingConnectionPrivate,
                                             metered);
 
diff --git a/src/libnm-core-impl/nm-setting-ip-config.c b/src/libnm-core-impl/nm-setting-ip-config.c
index bfebe7d1..8165cb2f 100644
--- a/src/libnm-core-impl/nm-setting-ip-config.c
+++ b/src/libnm-core-impl/nm-setting-ip-config.c
@@ -3993,6 +3993,7 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingIPConfig,
                              PROP_IGNORE_AUTO_ROUTES,
                              PROP_IGNORE_AUTO_DNS,
                              PROP_DHCP_HOSTNAME,
+                             PROP_DHCP_DSCP,
                              PROP_DHCP_HOSTNAME_FLAGS,
                              PROP_DHCP_SEND_HOSTNAME,
                              PROP_NEVER_DEFAULT,
@@ -5201,6 +5202,25 @@ nm_setting_ip_config_get_dhcp_send_hostname(NMSettingIPConfig *setting)
 }
 
 /**
+ * nm_setting_ip_config_get_dhcp_dscp:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:dhcp-dscp
+ * property.
+ *
+ * Returns: the value for the DSCP field for DHCP
+ *
+ * Since: 1.46
+ **/
+const char *
+nm_setting_ip_config_get_dhcp_dscp(NMSettingIPConfig *setting)
+{
+    g_return_val_if_fail(NM_IS_SETTING_IP_CONFIG(setting), NULL);
+
+    return NM_SETTING_IP_CONFIG_GET_PRIVATE(setting)->dhcp_dscp;
+}
+
+/**
  * nm_setting_ip_config_get_never_default:
  * @setting: the #NMSettingIPConfig
  *
@@ -5731,6 +5751,14 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
         }
     }
 
+    if (priv->dhcp_dscp && !nm_utils_validate_dhcp_dscp(priv->dhcp_dscp, error)) {
+        g_prefix_error(error,
+                       "%s.%s: ",
+                       nm_setting_get_name(setting),
+                       NM_SETTING_IP_CONFIG_DHCP_DSCP);
+        return FALSE;
+    }
+
     /* Normalizable errors */
     if (priv->gateway && priv->never_default) {
         g_set_error(error,
@@ -5983,6 +6011,12 @@ _nm_sett_info_property_override_create_array_ip_config(int addr_family)
         .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, dhcp_iaid),
         .direct_string_allow_empty = TRUE);
 
+    _nm_properties_override_gobj(
+        properties_override,
+        obj_properties[PROP_DHCP_DSCP],
+        &nm_sett_info_propert_type_direct_string,
+        .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, dhcp_dscp));
+
     /* ---dbus---
      * property: routing-rules
      * format: array of 'a{sv}'
@@ -6615,6 +6649,25 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
                              G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
 
     /**
+     * NMSettingIPConfig:dhcp-dscp:
+     *
+     * Specifies the value for the DSCP field (traffic class) of the IP header. When
+     * empty, the global default value is used; if no global default is specified, it is
+     * assumed to be "CS0". Allowed values are: "CS0", "CS4" and "CS6".
+     *
+     * The property is currently valid only for IPv4, and it is supported only by the
+     * "internal" DHCP plugin.
+     *
+     * Since: 1.46
+     **/
+    obj_properties[PROP_DHCP_DSCP] =
+        g_param_spec_string(NM_SETTING_IP_CONFIG_DHCP_DSCP,
+                            "",
+                            "",
+                            NULL,
+                            G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
+    /**
      * NMSettingIPConfig:never-default:
      *
      * If %TRUE, this connection will never be the default connection for this
diff --git a/src/libnm-core-impl/nm-setting-ip6-config.c b/src/libnm-core-impl/nm-setting-ip6-config.c
index 4ad09932..fc0744ad 100644
--- a/src/libnm-core-impl/nm-setting-ip6-config.c
+++ b/src/libnm-core-impl/nm-setting-ip6-config.c
@@ -386,6 +386,18 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
         }
     }
 
+    if (nm_setting_ip_config_get_dhcp_dscp(s_ip)) {
+        g_set_error_literal(error,
+                            NM_CONNECTION_ERROR,
+                            NM_CONNECTION_ERROR_INVALID_PROPERTY,
+                            _("DHCP DSCP is not supported for IPv6"));
+        g_prefix_error(error,
+                       "%s.%s: ",
+                       NM_SETTING_IP6_CONFIG_SETTING_NAME,
+                       NM_SETTING_IP_CONFIG_DHCP_DSCP);
+        return FALSE;
+    }
+
     /* Failures from here on, are NORMALIZABLE_ERROR... */
 
     if (token_needs_normalization) {
@@ -936,6 +948,7 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
                                             NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
                                             NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
                                             NM_SETTING_PARAM_NONE,
+                                            NULL,
                                             NMSettingIP6ConfigPrivate,
                                             ip6_privacy);
 
diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h
index 9fe49de4..6bad516e 100644
--- a/src/libnm-core-impl/nm-setting-private.h
+++ b/src/libnm-core-impl/nm-setting-private.h
@@ -185,6 +185,7 @@ typedef struct {
     char       *gateway;
     char       *dhcp_hostname;
     char       *dhcp_iaid;
+    char       *dhcp_dscp;
     gint64      route_metric;
     int         auto_route_ext_gw;
     int         replace_local_rule;
@@ -411,6 +412,15 @@ GVariant *_nm_setting_connection_port_type_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FC
 
 gboolean _nm_setting_connection_slave_type_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
 
+gboolean
+_nm_setting_connection_autoconnect_ports_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
+
+GVariant *
+_nm_setting_connection_autoconnect_ports_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
+
+gboolean
+_nm_setting_connection_autoconnect_slaves_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
+
 GVariant *_nm_setting_to_dbus(NMSetting                              *setting,
                               NMConnection                           *connection,
                               NMConnectionSerializationFlags          flags,
@@ -901,12 +911,13 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
                                                 gtype_enum,                                      \
                                                 default_value,                                   \
                                                 param_flags,                                     \
+                                                property_type,                                   \
                                                 private_struct_type,                             \
                                                 private_struct_field,                            \
                                                 ... /* extra NMSettInfoProperty fields */)       \
-    G_STMT_START                                                                                 \
-    {                                                                                            \
-        GParamSpec *_param_spec;                                                                 \
+    ({                                                                                           \
+        GParamSpec                  *_param_spec;                                                \
+        const NMSettInfoPropertType *_property_type;                                             \
                                                                                                  \
         G_STATIC_ASSERT(                                                                         \
             !NM_FLAGS_ANY((param_flags),                                                         \
@@ -922,16 +933,16 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
                                             | G_PARAM_STATIC_STRINGS | (param_flags));           \
                                                                                                  \
         (obj_properties)[(prop_id)] = _param_spec;                                               \
+        _property_type              = (property_type) ?: &nm_sett_info_propert_type_direct_enum; \
                                                                                                  \
         _nm_properties_override_gobj(                                                            \
             (properties_override),                                                               \
             _param_spec,                                                                         \
-            &nm_sett_info_propert_type_direct_enum,                                              \
+            _property_type,                                                                      \
             .direct_offset =                                                                     \
                 NM_STRUCT_OFFSET_ENSURE_TYPE(int, private_struct_type, private_struct_field),    \
             __VA_ARGS__);                                                                        \
-    }                                                                                            \
-    G_STMT_END
+    })
 
 /*****************************************************************************/
 
@@ -950,6 +961,7 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
                                             NM_TYPE_TERNARY,                  \
                                             NM_TERNARY_DEFAULT,               \
                                             (param_flags),                    \
+                                            NULL,                             \
                                             private_struct_type,              \
                                             private_struct_field,             \
                                             __VA_ARGS__)
diff --git a/src/libnm-core-impl/nm-setting-team.c b/src/libnm-core-impl/nm-setting-team.c
index 2195757f..191ed9ae 100644
--- a/src/libnm-core-impl/nm-setting-team.c
+++ b/src/libnm-core-impl/nm-setting-team.c
@@ -123,6 +123,7 @@ nm_team_link_watcher_new_ethtool(int delay_up, int delay_down, GError **error)
     }
 
     NM_PRAGMA_WARNING_DISABLE("-Warray-bounds")
+    NM_PRAGMA_WARNING_DISABLE("-Walloc-size")
 
     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
 
@@ -132,6 +133,7 @@ nm_team_link_watcher_new_ethtool(int delay_up, int delay_down, GError **error)
     watcher->ethtool.delay_down = delay_down;
 
     NM_PRAGMA_WARNING_REENABLE
+    NM_PRAGMA_WARNING_REENABLE
 
     return watcher;
 }
diff --git a/src/libnm-core-impl/nm-setting-wireguard.c b/src/libnm-core-impl/nm-setting-wireguard.c
index 1e7ed05b..c313d22c 100644
--- a/src/libnm-core-impl/nm-setting-wireguard.c
+++ b/src/libnm-core-impl/nm-setting-wireguard.c
@@ -311,10 +311,9 @@ _nm_wireguard_peer_set_public_key_bin(NMWireGuardPeer *self,
 {
     g_return_if_fail(NM_IS_WIREGUARD_PEER(self, FALSE));
 
-    nm_clear_g_free(&self->public_key);
+    nm_assert(public_key);
 
-    if (!public_key)
-        return;
+    nm_clear_g_free(&self->public_key);
 
     self->public_key       = g_base64_encode(public_key, NM_WIREGUARD_PUBLIC_KEY_LEN);
     self->public_key_valid = TRUE;
diff --git a/src/libnm-core-impl/nm-setting-wireless.c b/src/libnm-core-impl/nm-setting-wireless.c
index 152bbde3..244dcdcc 100644
--- a/src/libnm-core-impl/nm-setting-wireless.c
+++ b/src/libnm-core-impl/nm-setting-wireless.c
@@ -600,7 +600,7 @@ nm_setting_wireless_remove_mac_blacklist_item_by_value(NMSettingWireless *settin
     priv = NM_SETTING_WIRELESS_GET_PRIVATE(setting);
     for (i = 0; i < priv->mac_address_blacklist->len; i++) {
         candidate = nm_g_array_index(priv->mac_address_blacklist, char *, i);
-        if (!nm_utils_hwaddr_matches(mac, -1, candidate, -1)) {
+        if (nm_utils_hwaddr_matches(mac, -1, candidate, -1)) {
             g_array_remove_index(priv->mac_address_blacklist, i);
             _notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
             return TRUE;
diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c
index 758338e5..e6e4d23b 100644
--- a/src/libnm-core-impl/nm-setting.c
+++ b/src/libnm-core-impl/nm-setting.c
@@ -1077,7 +1077,7 @@ _init_direct(NMSetting *setting)
             int  def_val;
 
             def_val = NM_G_PARAM_SPEC_GET_DEFAULT_ENUM(property_info->param_spec);
-            nm_assert(*p_val == 0);
+            nm_assert(NM_IN_SET(*p_val, 0, property_info->direct_is_aliased_field ? def_val : 0));
             *p_val = def_val;
             break;
         }
@@ -2638,7 +2638,8 @@ _nm_setting_property_compare_fcn_direct(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_
                         _nm_setting_property_to_dbus_fcn_direct,
                         _nm_setting_property_to_dbus_fcn_direct_mac_address,
                         _nm_setting_connection_controller_to_dbus,
-                        _nm_setting_connection_port_type_to_dbus));
+                        _nm_setting_connection_port_type_to_dbus,
+                        _nm_setting_connection_autoconnect_ports_to_dbus));
 
     if (!property_info->param_spec)
         return nm_assert_unreachable_val(NM_TERNARY_DEFAULT);
diff --git a/src/libnm-core-impl/nm-utils.c b/src/libnm-core-impl/nm-utils.c
index 88df3291..761f74bd 100644
--- a/src/libnm-core-impl/nm-utils.c
+++ b/src/libnm-core-impl/nm-utils.c
@@ -5008,7 +5008,7 @@ nm_utils_bond_mode_string_to_int(const char *mode)
 
 struct _NMUtilsStrStrDictKey {
     char type;
-    char data[1];
+    char data[];
 };
 
 guint
diff --git a/src/libnm-core-impl/tests/test-general.c b/src/libnm-core-impl/tests/test-general.c
index 4acf33e0..bf0f272c 100644
--- a/src/libnm-core-impl/tests/test-general.c
+++ b/src/libnm-core-impl/tests/test-general.c
@@ -3962,7 +3962,7 @@ typedef struct {
 
 typedef struct {
     const char *name;
-    DiffKey     keys[31];
+    DiffKey     keys[32];
 } DiffSetting;
 
 #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
@@ -4023,6 +4023,7 @@ test_connection_diff_a_only(void)
           {NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_DIFF_RESULT_IN_A},
           {NM_SETTING_CONNECTION_PORT_TYPE, NM_SETTING_DIFF_RESULT_IN_A},
           {NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, NM_SETTING_DIFF_RESULT_IN_A},
+          {NM_SETTING_CONNECTION_AUTOCONNECT_PORTS, NM_SETTING_DIFF_RESULT_IN_A},
           {NM_SETTING_CONNECTION_SECONDARIES, NM_SETTING_DIFF_RESULT_IN_A},
           {NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A},
           {NM_SETTING_CONNECTION_METERED, NM_SETTING_DIFF_RESULT_IN_A},
@@ -4081,6 +4082,7 @@ test_connection_diff_a_only(void)
              {NM_SETTING_IP_CONFIG_REQUIRED_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A},
              {NM_SETTING_IP_CONFIG_DNS_PRIORITY, NM_SETTING_DIFF_RESULT_IN_A},
              {NM_SETTING_IP_CONFIG_DHCP_IAID, NM_SETTING_DIFF_RESULT_IN_A},
+             {NM_SETTING_IP_CONFIG_DHCP_DSCP, NM_SETTING_DIFF_RESULT_IN_A},
              {NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER, NM_SETTING_DIFF_RESULT_IN_A},
              {NM_SETTING_IP_CONFIG_DHCP_REJECT_SERVERS, NM_SETTING_DIFF_RESULT_IN_A},
              {NM_SETTING_IP4_CONFIG_LINK_LOCAL, NM_SETTING_DIFF_RESULT_IN_A},
diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c
index 4b1aa2c1..72b855a5 100644
--- a/src/libnm-core-impl/tests/test-setting.c
+++ b/src/libnm-core-impl/tests/test-setting.c
@@ -4664,10 +4664,7 @@ test_setting_metadata(void)
             } else if (sip->property_type->direct_type == NM_VALUE_TYPE_ENUM) {
                 const GParamSpecEnum *pspec;
 
-                g_assert(sip->property_type == &nm_sett_info_propert_type_direct_enum);
                 g_assert(g_variant_type_equal(sip->property_type->dbus_type, "i"));
-                g_assert(sip->property_type->to_dbus_fcn
-                         == _nm_setting_property_to_dbus_fcn_direct);
                 g_assert(sip->param_spec);
                 g_assert(g_type_is_a(sip->param_spec->value_type, G_TYPE_ENUM));
                 g_assert(sip->param_spec->value_type != G_TYPE_ENUM);
@@ -4706,10 +4703,6 @@ test_setting_metadata(void)
                                        INFINIBAND_ALEN));
                 } else {
                     g_assert(g_variant_type_equal(sip->property_type->dbus_type, "s"));
-                    g_assert(NM_IN_SET(sip->property_type->to_dbus_fcn,
-                                       _nm_setting_property_to_dbus_fcn_direct,
-                                       _nm_setting_connection_controller_to_dbus,
-                                       _nm_setting_connection_port_type_to_dbus));
                     can_have_direct_set_fcn = TRUE;
                 }
                 g_assert(sip->param_spec);
@@ -4847,18 +4840,6 @@ check_done:;
 
             if (sip->property_type->from_dbus_fcn == _nm_setting_property_from_dbus_fcn_gprop)
                 g_assert(sip->param_spec);
-            if (sip->property_type->from_dbus_fcn) {
-                if (sip->property_type->direct_type != NM_VALUE_TYPE_NONE) {
-                    g_assert(NM_IN_SET(sip->property_type->from_dbus_fcn,
-                                       _nm_setting_property_from_dbus_fcn_direct_ip_config_gateway,
-                                       _nm_setting_property_from_dbus_fcn_direct_mac_address,
-                                       _nm_setting_connection_controller_from_dbus,
-                                       _nm_setting_connection_master_from_dbus,
-                                       _nm_setting_connection_slave_type_from_dbus,
-                                       _nm_setting_connection_port_type_from_dbus,
-                                       _nm_setting_property_from_dbus_fcn_direct));
-                }
-            }
 
             g_assert(sip->property_type->from_dbus_is_full
                      == NM_IN_SET(sip->property_type->from_dbus_fcn,
@@ -4875,11 +4856,6 @@ check_done:;
             } else if (sip->property_type->compare_fcn == _nm_setting_property_compare_fcn_direct) {
                 g_assert(sip->param_spec);
                 g_assert(sip->property_type->direct_type != NM_VALUE_TYPE_NONE);
-                g_assert(NM_IN_SET(sip->property_type->to_dbus_fcn,
-                                   _nm_setting_property_to_dbus_fcn_direct,
-                                   _nm_setting_property_to_dbus_fcn_direct_mac_address,
-                                   _nm_setting_connection_controller_to_dbus,
-                                   _nm_setting_connection_port_type_to_dbus));
             } else if (sip->property_type->compare_fcn == _nm_setting_property_compare_fcn_ignore) {
                 if (NM_IN_SET(sip->property_type,
                               &nm_sett_info_propert_type_deprecated_ignore_i,