libnm: always initialize default values for "direct" properties

We encode the default value "direct" properties in the GParamSpec.
But we also avoid CONSTRUCT properties, because they have an overhead
and they are generally odd for the settings.

So up to now, it was cumbersome to explicitly set the default value,
but it was also error prone.

Avoid that by always initializing the default value for our "direct"
properties.
This commit is contained in:
Thomas Haller
2021-06-29 08:52:02 +02:00
parent 3c801ec4f3
commit 56241f328f
11 changed files with 93 additions and 35 deletions

View File

@@ -1564,19 +1564,13 @@ nm_setting_bridge_init(NMSettingBridge *setting)
priv->multicast_last_member_interval = NM_BRIDGE_MULTICAST_LAST_MEMBER_INTERVAL_DEF;
priv->multicast_membership_interval = NM_BRIDGE_MULTICAST_MEMBERSHIP_INTERVAL_DEF;
priv->multicast_hash_max = NM_BRIDGE_MULTICAST_HASH_MAX_DEF;
priv->multicast_snooping = NM_BRIDGE_MULTICAST_SNOOPING_DEF;
priv->priority = NM_BRIDGE_PRIORITY_DEF;
priv->stp = NM_BRIDGE_STP_DEF;
priv->vlan_default_pvid = NM_BRIDGE_VLAN_DEFAULT_PVID_DEF;
priv->multicast_query_interval = NM_BRIDGE_MULTICAST_QUERY_INTERVAL_DEF;
priv->multicast_query_response_interval = NM_BRIDGE_MULTICAST_QUERY_RESPONSE_INTERVAL_DEF;
priv->multicast_querier_interval = NM_BRIDGE_MULTICAST_QUERIER_INTERVAL_DEF;
priv->multicast_startup_query_count = NM_BRIDGE_MULTICAST_STARTUP_QUERY_COUNT_DEF;
priv->multicast_startup_query_interval = NM_BRIDGE_MULTICAST_STARTUP_QUERY_INTERVAL_DEF;
nm_assert(priv->multicast_querier == NM_BRIDGE_MULTICAST_QUERIER_DEF);
nm_assert(priv->multicast_query_use_ifaddr == NM_BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEF);
nm_assert(priv->vlan_stats_enabled == NM_BRIDGE_VLAN_STATS_ENABLED_DEF);
}
/**