mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-15 06:50:35 +01:00
libm: merge branch 'th/setting-update-one-secret'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/942
This commit is contained in:
commit
b13dfcbc5b
29 changed files with 351 additions and 846 deletions
|
|
@ -1090,13 +1090,7 @@ options_equal(NMSettingBond *s_bond, NMSettingBond *s_bond2, NMSettingCompareFla
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_options(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_options(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return (!set_b || options_equal(NM_SETTING_BOND(set_a), NM_SETTING_BOND(set_b), flags));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,13 +368,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_vlans(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_vlans(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (set_b) {
|
||||
return _nm_utils_bridge_compare_vlans(NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_a)->vlans,
|
||||
|
|
|
|||
|
|
@ -1315,13 +1315,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_vlans(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_vlans(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (set_b) {
|
||||
return _nm_utils_bridge_compare_vlans(NM_SETTING_BRIDGE_GET_PRIVATE(set_a)->vlans,
|
||||
|
|
|
|||
|
|
@ -621,12 +621,7 @@ nm_setting_connection_get_timestamp(NMSettingConnection *setting)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
_to_dbus_fcn_timestamp(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_to_dbus_fcn_timestamp(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
guint64 v;
|
||||
|
||||
|
|
@ -1540,11 +1535,7 @@ find_virtual_interface_name(GVariant *connection_dict, GVariant **variant_to_fre
|
|||
}
|
||||
|
||||
static gboolean
|
||||
nm_setting_connection_no_interface_name(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
nm_setting_connection_no_interface_name(_NM_SETT_INFO_PROP_MISSING_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
const char * virtual_interface_name;
|
||||
gs_unref_variant GVariant *variant_to_free = NULL;
|
||||
|
|
@ -1558,13 +1549,7 @@ nm_setting_connection_no_interface_name(NMSetting * setting,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_id(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_id(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_ID))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
|
@ -1579,13 +1564,7 @@ compare_fcn_id(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_timestamp(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_timestamp(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
|
|
|||
|
|
@ -745,13 +745,13 @@ set_gvalue_from_array(GValue *v, uint *a, size_t len)
|
|||
#define SET_GVALUE_FROM_ARRAY(v, a) set_gvalue_from_array(v, a, G_N_ELEMENTS(a))
|
||||
|
||||
static void
|
||||
_nm_setting_dcb_uint_array_from_dbus(GVariant *dbus_value, GValue *prop_value)
|
||||
_nm_setting_dcb_uint_array_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gconstpointer array;
|
||||
gsize length;
|
||||
|
||||
array = g_variant_get_fixed_array(dbus_value, &length, sizeof(guint32));
|
||||
set_gvalue_from_array(prop_value, (guint *) array, length);
|
||||
array = g_variant_get_fixed_array(from, &length, sizeof(guint32));
|
||||
set_gvalue_from_array(to, (guint *) array, length);
|
||||
}
|
||||
|
||||
static const NMSettInfoPropertType nm_sett_info_propert_type_dcb_au =
|
||||
|
|
|
|||
|
|
@ -4949,12 +4949,7 @@ nm_setting_ip_config_clear_routing_rules(NMSettingIPConfig *setting)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
_routing_rules_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_routing_rules_dbus_only_synth(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingIPConfig * self = NM_SETTING_IP_CONFIG(setting);
|
||||
NMSettingIPConfigPrivate *priv;
|
||||
|
|
@ -4985,13 +4980,7 @@ _routing_rules_dbus_only_synth(const NMSettInfoSetting * sett_info
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_routing_rules_dbus_only_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_routing_rules_dbus_only_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GVariantIter iter_rules;
|
||||
GVariant * rule_var;
|
||||
|
|
@ -5035,6 +5024,7 @@ _routing_rules_dbus_only_set(const NMSettInfoSetting * sett_info,
|
|||
success = TRUE;
|
||||
|
||||
out:
|
||||
*out_is_modified = rules_changed;
|
||||
if (rules_changed)
|
||||
_routing_rules_notify(NM_SETTING_IP_CONFIG(setting));
|
||||
return success;
|
||||
|
|
@ -5627,13 +5617,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
NMTernary
|
||||
_nm_setting_ip_config_compare_fcn_addresses(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
_nm_setting_ip_config_compare_fcn_addresses(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingIPConfigPrivate *a_priv;
|
||||
NMSettingIPConfigPrivate *b_priv;
|
||||
|
|
@ -5657,13 +5641,7 @@ _nm_setting_ip_config_compare_fcn_addresses(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
NMTernary
|
||||
_nm_setting_ip_config_compare_fcn_routes(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
_nm_setting_ip_config_compare_fcn_routes(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingIPConfigPrivate *a_priv;
|
||||
NMSettingIPConfigPrivate *b_priv;
|
||||
|
|
@ -5686,13 +5664,7 @@ _nm_setting_ip_config_compare_fcn_routes(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_routing_rules(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_routing_rules(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingIPConfigPrivate *a_priv;
|
||||
NMSettingIPConfigPrivate *b_priv;
|
||||
|
|
@ -5776,13 +5748,8 @@ enumerate_values(const NMSettInfoProperty *property_info,
|
|||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_direct_ip_config_gateway(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_setting_property_from_dbus_fcn_direct_ip_config_gateway(
|
||||
_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
/* Don't set from 'gateway' if we're going to use the gateway in 'addresses' */
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "gateway"))
|
||||
|
|
@ -5794,6 +5761,7 @@ _nm_setting_property_from_dbus_fcn_direct_ip_config_gateway(const NMSettInfoSett
|
|||
connection_dict,
|
||||
value,
|
||||
parse_flags,
|
||||
out_is_modified,
|
||||
error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -322,12 +322,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip4_dns_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip4_dns_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *dns;
|
||||
|
||||
|
|
@ -340,18 +335,13 @@ ip4_dns_to_dbus(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static void
|
||||
ip4_dns_from_dbus(GVariant *dbus_value, GValue *prop_value)
|
||||
ip4_dns_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil)
|
||||
{
|
||||
g_value_take_boxed(prop_value, nm_utils_ip4_dns_from_variant(dbus_value));
|
||||
g_value_take_boxed(to, nm_utils_ip4_dns_from_variant(from));
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
ip4_addresses_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip4_addresses_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *addrs = NULL;
|
||||
const char * gateway;
|
||||
|
|
@ -362,13 +352,7 @@ ip4_addresses_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip4_addresses_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip4_addresses_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *addrs;
|
||||
GVariant * s_ip4;
|
||||
|
|
@ -377,8 +361,10 @@ ip4_addresses_set(const NMSettInfoSetting * sett_info,
|
|||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data"))
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
addrs = nm_utils_ip4_addresses_from_variant(value, &gateway);
|
||||
|
||||
|
|
@ -407,12 +393,7 @@ ip4_addresses_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip4_address_labels_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip4_address_labels_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG(setting);
|
||||
gboolean have_labels = FALSE;
|
||||
|
|
@ -451,12 +432,7 @@ ip4_address_labels_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip4_address_data_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip4_address_data_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *addrs = NULL;
|
||||
|
||||
|
|
@ -468,21 +444,17 @@ ip4_address_data_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip4_address_data_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip4_address_data_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *addrs;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
/* Ignore 'address-data' if we're going to process 'addresses' */
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data"))
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
addrs = nm_utils_ip_addresses_from_variant(value, AF_INET);
|
||||
g_object_set(setting, NM_SETTING_IP_CONFIG_ADDRESSES, addrs, NULL);
|
||||
|
|
@ -491,12 +463,7 @@ ip4_address_data_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip4_routes_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip4_routes_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *routes = NULL;
|
||||
|
||||
|
|
@ -505,20 +472,16 @@ ip4_routes_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip4_routes_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip4_routes_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *routes;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data"))
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
routes = nm_utils_ip4_routes_from_variant(value);
|
||||
g_object_set(setting, property_info->name, routes, NULL);
|
||||
|
|
@ -527,12 +490,7 @@ ip4_routes_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip4_route_data_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip4_route_data_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *routes = NULL;
|
||||
|
||||
|
|
@ -544,21 +502,17 @@ ip4_route_data_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip4_route_data_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip4_route_data_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *routes;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
/* Ignore 'route-data' if we're going to process 'routes' */
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data"))
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
routes = nm_utils_ip_routes_from_variant(value, AF_INET);
|
||||
g_object_set(setting, NM_SETTING_IP_CONFIG_ROUTES, routes, NULL);
|
||||
|
|
|
|||
|
|
@ -363,12 +363,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip6_dns_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip6_dns_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *dns;
|
||||
|
||||
|
|
@ -381,18 +376,13 @@ ip6_dns_to_dbus(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static void
|
||||
ip6_dns_from_dbus(GVariant *dbus_value, GValue *prop_value)
|
||||
ip6_dns_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil)
|
||||
{
|
||||
g_value_take_boxed(prop_value, nm_utils_ip6_dns_from_variant(dbus_value));
|
||||
g_value_take_boxed(to, nm_utils_ip6_dns_from_variant(from));
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
ip6_addresses_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip6_addresses_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *addrs = NULL;
|
||||
const char * gateway;
|
||||
|
|
@ -403,21 +393,15 @@ ip6_addresses_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip6_addresses_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip6_addresses_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *addrs;
|
||||
char * gateway = NULL;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data"))
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
addrs = nm_utils_ip6_addresses_from_variant(value, &gateway);
|
||||
|
||||
|
|
@ -433,12 +417,7 @@ ip6_addresses_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip6_address_data_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip6_address_data_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *addrs = NULL;
|
||||
|
||||
|
|
@ -450,21 +429,15 @@ ip6_address_data_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip6_address_data_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip6_address_data_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *addrs;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
/* Ignore 'address-data' if we're going to process 'addresses' */
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data"))
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
addrs = nm_utils_ip_addresses_from_variant(value, AF_INET6);
|
||||
g_object_set(setting, NM_SETTING_IP_CONFIG_ADDRESSES, addrs, NULL);
|
||||
|
|
@ -473,12 +446,7 @@ ip6_address_data_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip6_routes_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip6_routes_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *routes = NULL;
|
||||
|
||||
|
|
@ -487,20 +455,14 @@ ip6_routes_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip6_routes_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip6_routes_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *routes;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data"))
|
||||
if (!_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
routes = nm_utils_ip6_routes_from_variant(value);
|
||||
g_object_set(setting, property_info->name, routes, NULL);
|
||||
|
|
@ -509,12 +471,7 @@ ip6_routes_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
ip6_route_data_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
ip6_route_data_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *routes = NULL;
|
||||
|
||||
|
|
@ -526,21 +483,15 @@ ip6_route_data_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ip6_route_data_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
ip6_route_data_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *routes;
|
||||
|
||||
/* FIXME: properly handle errors */
|
||||
|
||||
/* Ignore 'route-data' if we're going to process 'routes' */
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data"))
|
||||
if (_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
routes = nm_utils_ip_routes_from_variant(value, AF_INET6);
|
||||
g_object_set(setting, NM_SETTING_IP_CONFIG_ROUTES, routes, NULL);
|
||||
|
|
|
|||
|
|
@ -387,13 +387,7 @@ connection_type_is_good:
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_data(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_data(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingOvsExternalIDsPrivate *priv;
|
||||
NMSettingOvsExternalIDsPrivate *pri2;
|
||||
|
|
|
|||
|
|
@ -311,29 +311,11 @@ gboolean _nm_setting_compare_flags_check(const GParamSpec * param_spec,
|
|||
NMSetting * set_a,
|
||||
NMSetting * set_b);
|
||||
|
||||
NMTernary _nm_setting_property_compare_fcn_ignore(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
NMTernary _nm_setting_property_compare_fcn_ignore(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil);
|
||||
|
||||
NMTernary _nm_setting_property_compare_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
NMTernary _nm_setting_property_compare_fcn_direct(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil);
|
||||
|
||||
NMTernary _nm_setting_property_compare_fcn_default(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
NMTernary _nm_setting_property_compare_fcn_default(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil);
|
||||
|
||||
void _nm_setting_property_get_property_direct(GObject * object,
|
||||
guint prop_id,
|
||||
|
|
@ -345,76 +327,26 @@ void _nm_setting_property_set_property_direct(GObject * object,
|
|||
const GValue *value,
|
||||
GParamSpec * pspec);
|
||||
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_ignore(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_ignore(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_gprop(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_setting_property_to_dbus_fcn_direct_mac_address(
|
||||
const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *
|
||||
_nm_setting_property_to_dbus_fcn_direct_mac_address(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean _nm_setting_property_from_dbus_fcn_ignore(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_setting_property_from_dbus_fcn_ignore(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_direct_ip_config_gateway(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_setting_property_from_dbus_fcn_direct_ip_config_gateway(
|
||||
_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_direct_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_setting_property_from_dbus_fcn_direct_mac_address(
|
||||
_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean _nm_setting_property_from_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean _nm_setting_property_from_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_setting_property_from_dbus_fcn_gprop(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_setting_to_dbus(NMSetting * setting,
|
||||
NMConnection * connection,
|
||||
|
|
@ -780,57 +712,19 @@ gboolean _nm_setting_should_compare_secret_property(NMSetting * settin
|
|||
NMBridgeVlan *_nm_bridge_vlan_dup(const NMBridgeVlan *vlan);
|
||||
NMBridgeVlan *_nm_bridge_vlan_dup_and_seal(const NMBridgeVlan *vlan);
|
||||
|
||||
gboolean _nm_utils_bridge_vlans_from_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_utils_bridge_vlans_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *_nm_utils_bridge_vlans_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
NMTernary _nm_setting_ip_config_compare_fcn_addresses(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
NMTernary _nm_setting_ip_config_compare_fcn_addresses(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil);
|
||||
|
||||
NMTernary _nm_setting_ip_config_compare_fcn_routes(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
NMTernary _nm_setting_ip_config_compare_fcn_routes(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean _nm_utils_hwaddr_cloned_not_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_utils_hwaddr_cloned_not_set(_NM_SETT_INFO_PROP_MISSING_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *_nm_utils_hwaddr_cloned_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
gboolean _nm_utils_hwaddr_cloned_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
gboolean _nm_utils_hwaddr_cloned_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -130,12 +130,7 @@ nm_setting_serial_get_send_delay(NMSettingSerial *setting)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
parity_to_dbus_fcn(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
parity_to_dbus_fcn(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
switch (nm_setting_serial_get_parity(NM_SETTING_SERIAL(setting))) {
|
||||
case NM_SETTING_SERIAL_PARITY_EVEN:
|
||||
|
|
@ -151,7 +146,7 @@ parity_to_dbus_fcn(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static void
|
||||
parity_from_dbus(GVariant *from, GValue *to)
|
||||
parity_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil)
|
||||
{
|
||||
switch (g_variant_get_byte(from)) {
|
||||
case 'E':
|
||||
|
|
|
|||
|
|
@ -875,12 +875,7 @@ _nm_setting_sriov_sort_vfs(NMSettingSriov *setting)
|
|||
/*****************************************************************************/
|
||||
|
||||
static GVariant *
|
||||
vfs_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
vfs_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *vfs = NULL;
|
||||
GVariantBuilder builder;
|
||||
|
|
@ -956,13 +951,7 @@ vfs_to_dbus(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
vfs_from_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
vfs_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray * vfs;
|
||||
GVariantIter vf_iter;
|
||||
|
|
@ -1120,13 +1109,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_vfs(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_vfs(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingSriov *a;
|
||||
NMSettingSriov *b;
|
||||
|
|
|
|||
|
|
@ -1314,13 +1314,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_qdiscs(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_qdiscs(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingTCConfig *a_tc_config = NM_SETTING_TC_CONFIG(set_a);
|
||||
NMSettingTCConfig *b_tc_config = NM_SETTING_TC_CONFIG(set_b);
|
||||
|
|
@ -1338,13 +1332,7 @@ compare_fcn_qdiscs(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_tfilter(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_tfilter(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingTCConfig *a_tc_config = NM_SETTING_TC_CONFIG(set_a);
|
||||
NMSettingTCConfig *b_tc_config = NM_SETTING_TC_CONFIG(set_b);
|
||||
|
|
@ -1487,12 +1475,7 @@ next:
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
tc_qdiscs_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
tc_qdiscs_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *qdiscs = NULL;
|
||||
|
||||
|
|
@ -1501,20 +1484,12 @@ tc_qdiscs_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
tc_qdiscs_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
tc_qdiscs_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GPtrArray *qdiscs;
|
||||
gs_unref_ptrarray GPtrArray *qdiscs = NULL;
|
||||
|
||||
qdiscs = _qdiscs_from_variant(value);
|
||||
g_object_set(setting, NM_SETTING_TC_CONFIG_QDISCS, qdiscs, NULL);
|
||||
g_ptr_array_unref(qdiscs);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1686,12 +1661,7 @@ next:
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
tc_tfilters_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
tc_tfilters_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *tfilters = NULL;
|
||||
|
||||
|
|
@ -1700,13 +1670,7 @@ tc_tfilters_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
tc_tfilters_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
tc_tfilters_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *tfilters = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -350,13 +350,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_link_watchers(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_link_watchers(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingTeamPortPrivate *a_priv;
|
||||
NMSettingTeamPortPrivate *b_priv;
|
||||
|
|
@ -373,13 +367,7 @@ compare_fcn_link_watchers(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_config(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_config(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingTeamPortPrivate *a_priv;
|
||||
NMSettingTeamPortPrivate *b_priv;
|
||||
|
|
|
|||
|
|
@ -1275,13 +1275,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_link_watchers(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_link_watchers(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingTeamPrivate *a_priv;
|
||||
NMSettingTeamPrivate *b_priv;
|
||||
|
|
@ -1298,13 +1292,7 @@ compare_fcn_link_watchers(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_config(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_config(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingTeamPrivate *a_priv;
|
||||
NMSettingTeamPrivate *b_priv;
|
||||
|
|
|
|||
|
|
@ -389,13 +389,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_data(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_data(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingUserPrivate *priv;
|
||||
NMSettingUserPrivate *pri2;
|
||||
|
|
|
|||
|
|
@ -676,22 +676,13 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
_override_flags_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_override_flags_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return g_variant_new_uint32(nm_setting_vlan_get_flags((NMSettingVlan *) setting));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_override_flags_not_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_override_flags_not_set(_NM_SETT_INFO_PROP_MISSING_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
/* we changed the default value for FLAGS. When an older client
|
||||
* doesn't serialize the property, we assume it is the old default. */
|
||||
|
|
|
|||
|
|
@ -849,13 +849,7 @@ compare_property_secrets(NMSettingVpn *a, NMSettingVpn *b, NMSettingCompareFlags
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_secrets(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_secrets(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
|
@ -907,13 +901,7 @@ clear_secrets(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
vpn_secrets_from_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
vpn_secrets_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingVpn * self = NM_SETTING_VPN(setting);
|
||||
NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE(self);
|
||||
|
|
@ -936,12 +924,7 @@ vpn_secrets_from_dbus(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
vpn_secrets_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
vpn_secrets_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE(setting);
|
||||
GVariantBuilder builder;
|
||||
|
|
|
|||
|
|
@ -976,13 +976,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_cloned_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_cloned_mac_address(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return !set_b
|
||||
|| nm_streq0(NM_SETTING_WIRED_GET_PRIVATE(set_a)->cloned_mac_address,
|
||||
|
|
|
|||
|
|
@ -1460,12 +1460,7 @@ nm_setting_wireguard_clear_peers(NMSettingWireGuard *self)
|
|||
/*****************************************************************************/
|
||||
|
||||
static GVariant *
|
||||
_peers_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_peers_dbus_only_synth(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingWireGuard * self = NM_SETTING_WIREGUARD(setting);
|
||||
NMSettingWireGuardPrivate *priv;
|
||||
|
|
@ -1563,13 +1558,7 @@ _peers_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_peers_dbus_only_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_peers_dbus_only_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GVariantIter iter_peers;
|
||||
GVariant * peer_var;
|
||||
|
|
@ -1688,6 +1677,7 @@ _peers_dbus_only_set(const NMSettInfoSetting * sett_info,
|
|||
success = TRUE;
|
||||
|
||||
out:
|
||||
*out_is_modified = peers_changed;
|
||||
if (peers_changed)
|
||||
_peers_notify(setting);
|
||||
return success;
|
||||
|
|
@ -1998,13 +1988,7 @@ update_one_secret(NMSetting *setting, const char *key, GVariant *value, GError *
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_peers(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_peers(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingWireGuardPrivate *a_priv;
|
||||
NMSettingWireGuardPrivate *b_priv;
|
||||
|
|
|
|||
|
|
@ -1291,12 +1291,7 @@ set_secret_flags(NMSetting * setting,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
wep_key_type_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
wep_key_type_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMWepKeyType t;
|
||||
|
||||
|
|
|
|||
|
|
@ -740,12 +740,7 @@ nm_setting_wireless_get_seen_bssid(NMSettingWireless *setting, guint32 i)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
_to_dbus_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_to_dbus_fcn_seen_bssids(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (options && options->seen_bssids)
|
||||
return options->seen_bssids[0] ? g_variant_new_strv(options->seen_bssids, -1) : NULL;
|
||||
|
|
@ -766,13 +761,7 @@ _to_dbus_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_from_dbus_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_from_dbus_fcn_seen_bssids(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingWirelessPrivate *priv;
|
||||
gs_free const char ** s = NULL;
|
||||
|
|
@ -782,6 +771,7 @@ _from_dbus_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
|||
if (_nm_utils_is_manager_process) {
|
||||
/* in the manager process, we don't accept seen-bssid from the client.
|
||||
* Do nothing. */
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1100,13 +1090,7 @@ mac_addr_rand_ok:
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_cloned_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_cloned_mac_address(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return !set_b
|
||||
|| nm_streq0(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->cloned_mac_address,
|
||||
|
|
@ -1114,13 +1098,7 @@ compare_fcn_cloned_mac_address(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
compare_fcn_seen_bssids(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return !set_b
|
||||
|| (nm_strv_ptrarray_cmp(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->seen_bssids,
|
||||
|
|
@ -1131,12 +1109,7 @@ compare_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
|||
/*****************************************************************************/
|
||||
|
||||
static GVariant *
|
||||
nm_setting_wireless_get_security(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
nm_setting_wireless_get_security(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
if (!_nm_connection_serialize_non_secret(flags))
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -640,36 +640,42 @@ _nm_setting_use_legacy_property(NMSetting * setting,
|
|||
const char *legacy_property,
|
||||
const char *new_property)
|
||||
{
|
||||
GVariant *setting_dict, *value;
|
||||
gs_unref_variant GVariant *setting_dict = NULL;
|
||||
gs_unref_variant GVariant *value = NULL;
|
||||
|
||||
if (!connection_dict) {
|
||||
/* we also allow the caller to provide no connection_dict.
|
||||
*
|
||||
* We hit this code bug when being called by update_one_secret().
|
||||
* In this case, we use the legacy property, because we are not
|
||||
* sophisticated enough to mediate between deprecated and legacy
|
||||
* properties...
|
||||
*
|
||||
* However, in practice this code is unreachable, because update_one_secret()
|
||||
* only ends up calling from_dbus_fcn() for certain properties, and none
|
||||
* of those are actually deprecated (for now). So this cannot really happen. */
|
||||
return nm_assert_unreachable_val(FALSE);
|
||||
}
|
||||
|
||||
setting_dict = g_variant_lookup_value(connection_dict,
|
||||
nm_setting_get_name(NM_SETTING(setting)),
|
||||
NM_VARIANT_TYPE_SETTING);
|
||||
|
||||
g_return_val_if_fail(setting_dict != NULL, FALSE);
|
||||
|
||||
/* If the new property isn't set, we have to use the legacy property. */
|
||||
value = g_variant_lookup_value(setting_dict, new_property, NULL);
|
||||
if (!value) {
|
||||
g_variant_unref(setting_dict);
|
||||
if (!value)
|
||||
return TRUE;
|
||||
}
|
||||
g_variant_unref(value);
|
||||
nm_clear_pointer(&value, g_variant_unref);
|
||||
|
||||
/* Otherwise, clients always prefer new properties sent from the daemon. */
|
||||
if (!_nm_utils_is_manager_process) {
|
||||
g_variant_unref(setting_dict);
|
||||
if (!_nm_utils_is_manager_process)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* The daemon prefers the legacy property if it exists. */
|
||||
value = g_variant_lookup_value(setting_dict, legacy_property, NULL);
|
||||
g_variant_unref(setting_dict);
|
||||
|
||||
if (value) {
|
||||
g_variant_unref(value);
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
return !!value;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -950,12 +956,7 @@ _finalize_direct(NMSetting *setting)
|
|||
/*****************************************************************************/
|
||||
|
||||
GVariant *
|
||||
_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_setting_property_to_dbus_fcn_direct(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
switch (property_info->property_type->direct_type) {
|
||||
case NM_VALUE_TYPE_BOOL:
|
||||
|
|
@ -1017,12 +1018,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
|
|||
}
|
||||
|
||||
GVariant *
|
||||
_nm_setting_property_to_dbus_fcn_direct_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_setting_property_to_dbus_fcn_direct_mac_address(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
const char *val;
|
||||
|
||||
|
|
@ -1038,23 +1034,13 @@ _nm_setting_property_to_dbus_fcn_direct_mac_address(const NMSettInfoSetting *
|
|||
}
|
||||
|
||||
GVariant *
|
||||
_nm_setting_property_to_dbus_fcn_ignore(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_setting_property_to_dbus_fcn_ignore(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_setting_property_to_dbus_fcn_gprop(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
nm_auto_unset_gvalue GValue prop_value = {
|
||||
0,
|
||||
|
|
@ -1097,25 +1083,14 @@ _nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * s
|
|||
}
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_ignore(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_setting_property_from_dbus_fcn_ignore(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_direct_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_setting_property_from_dbus_fcn_direct_mac_address(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gsize length = 0;
|
||||
const guint8 *array;
|
||||
|
|
@ -1131,20 +1106,16 @@ _nm_setting_property_from_dbus_fcn_direct_mac_address(const NMSettInfoSetting *
|
|||
|
||||
if (nm_strdup_reset_take(
|
||||
_nm_setting_get_private(setting, sett_info, property_info->direct_offset),
|
||||
length > 0 ? nm_utils_hwaddr_ntoa(array, length) : NULL))
|
||||
length > 0 ? nm_utils_hwaddr_ntoa(array, length) : NULL)) {
|
||||
g_object_notify_by_pspec(G_OBJECT(setting), property_info->param_spec);
|
||||
} else
|
||||
*out_is_modified = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
nm_assert(property_info->param_spec);
|
||||
nm_assert(NM_FLAGS_HAS(property_info->param_spec->flags, G_PARAM_WRITABLE));
|
||||
|
|
@ -1171,6 +1142,8 @@ _nm_setting_property_from_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
|||
_success; \
|
||||
})
|
||||
|
||||
*out_is_modified = FALSE;
|
||||
|
||||
switch (property_info->property_type->direct_type) {
|
||||
case NM_VALUE_TYPE_BOOL:
|
||||
{
|
||||
|
|
@ -1285,6 +1258,7 @@ out_unchanged:
|
|||
return TRUE;
|
||||
|
||||
out_notify:
|
||||
*out_is_modified = TRUE;
|
||||
g_object_notify_by_pspec(G_OBJECT(setting), property_info->param_spec);
|
||||
return TRUE;
|
||||
|
||||
|
|
@ -1318,13 +1292,7 @@ out_error_param_spec_validation:
|
|||
}
|
||||
|
||||
gboolean
|
||||
_nm_setting_property_from_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_setting_property_from_dbus_fcn_gprop(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
nm_auto_unset_gvalue GValue object_value = G_VALUE_INIT;
|
||||
gs_free_error GError *local = NULL;
|
||||
|
|
@ -1334,6 +1302,7 @@ _nm_setting_property_from_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
|||
g_value_init(&object_value, property_info->param_spec->value_type);
|
||||
if (!set_property_from_dbus(property_info, value, &object_value)) {
|
||||
/* for backward behavior, fail unless best-effort is chosen. */
|
||||
*out_is_modified = FALSE;
|
||||
if (NM_FLAGS_HAS(parse_flags, NM_SETTING_PARSE_FLAGS_BEST_EFFORT))
|
||||
return TRUE;
|
||||
g_set_error(error,
|
||||
|
|
@ -1354,6 +1323,7 @@ _nm_setting_property_from_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
|||
property_info->param_spec->name,
|
||||
&object_value,
|
||||
&local)) {
|
||||
*out_is_modified = FALSE;
|
||||
if (!NM_FLAGS_HAS(parse_flags, NM_SETTING_PARSE_FLAGS_STRICT))
|
||||
return TRUE;
|
||||
g_set_error(error,
|
||||
|
|
@ -1612,6 +1582,80 @@ _nm_setting_new_from_dbus(GType setting_type,
|
|||
return g_steal_pointer(&setting);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_property_set_from_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
gboolean * out_is_modified,
|
||||
GError ** error)
|
||||
{
|
||||
gs_free_error GError *local = NULL;
|
||||
NMTernary is_modified = NM_TERNARY_DEFAULT;
|
||||
gboolean success;
|
||||
|
||||
NM_SET_OUT(out_is_modified, FALSE);
|
||||
|
||||
if (!property_info->property_type->from_dbus_fcn) {
|
||||
nm_assert(!property_info->param_spec);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (property_info->property_type->from_dbus_is_full) {
|
||||
/* These hooks perform their own type checking, and can coerce/ignore
|
||||
* a value regardless of the D-Bus type. */
|
||||
} else if (!g_variant_type_equal(g_variant_get_type(value),
|
||||
property_info->property_type->dbus_type)) {
|
||||
/* for backward behavior, fail unless best-effort is chosen. */
|
||||
if (NM_FLAGS_HAS(parse_flags, NM_SETTING_PARSE_FLAGS_BEST_EFFORT))
|
||||
return TRUE;
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("can't set property of type '%s' from value of type '%s'"),
|
||||
property_info->property_type->dbus_type
|
||||
? g_variant_type_peek_string(property_info->property_type->dbus_type)
|
||||
: property_info->param_spec ? g_type_name(property_info->param_spec->value_type)
|
||||
: "(unknown)",
|
||||
g_variant_get_type_string(value));
|
||||
g_prefix_error(error, "%s.%s: ", nm_setting_get_name(setting), property_info->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
success = property_info->property_type->from_dbus_fcn(sett_info,
|
||||
property_info,
|
||||
setting,
|
||||
connection_dict,
|
||||
value,
|
||||
parse_flags,
|
||||
&is_modified,
|
||||
&local);
|
||||
|
||||
/* We allow the from_dbus_fcn() to leave is_modified at NM_TERNARY_DEFAULT,
|
||||
* which we assume to also mean that it was modified. That is, we err on the
|
||||
* side of assuming modification happened. */
|
||||
NM_SET_OUT(out_is_modified, is_modified != FALSE);
|
||||
|
||||
if (!success) {
|
||||
if (property_info->property_type->from_dbus_is_full) {
|
||||
/* the error we received from from_dbus_fcn() should be propagated, even
|
||||
* in non-strict mode. */
|
||||
} else if (!NM_FLAGS_HAS(parse_flags, NM_SETTING_PARSE_FLAGS_STRICT))
|
||||
return TRUE;
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("failed to set property: %s"),
|
||||
local->message);
|
||||
g_prefix_error(error, "%s.%s: ", nm_setting_get_name(setting), property_info->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_from_dbus(NMSetting * setting,
|
||||
GHashTable * keys,
|
||||
|
|
@ -1696,53 +1740,15 @@ init_from_dbus(NMSetting * setting,
|
|||
if (keys)
|
||||
g_hash_table_remove(keys, property_info->name);
|
||||
|
||||
if (property_info->property_type->from_dbus_fcn) {
|
||||
if (property_info->property_type->from_dbus_is_full) {
|
||||
/* These hooks perform their own type checking, and can coerce/ignore
|
||||
* a value regardless of the D-Bus type. */
|
||||
} else if (!g_variant_type_equal(g_variant_get_type(value),
|
||||
property_info->property_type->dbus_type)) {
|
||||
/* for backward behavior, fail unless best-effort is chosen. */
|
||||
if (NM_FLAGS_HAS(parse_flags, NM_SETTING_PARSE_FLAGS_BEST_EFFORT))
|
||||
continue;
|
||||
g_set_error(
|
||||
error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("can't set property of type '%s' from value of type '%s'"),
|
||||
property_info->property_type->dbus_type
|
||||
? g_variant_type_peek_string(property_info->property_type->dbus_type)
|
||||
: property_info->param_spec ? g_type_name(property_info->param_spec->value_type)
|
||||
: "(unknown)",
|
||||
g_variant_get_type_string(value));
|
||||
g_prefix_error(error, "%s.%s: ", nm_setting_get_name(setting), property_info->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!property_info->property_type->from_dbus_fcn(sett_info,
|
||||
property_info,
|
||||
setting,
|
||||
connection_dict,
|
||||
value,
|
||||
parse_flags,
|
||||
&local)) {
|
||||
if (property_info->property_type->from_dbus_is_full) {
|
||||
/* the error we received from from_dbus_fcn() should be propagated, even
|
||||
* in non-strict mode. */
|
||||
} else if (!NM_FLAGS_HAS(parse_flags, NM_SETTING_PARSE_FLAGS_STRICT))
|
||||
continue;
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("failed to set property: %s"),
|
||||
local->message);
|
||||
g_prefix_error(error, "%s.%s: ", nm_setting_get_name(setting), property_info->name);
|
||||
return FALSE;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
nm_assert(!property_info->param_spec);
|
||||
if (!_property_set_from_dbus(sett_info,
|
||||
property_info,
|
||||
setting,
|
||||
connection_dict,
|
||||
value,
|
||||
parse_flags,
|
||||
NULL,
|
||||
error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -2104,25 +2110,13 @@ _nm_setting_compare_flags_check(const GParamSpec * param_spec,
|
|||
}
|
||||
|
||||
NMTernary
|
||||
_nm_setting_property_compare_fcn_ignore(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
_nm_setting_property_compare_fcn_ignore(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
return NM_TERNARY_DEFAULT;
|
||||
}
|
||||
|
||||
NMTernary
|
||||
_nm_setting_property_compare_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
_nm_setting_property_compare_fcn_direct(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gconstpointer p_a;
|
||||
gconstpointer p_b;
|
||||
|
|
@ -2158,13 +2152,7 @@ _nm_setting_property_compare_fcn_direct(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
NMTernary
|
||||
_nm_setting_property_compare_fcn_default(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
_nm_setting_property_compare_fcn_default(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil)
|
||||
{
|
||||
nm_assert(property_info->property_type->direct_type == NM_VALUE_TYPE_NONE);
|
||||
|
||||
|
|
@ -2782,21 +2770,20 @@ _nm_setting_clear_secrets(NMSetting * setting,
|
|||
{
|
||||
const NMSettInfoSetting *sett_info;
|
||||
gboolean changed = FALSE;
|
||||
NMSettingClass * klass;
|
||||
guint16 i;
|
||||
gboolean (*my_clear_secrets)(const struct _NMSettInfoSetting *sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMSetting * setting,
|
||||
NMSettingClearSecretsWithFlagsFn func,
|
||||
gpointer user_data);
|
||||
|
||||
g_return_val_if_fail(NM_IS_SETTING(setting), FALSE);
|
||||
|
||||
my_clear_secrets = NM_SETTING_GET_CLASS(setting)->clear_secrets;
|
||||
klass = NM_SETTING_GET_CLASS(setting);
|
||||
|
||||
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
|
||||
for (i = 0; i < sett_info->property_infos_len; i++) {
|
||||
changed |=
|
||||
my_clear_secrets(sett_info, &sett_info->property_infos[i], setting, func, user_data);
|
||||
changed |= klass->clear_secrets(sett_info,
|
||||
&sett_info->property_infos[i],
|
||||
setting,
|
||||
func,
|
||||
user_data);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
|
@ -2831,14 +2818,13 @@ _nm_setting_need_secrets(NMSetting *setting)
|
|||
static int
|
||||
update_one_secret(NMSetting *setting, const char *key, GVariant *value, GError **error)
|
||||
{
|
||||
const NMSettInfoProperty *property;
|
||||
GParamSpec * prop_spec;
|
||||
GValue prop_value = {
|
||||
0,
|
||||
};
|
||||
const NMSettInfoSetting * sett_info;
|
||||
const NMSettInfoProperty *property_info;
|
||||
gboolean is_modified;
|
||||
|
||||
property = _nm_setting_class_get_property_info(NM_SETTING_GET_CLASS(setting), key);
|
||||
if (!property) {
|
||||
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
|
||||
property_info = _nm_sett_info_setting_get_property_info(sett_info, key);
|
||||
if (!property_info) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND,
|
||||
|
|
@ -2847,32 +2833,25 @@ update_one_secret(NMSetting *setting, const char *key, GVariant *value, GError *
|
|||
return NM_SETTING_UPDATE_SECRET_ERROR;
|
||||
}
|
||||
|
||||
/* Silently ignore non-secrets */
|
||||
prop_spec = property->param_spec;
|
||||
if (!prop_spec || !(prop_spec->flags & NM_SETTING_PARAM_SECRET))
|
||||
if (!property_info->param_spec
|
||||
|| !NM_FLAGS_HAS(property_info->param_spec->flags, NM_SETTING_PARAM_SECRET)) {
|
||||
/* Silently ignore non-secrets */
|
||||
return NM_SETTING_UPDATE_SECRET_SUCCESS_UNCHANGED;
|
||||
|
||||
if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING) && G_IS_PARAM_SPEC_STRING(prop_spec)) {
|
||||
/* String is expected to be a common case. Handle it specially and check
|
||||
* whether the value is already set. Otherwise, we just reset the
|
||||
* property and assume the value got modified.
|
||||
*/
|
||||
char *v;
|
||||
|
||||
g_object_get(G_OBJECT(setting), prop_spec->name, &v, NULL);
|
||||
if (g_strcmp0(v, g_variant_get_string(value, NULL)) == 0) {
|
||||
g_free(v);
|
||||
return NM_SETTING_UPDATE_SECRET_SUCCESS_UNCHANGED;
|
||||
}
|
||||
g_free(v);
|
||||
}
|
||||
|
||||
g_value_init(&prop_value, prop_spec->value_type);
|
||||
set_property_from_dbus(property, value, &prop_value);
|
||||
g_object_set_property(G_OBJECT(setting), prop_spec->name, &prop_value);
|
||||
g_value_unset(&prop_value);
|
||||
if (!_property_set_from_dbus(sett_info,
|
||||
property_info,
|
||||
setting,
|
||||
NULL,
|
||||
value,
|
||||
NM_SETTING_PARSE_FLAGS_BEST_EFFORT,
|
||||
&is_modified,
|
||||
NULL)) {
|
||||
/* Silently ignore errors. */
|
||||
}
|
||||
|
||||
return NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED;
|
||||
return is_modified ? NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED
|
||||
: NM_SETTING_UPDATE_SECRET_SUCCESS_UNCHANGED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3129,12 +3108,7 @@ nm_setting_to_string(NMSetting *setting)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
_nm_setting_get_deprecated_virtual_interface_name(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_setting_get_deprecated_virtual_interface_name(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
|
|
|
|||
|
|
@ -2725,12 +2725,7 @@ _nm_setting_get_team_setting(struct _NMSetting *setting)
|
|||
}
|
||||
|
||||
GVariant *
|
||||
_nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_team_settings_property_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
NMTeamSetting * self = _nm_setting_get_team_setting(setting);
|
||||
const TeamAttrData *attr_data =
|
||||
|
|
@ -2774,10 +2769,10 @@ _nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_
|
|||
}
|
||||
|
||||
void
|
||||
_nm_team_settings_property_from_dbus_link_watchers(GVariant *dbus_value, GValue *prop_value)
|
||||
_nm_team_settings_property_from_dbus_link_watchers(
|
||||
_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil)
|
||||
{
|
||||
g_value_take_boxed(prop_value,
|
||||
_nm_utils_team_link_watchers_from_variant(dbus_value, FALSE, NULL));
|
||||
g_value_take_boxed(to, _nm_utils_team_link_watchers_from_variant(from, FALSE, NULL));
|
||||
}
|
||||
|
||||
const NMSettInfoPropertType nm_sett_info_propert_type_team_b =
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_strdict;
|
|||
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_assigned_mac_address;
|
||||
|
||||
void _nm_utils_strdict_from_dbus(GVariant *dbus_value, GValue *prop_value);
|
||||
void _nm_utils_strdict_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil);
|
||||
|
||||
void _nm_utils_bytes_from_dbus(GVariant *dbus_value, GValue *prop_value);
|
||||
|
||||
|
|
@ -58,14 +58,10 @@ gboolean _nm_utils_bridge_vlan_verify_list(GPtrArray * vlans,
|
|||
|
||||
NMTernary _nm_utils_bridge_compare_vlans(GPtrArray *vlans_a, GPtrArray *vlans_b);
|
||||
|
||||
GVariant *_nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
GVariant *_nm_team_settings_property_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
void _nm_team_settings_property_from_dbus_link_watchers(GVariant *dbus_value, GValue *prop_value);
|
||||
void _nm_team_settings_property_from_dbus_link_watchers(
|
||||
_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil);
|
||||
|
||||
GVariant *_nm_utils_ip4_dns_to_variant(const char *const *dns, gssize len);
|
||||
GVariant *_nm_utils_ip6_dns_to_variant(const char *const *dns, gssize len);
|
||||
|
|
|
|||
|
|
@ -759,18 +759,18 @@ _nm_utils_hash_values_to_slist(GHashTable *hash)
|
|||
}
|
||||
|
||||
void
|
||||
_nm_utils_strdict_from_dbus(GVariant *dbus_value, GValue *prop_value)
|
||||
_nm_utils_strdict_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil)
|
||||
{
|
||||
GVariantIter iter;
|
||||
const char * key, *value;
|
||||
GHashTable * hash;
|
||||
|
||||
hash = g_hash_table_new_full(nm_str_hash, g_str_equal, g_free, g_free);
|
||||
g_variant_iter_init(&iter, dbus_value);
|
||||
g_variant_iter_init(&iter, from);
|
||||
while (g_variant_iter_next(&iter, "{&s&s}", &key, &value))
|
||||
g_hash_table_insert(hash, g_strdup(key), g_strdup(value));
|
||||
|
||||
g_value_take_boxed(prop_value, hash);
|
||||
g_value_take_boxed(to, hash);
|
||||
}
|
||||
|
||||
const NMSettInfoPropertType nm_sett_info_propert_type_strdict =
|
||||
|
|
@ -4062,12 +4062,7 @@ nm_utils_hwaddr_to_dbus(const char *str)
|
|||
}
|
||||
|
||||
GVariant *
|
||||
_nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_utils_hwaddr_cloned_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_free char *addr = NULL;
|
||||
|
||||
|
|
@ -4078,13 +4073,7 @@ _nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
gboolean
|
||||
_nm_utils_hwaddr_cloned_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_utils_hwaddr_cloned_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gsize length;
|
||||
const guint8 *array;
|
||||
|
|
@ -4095,14 +4084,18 @@ _nm_utils_hwaddr_cloned_set(const NMSettInfoSetting * sett_info,
|
|||
if (!_nm_setting_use_legacy_property(setting,
|
||||
connection_dict,
|
||||
"cloned-mac-address",
|
||||
"assigned-mac-address"))
|
||||
"assigned-mac-address")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
length = 0;
|
||||
array = g_variant_get_fixed_array(value, &length, 1);
|
||||
|
||||
if (!length)
|
||||
if (!length) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
str = nm_utils_hwaddr_ntoa(array, length);
|
||||
g_object_set(setting, "cloned-mac-address", str, NULL);
|
||||
|
|
@ -4111,23 +4104,14 @@ _nm_utils_hwaddr_cloned_set(const NMSettInfoSetting * sett_info,
|
|||
}
|
||||
|
||||
gboolean
|
||||
_nm_utils_hwaddr_cloned_not_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_utils_hwaddr_cloned_not_set(_NM_SETT_INFO_PROP_MISSING_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
nm_assert(nm_streq0(property, "cloned-mac-address"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
_nm_utils_hwaddr_cloned_data_synth(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_utils_hwaddr_cloned_data_synth(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_free char *addr = NULL;
|
||||
|
||||
|
|
@ -4156,21 +4140,17 @@ _nm_utils_hwaddr_cloned_data_synth(const NMSettInfoSetting * sett_
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_nm_utils_hwaddr_cloned_data_set(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_utils_hwaddr_cloned_data_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
nm_assert(nm_streq0(property_info->name, "assigned-mac-address"));
|
||||
|
||||
if (_nm_setting_use_legacy_property(setting,
|
||||
connection_dict,
|
||||
"cloned-mac-address",
|
||||
"assigned-mac-address"))
|
||||
"assigned-mac-address")) {
|
||||
*out_is_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_object_set(setting,
|
||||
"cloned-mac-address",
|
||||
|
|
@ -5485,12 +5465,7 @@ nm_utils_base64secret_normalize(const char *base64_key,
|
|||
}
|
||||
|
||||
GVariant *
|
||||
_nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
_nm_utils_bridge_vlans_to_dbus(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *vlans = NULL;
|
||||
GVariantBuilder builder;
|
||||
|
|
@ -5532,13 +5507,7 @@ _nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info
|
|||
}
|
||||
|
||||
gboolean
|
||||
_nm_utils_bridge_vlans_from_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error)
|
||||
_nm_utils_bridge_vlans_from_dbus(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *vlans = NULL;
|
||||
GVariantIter vlan_iter;
|
||||
|
|
|
|||
|
|
@ -4672,6 +4672,24 @@ check_done:;
|
|||
|
||||
g_assert(!NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_CONSTRUCT));
|
||||
g_assert(!NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
if (NM_FLAGS_HAS(sip->param_spec->flags, NM_SETTING_PARAM_SECRET)) {
|
||||
if (sip->param_spec->value_type == G_TYPE_STRING) {
|
||||
g_assert_cmpstr(NM_G_PARAM_SPEC_GET_DEFAULT_STRING(sip->param_spec),
|
||||
==,
|
||||
NULL);
|
||||
} else if (sip->param_spec->value_type == G_TYPE_BYTES) {
|
||||
/* pass */
|
||||
} else if (sip->param_spec->value_type == G_TYPE_HASH_TABLE) {
|
||||
g_assert(NM_IS_SETTING_VPN(setting));
|
||||
g_assert_cmpstr(sip->name, ==, NM_SETTING_VPN_SECRETS);
|
||||
} else {
|
||||
g_error("secret %s.%s is of unexpected property type %s",
|
||||
nm_setting_get_name(setting),
|
||||
sip->name,
|
||||
g_type_name(sip->param_spec->value_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -655,26 +655,6 @@ GVariant *nm_utils_hwaddr_to_dbus(const char *str);
|
|||
typedef struct _NMSettInfoSetting NMSettInfoSetting;
|
||||
typedef struct _NMSettInfoProperty NMSettInfoProperty;
|
||||
|
||||
typedef GVariant *(*NMSettInfoPropToDBusFcn)(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
typedef gboolean (*NMSettInfoPropFromDBusFcn)(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
typedef gboolean (*NMSettInfoPropMissingFromDBusFcn)(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
typedef void (*NMSettInfoPropGPropFromDBusFcn)(GVariant *from, GValue *to);
|
||||
|
||||
const NMSettInfoSetting *nmtst_sett_info_settings(void);
|
||||
|
||||
typedef enum _nm_packed {
|
||||
|
|
@ -713,29 +693,46 @@ typedef struct {
|
|||
* allowed for backward compatibility. */
|
||||
bool from_dbus_direct_allow_transform : 1;
|
||||
|
||||
#define _NM_SETT_INFO_PROP_COMPARE_FCN_ARGS \
|
||||
const NMSettInfoSetting *sett_info, const NMSettInfoProperty *property_info, \
|
||||
NMConnection *con_a, NMSetting *set_a, NMConnection *con_b, NMSetting *set_b, \
|
||||
NMSettingCompareFlags flags
|
||||
|
||||
/* compare_fcn() returns a ternary, where DEFAULT means that the property should not
|
||||
* be compared due to the compare @flags. A TRUE/FALSE result means that the property is
|
||||
* equal/not-equal.
|
||||
*
|
||||
* The "b" setting may be %NULL, in which case the function only determines whether
|
||||
* the setting should be compared (TRUE) or not (DEFAULT). */
|
||||
NMTernary (*compare_fcn)(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
NMTernary (*compare_fcn)(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil);
|
||||
|
||||
NMSettInfoPropToDBusFcn to_dbus_fcn;
|
||||
NMSettInfoPropFromDBusFcn from_dbus_fcn;
|
||||
NMSettInfoPropMissingFromDBusFcn missing_from_dbus_fcn;
|
||||
#define _NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS \
|
||||
const NMSettInfoSetting *sett_info, const NMSettInfoProperty *property_info, \
|
||||
NMConnection *connection, NMSetting *setting, NMConnectionSerializationFlags flags, \
|
||||
const NMConnectionSerializationOptions *options
|
||||
|
||||
GVariant *(*to_dbus_fcn)(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
#define _NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS \
|
||||
const NMSettInfoSetting *sett_info, const NMSettInfoProperty *property_info, \
|
||||
NMSetting *setting, GVariant *connection_dict, GVariant *value, \
|
||||
NMSettingParseFlags parse_flags, NMTernary *out_is_modified, GError **error
|
||||
|
||||
gboolean (*from_dbus_fcn)(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
#define _NM_SETT_INFO_PROP_MISSING_FROM_DBUS_FCN_ARGS \
|
||||
NMSetting *setting, GVariant *connection_dict, const char *property, \
|
||||
NMSettingParseFlags parse_flags, GError **error
|
||||
|
||||
gboolean (*missing_from_dbus_fcn)(_NM_SETT_INFO_PROP_MISSING_FROM_DBUS_FCN_ARGS _nm_nil);
|
||||
|
||||
struct {
|
||||
#define _NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS GVariant *from, GValue *to
|
||||
|
||||
/* Only if from_dbus_fcn is set to _nm_setting_property_from_dbus_fcn_gprop.
|
||||
* This is an optional handler for converting between GVariant and
|
||||
* GValue. */
|
||||
NMSettInfoPropGPropFromDBusFcn gprop_fcn;
|
||||
void (*gprop_fcn)(_NM_SETT_INFO_PROP_FROM_DBUS_GPROP_FCN_ARGS _nm_nil);
|
||||
} typdata_from_dbus;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#define _nm_deprecated(msg) __attribute__((__deprecated__(msg)))
|
||||
#define nm_auto(fcn) __attribute__((__cleanup__(fcn)))
|
||||
|
||||
#define _nm_nil
|
||||
|
||||
/* This is required to make LTO working.
|
||||
*
|
||||
* See https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/76#note_112694
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue