diff options
Diffstat (limited to 'libnm-core/nm-setting-ip6-config.c')
-rw-r--r-- | libnm-core/nm-setting-ip6-config.c | 977 |
1 files changed, 507 insertions, 470 deletions
diff --git a/libnm-core/nm-setting-ip6-config.c b/libnm-core/nm-setting-ip6-config.c index c7c2c48de8..1d6f9ed688 100644 --- a/libnm-core/nm-setting-ip6-config.c +++ b/libnm-core/nm-setting-ip6-config.c @@ -38,25 +38,24 @@ /*****************************************************************************/ -NM_GOBJECT_PROPERTIES_DEFINE_BASE ( - PROP_IP6_PRIVACY, - PROP_ADDR_GEN_MODE, - PROP_TOKEN, - PROP_DHCP_DUID, - PROP_RA_TIMEOUT, -); +NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_IP6_PRIVACY, + PROP_ADDR_GEN_MODE, + PROP_TOKEN, + PROP_DHCP_DUID, + PROP_RA_TIMEOUT, ); typedef struct { - char *token; - char *dhcp_duid; - NMSettingIP6ConfigPrivacy ip6_privacy; - NMSettingIP6ConfigAddrGenMode addr_gen_mode; - gint32 ra_timeout; + char * token; + char * dhcp_duid; + NMSettingIP6ConfigPrivacy ip6_privacy; + NMSettingIP6ConfigAddrGenMode addr_gen_mode; + gint32 ra_timeout; } NMSettingIP6ConfigPrivate; -G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING_IP_CONFIG) +G_DEFINE_TYPE(NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING_IP_CONFIG) -#define NM_SETTING_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_IP6_CONFIG, NMSettingIP6ConfigPrivate)) +#define NM_SETTING_IP6_CONFIG_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE((o), NM_TYPE_SETTING_IP6_CONFIG, NMSettingIP6ConfigPrivate)) /*****************************************************************************/ @@ -70,11 +69,11 @@ G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING_IP_CON * Returns: IPv6 Privacy Extensions configuration value (#NMSettingIP6ConfigPrivacy). **/ NMSettingIP6ConfigPrivacy -nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting) +nm_setting_ip6_config_get_ip6_privacy(NMSettingIP6Config *setting) { - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); + g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ip6_privacy; + return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->ip6_privacy; } /** @@ -89,12 +88,12 @@ nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting) * Since: 1.2 **/ NMSettingIP6ConfigAddrGenMode -nm_setting_ip6_config_get_addr_gen_mode (NMSettingIP6Config *setting) +nm_setting_ip6_config_get_addr_gen_mode(NMSettingIP6Config *setting) { - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), - NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY); + g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY); - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->addr_gen_mode; + return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->addr_gen_mode; } /** @@ -109,11 +108,11 @@ nm_setting_ip6_config_get_addr_gen_mode (NMSettingIP6Config *setting) * Since: 1.4 **/ const char * -nm_setting_ip6_config_get_token (NMSettingIP6Config *setting) +nm_setting_ip6_config_get_token(NMSettingIP6Config *setting) { - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); + g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), NULL); - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->token; + return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->token; } /** @@ -129,11 +128,11 @@ nm_setting_ip6_config_get_token (NMSettingIP6Config *setting) * Since: 1.12 **/ const char * -nm_setting_ip6_config_get_dhcp_duid (NMSettingIP6Config *setting) +nm_setting_ip6_config_get_dhcp_duid(NMSettingIP6Config *setting) { - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); + g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), NULL); - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dhcp_duid; + return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->dhcp_duid; } /** @@ -146,402 +145,441 @@ nm_setting_ip6_config_get_dhcp_duid (NMSettingIP6Config *setting) * Since: 1.24 **/ gint32 -nm_setting_ip6_config_get_ra_timeout (NMSettingIP6Config *setting) +nm_setting_ip6_config_get_ra_timeout(NMSettingIP6Config *setting) { - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); + g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), 0); - return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ra_timeout; + return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->ra_timeout; } static gboolean -verify (NMSetting *setting, NMConnection *connection, GError **error) +verify(NMSetting *setting, NMConnection *connection, GError **error) { - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); - NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting); - NMSettingVerifyResult ret; - const char *method; - gboolean token_needs_normalization = FALSE; - - ret = NM_SETTING_CLASS (nm_setting_ip6_config_parent_class)->verify (setting, connection, error); - if (ret != NM_SETTING_VERIFY_SUCCESS) - return ret; - - method = nm_setting_ip_config_get_method (s_ip); - /* Base class already checked that it exists */ - g_assert (method); - - if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { - if (nm_setting_ip_config_get_num_addresses (s_ip) == 0) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_MISSING_PROPERTY, - _("this property cannot be empty for '%s=%s'"), - NM_SETTING_IP_CONFIG_METHOD, method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES); - return FALSE; - } - } else if (NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, - NM_SETTING_IP6_CONFIG_METHOD_SHARED, - NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) { - /* Shared allows IP addresses and DNS; other methods do not */ - if (!nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { - if (nm_setting_ip_config_get_num_dns (s_ip) > 0) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP_CONFIG_METHOD, method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS); - return FALSE; - } - - if (nm_setting_ip_config_get_num_dns_searches (s_ip) > 0) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP_CONFIG_METHOD, method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_DNS_SEARCH); - return FALSE; - } - - if (nm_setting_ip_config_get_num_addresses (s_ip) > 0) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for '%s=%s'"), - NM_SETTING_IP_CONFIG_METHOD, method); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_ADDRESSES); - return FALSE; - } - } - } else if (NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO, - NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { - /* nothing to do */ - } else { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_METHOD); - return FALSE; - } - - if (!NM_IN_SET (priv->addr_gen_mode, - NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64, - NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY)) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE); - return FALSE; - } - - if (priv->token) { - if (priv->addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) { - struct in6_addr i6_token; - char s_token[NM_UTILS_INET_ADDRSTRLEN]; - - if ( inet_pton (AF_INET6, priv->token, &i6_token) != 1 - || !_nm_utils_inet6_is_token (&i6_token)) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("value is not a valid token")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_TOKEN); - return FALSE; - } - - if (g_strcmp0 (priv->token, _nm_utils_inet6_ntop (&i6_token, s_token))) - token_needs_normalization = TRUE; - } else { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("only makes sense with EUI64 address generation mode")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_TOKEN); - return FALSE; - } - } - - if (priv->dhcp_duid) { - if (!_nm_utils_dhcp_duid_valid (priv->dhcp_duid, NULL)) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("invalid DUID")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DHCP_DUID); - return FALSE; - } - } - - /* Failures from here on, are NORMALIZABLE_ERROR... */ - - if (token_needs_normalization) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("token is not in canonical form")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_TOKEN); - return NM_SETTING_VERIFY_NORMALIZABLE_ERROR; - } - - /* Failures from here on are NORMALIZABLE... */ - - if ( NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, - NM_SETTING_IP6_CONFIG_METHOD_DISABLED) - && !nm_setting_ip_config_get_may_fail (s_ip)) { - g_set_error_literal (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("property should be TRUE when method is set to ignore or disabled")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_MAY_FAIL); - return NM_SETTING_VERIFY_NORMALIZABLE; - } - - return TRUE; + NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting); + NMSettingIPConfig * s_ip = NM_SETTING_IP_CONFIG(setting); + NMSettingVerifyResult ret; + const char * method; + gboolean token_needs_normalization = FALSE; + + ret = NM_SETTING_CLASS(nm_setting_ip6_config_parent_class)->verify(setting, connection, error); + if (ret != NM_SETTING_VERIFY_SUCCESS) + return ret; + + method = nm_setting_ip_config_get_method(s_ip); + /* Base class already checked that it exists */ + g_assert(method); + + if (nm_streq(method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { + if (nm_setting_ip_config_get_num_addresses(s_ip) == 0) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_MISSING_PROPERTY, + _("this property cannot be empty for '%s=%s'"), + NM_SETTING_IP_CONFIG_METHOD, + method); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP_CONFIG_ADDRESSES); + return FALSE; + } + } else if (NM_IN_STRSET(method, + NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP6_CONFIG_METHOD_SHARED, + NM_SETTING_IP6_CONFIG_METHOD_DISABLED)) { + /* Shared allows IP addresses and DNS; other methods do not */ + if (!nm_streq(method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { + if (nm_setting_ip_config_get_num_dns(s_ip) > 0) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("this property is not allowed for '%s=%s'"), + NM_SETTING_IP_CONFIG_METHOD, + method); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP_CONFIG_DNS); + return FALSE; + } + + if (nm_setting_ip_config_get_num_dns_searches(s_ip) > 0) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("this property is not allowed for '%s=%s'"), + NM_SETTING_IP_CONFIG_METHOD, + method); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP_CONFIG_DNS_SEARCH); + return FALSE; + } + + if (nm_setting_ip_config_get_num_addresses(s_ip) > 0) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("this property is not allowed for '%s=%s'"), + NM_SETTING_IP_CONFIG_METHOD, + method); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP_CONFIG_ADDRESSES); + return FALSE; + } + } + } else if (NM_IN_STRSET(method, + NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { + /* nothing to do */ + } else { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("property is invalid")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP_CONFIG_METHOD); + return FALSE; + } + + if (!NM_IN_SET(priv->addr_gen_mode, + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64, + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("property is invalid")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE); + return FALSE; + } + + if (priv->token) { + if (priv->addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) { + struct in6_addr i6_token; + char s_token[NM_UTILS_INET_ADDRSTRLEN]; + + if (inet_pton(AF_INET6, priv->token, &i6_token) != 1 + || !_nm_utils_inet6_is_token(&i6_token)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("value is not a valid token")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP6_CONFIG_TOKEN); + return FALSE; + } + + if (g_strcmp0(priv->token, _nm_utils_inet6_ntop(&i6_token, s_token))) + token_needs_normalization = TRUE; + } else { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("only makes sense with EUI64 address generation mode")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP6_CONFIG_TOKEN); + return FALSE; + } + } + + if (priv->dhcp_duid) { + if (!_nm_utils_dhcp_duid_valid(priv->dhcp_duid, NULL)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("invalid DUID")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP6_CONFIG_DHCP_DUID); + return FALSE; + } + } + + /* Failures from here on, are NORMALIZABLE_ERROR... */ + + if (token_needs_normalization) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("token is not in canonical form")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP6_CONFIG_TOKEN); + return NM_SETTING_VERIFY_NORMALIZABLE_ERROR; + } + + /* Failures from here on are NORMALIZABLE... */ + + if (NM_IN_STRSET(method, + NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP6_CONFIG_METHOD_DISABLED) + && !nm_setting_ip_config_get_may_fail(s_ip)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("property should be TRUE when method is set to ignore or disabled")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_IP_CONFIG_MAY_FAIL); + return NM_SETTING_VERIFY_NORMALIZABLE; + } + + return TRUE; } static GVariant * -ip6_dns_to_dbus (const GValue *prop_value) +ip6_dns_to_dbus(const GValue *prop_value) { - return nm_utils_ip6_dns_to_variant (g_value_get_boxed (prop_value)); + return nm_utils_ip6_dns_to_variant(g_value_get_boxed(prop_value)); } static void -ip6_dns_from_dbus (GVariant *dbus_value, - GValue *prop_value) +ip6_dns_from_dbus(GVariant *dbus_value, GValue *prop_value) { - g_value_take_boxed (prop_value, nm_utils_ip6_dns_from_variant (dbus_value)); + g_value_take_boxed(prop_value, nm_utils_ip6_dns_from_variant(dbus_value)); } static GVariant * -ip6_addresses_get (const NMSettInfoSetting *sett_info, - guint property_idx, - NMConnection *connection, - NMSetting *setting, - NMConnectionSerializationFlags flags, - const NMConnectionSerializationOptions *options) +ip6_addresses_get(const NMSettInfoSetting * sett_info, + guint property_idx, + NMConnection * connection, + NMSetting * setting, + NMConnectionSerializationFlags flags, + const NMConnectionSerializationOptions *options) { - gs_unref_ptrarray GPtrArray *addrs = NULL; - const char *gateway; + gs_unref_ptrarray GPtrArray *addrs = NULL; + const char * gateway; - g_object_get (setting, NM_SETTING_IP_CONFIG_ADDRESSES, &addrs, NULL); - gateway = nm_setting_ip_config_get_gateway (NM_SETTING_IP_CONFIG (setting)); - return nm_utils_ip6_addresses_to_variant (addrs, gateway); + g_object_get(setting, NM_SETTING_IP_CONFIG_ADDRESSES, &addrs, NULL); + gateway = nm_setting_ip_config_get_gateway(NM_SETTING_IP_CONFIG(setting)); + return nm_utils_ip6_addresses_to_variant(addrs, gateway); } static gboolean -ip6_addresses_set (NMSetting *setting, - GVariant *connection_dict, - const char *property, - GVariant *value, - NMSettingParseFlags parse_flags, - GError **error) +ip6_addresses_set(NMSetting * setting, + GVariant * connection_dict, + const char * property, + GVariant * value, + NMSettingParseFlags parse_flags, + GError ** error) { - GPtrArray *addrs; - char *gateway = NULL; + GPtrArray *addrs; + char * gateway = NULL; - /* FIXME: properly handle errors */ + /* FIXME: properly handle errors */ - if (!_nm_setting_use_legacy_property (setting, connection_dict, "addresses", "address-data")) - return TRUE; + if (!_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data")) + return TRUE; - addrs = nm_utils_ip6_addresses_from_variant (value, &gateway); + addrs = nm_utils_ip6_addresses_from_variant(value, &gateway); - g_object_set (setting, - NM_SETTING_IP_CONFIG_ADDRESSES, addrs, - NM_SETTING_IP_CONFIG_GATEWAY, gateway, - NULL); - g_ptr_array_unref (addrs); - g_free (gateway); - return TRUE; + g_object_set(setting, + NM_SETTING_IP_CONFIG_ADDRESSES, + addrs, + NM_SETTING_IP_CONFIG_GATEWAY, + gateway, + NULL); + g_ptr_array_unref(addrs); + g_free(gateway); + return TRUE; } static GVariant * -ip6_address_data_get (const NMSettInfoSetting *sett_info, - guint property_idx, - NMConnection *connection, - NMSetting *setting, - NMConnectionSerializationFlags flags, - const NMConnectionSerializationOptions *options) +ip6_address_data_get(const NMSettInfoSetting * sett_info, + guint property_idx, + NMConnection * connection, + NMSetting * setting, + NMConnectionSerializationFlags flags, + const NMConnectionSerializationOptions *options) { - gs_unref_ptrarray GPtrArray *addrs = NULL; + gs_unref_ptrarray GPtrArray *addrs = NULL; - if (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS) - return NULL; + if (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS) + return NULL; - g_object_get (setting, NM_SETTING_IP_CONFIG_ADDRESSES, &addrs, NULL); - return nm_utils_ip_addresses_to_variant (addrs); + g_object_get(setting, NM_SETTING_IP_CONFIG_ADDRESSES, &addrs, NULL); + return nm_utils_ip_addresses_to_variant(addrs); } static gboolean -ip6_address_data_set (NMSetting *setting, - GVariant *connection_dict, - const char *property, - GVariant *value, - NMSettingParseFlags parse_flags, - GError **error) +ip6_address_data_set(NMSetting * setting, + GVariant * connection_dict, + const char * property, + GVariant * value, + NMSettingParseFlags parse_flags, + GError ** error) { - GPtrArray *addrs; + GPtrArray *addrs; - /* FIXME: properly handle errors */ + /* 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")) - return TRUE; + /* Ignore 'address-data' if we're going to process 'addresses' */ + if (_nm_setting_use_legacy_property(setting, connection_dict, "addresses", "address-data")) + return TRUE; - addrs = nm_utils_ip_addresses_from_variant (value, AF_INET6); - g_object_set (setting, NM_SETTING_IP_CONFIG_ADDRESSES, addrs, NULL); - g_ptr_array_unref (addrs); - return TRUE; + addrs = nm_utils_ip_addresses_from_variant(value, AF_INET6); + g_object_set(setting, NM_SETTING_IP_CONFIG_ADDRESSES, addrs, NULL); + g_ptr_array_unref(addrs); + return TRUE; } static GVariant * -ip6_routes_get (const NMSettInfoSetting *sett_info, - guint property_idx, - NMConnection *connection, - NMSetting *setting, - NMConnectionSerializationFlags flags, - const NMConnectionSerializationOptions *options) +ip6_routes_get(const NMSettInfoSetting * sett_info, + guint property_idx, + NMConnection * connection, + NMSetting * setting, + NMConnectionSerializationFlags flags, + const NMConnectionSerializationOptions *options) { - gs_unref_ptrarray GPtrArray *routes = NULL; + gs_unref_ptrarray GPtrArray *routes = NULL; - g_object_get (setting, NM_SETTING_IP_CONFIG_ROUTES, &routes, NULL); - return nm_utils_ip6_routes_to_variant (routes); + g_object_get(setting, NM_SETTING_IP_CONFIG_ROUTES, &routes, NULL); + return nm_utils_ip6_routes_to_variant(routes); } static gboolean -ip6_routes_set (NMSetting *setting, - GVariant *connection_dict, - const char *property, - GVariant *value, - NMSettingParseFlags parse_flags, - GError **error) +ip6_routes_set(NMSetting * setting, + GVariant * connection_dict, + const char * property, + GVariant * value, + NMSettingParseFlags parse_flags, + GError ** error) { - GPtrArray *routes; + GPtrArray *routes; - /* FIXME: properly handle errors */ + /* FIXME: properly handle errors */ - if (!_nm_setting_use_legacy_property (setting, connection_dict, "routes", "route-data")) - return TRUE; + if (!_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data")) + return TRUE; - routes = nm_utils_ip6_routes_from_variant (value); - g_object_set (setting, property, routes, NULL); - g_ptr_array_unref (routes); - return TRUE; + routes = nm_utils_ip6_routes_from_variant(value); + g_object_set(setting, property, routes, NULL); + g_ptr_array_unref(routes); + return TRUE; } static GVariant * -ip6_route_data_get (const NMSettInfoSetting *sett_info, - guint property_idx, - NMConnection *connection, - NMSetting *setting, - NMConnectionSerializationFlags flags, - const NMConnectionSerializationOptions *options) +ip6_route_data_get(const NMSettInfoSetting * sett_info, + guint property_idx, + NMConnection * connection, + NMSetting * setting, + NMConnectionSerializationFlags flags, + const NMConnectionSerializationOptions *options) { - gs_unref_ptrarray GPtrArray *routes = NULL; + gs_unref_ptrarray GPtrArray *routes = NULL; - if (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS) - return NULL; + if (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS) + return NULL; - g_object_get (setting, NM_SETTING_IP_CONFIG_ROUTES, &routes, NULL); - return nm_utils_ip_routes_to_variant (routes); + g_object_get(setting, NM_SETTING_IP_CONFIG_ROUTES, &routes, NULL); + return nm_utils_ip_routes_to_variant(routes); } static gboolean -ip6_route_data_set (NMSetting *setting, - GVariant *connection_dict, - const char *property, - GVariant *value, - NMSettingParseFlags parse_flags, - GError **error) +ip6_route_data_set(NMSetting * setting, + GVariant * connection_dict, + const char * property, + GVariant * value, + NMSettingParseFlags parse_flags, + GError ** error) { - GPtrArray *routes; + GPtrArray *routes; - /* FIXME: properly handle errors */ + /* 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")) - return TRUE; + /* Ignore 'route-data' if we're going to process 'routes' */ + if (_nm_setting_use_legacy_property(setting, connection_dict, "routes", "route-data")) + return TRUE; - routes = nm_utils_ip_routes_from_variant (value, AF_INET6); - g_object_set (setting, NM_SETTING_IP_CONFIG_ROUTES, routes, NULL); - g_ptr_array_unref (routes); - return TRUE; + routes = nm_utils_ip_routes_from_variant(value, AF_INET6); + g_object_set(setting, NM_SETTING_IP_CONFIG_ROUTES, routes, NULL); + g_ptr_array_unref(routes); + return TRUE; } /*****************************************************************************/ static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) +get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); - - switch (prop_id) { - case PROP_IP6_PRIVACY: - g_value_set_enum (value, priv->ip6_privacy); - break; - case PROP_ADDR_GEN_MODE: - g_value_set_int (value, priv->addr_gen_mode); - break; - case PROP_TOKEN: - g_value_set_string (value, priv->token); - break; - case PROP_DHCP_DUID: - g_value_set_string (value, priv->dhcp_duid); - break; - case PROP_RA_TIMEOUT: - g_value_set_int (value, priv->ra_timeout); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } + NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(object); + + switch (prop_id) { + case PROP_IP6_PRIVACY: + g_value_set_enum(value, priv->ip6_privacy); + break; + case PROP_ADDR_GEN_MODE: + g_value_set_int(value, priv->addr_gen_mode); + break; + case PROP_TOKEN: + g_value_set_string(value, priv->token); + break; + case PROP_DHCP_DUID: + g_value_set_string(value, priv->dhcp_duid); + break; + case PROP_RA_TIMEOUT: + g_value_set_int(value, priv->ra_timeout); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } } static void -set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) +set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); - - switch (prop_id) { - case PROP_IP6_PRIVACY: - priv->ip6_privacy = g_value_get_enum (value); - break; - case PROP_ADDR_GEN_MODE: - priv->addr_gen_mode = g_value_get_int (value); - break; - case PROP_TOKEN: - g_free (priv->token); - priv->token = g_value_dup_string (value); - break; - case PROP_DHCP_DUID: - g_free (priv->dhcp_duid); - priv->dhcp_duid = g_value_dup_string (value); - break; - case PROP_RA_TIMEOUT: - priv->ra_timeout = g_value_get_int (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } + NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(object); + + switch (prop_id) { + case PROP_IP6_PRIVACY: + priv->ip6_privacy = g_value_get_enum(value); + break; + case PROP_ADDR_GEN_MODE: + priv->addr_gen_mode = g_value_get_int(value); + break; + case PROP_TOKEN: + g_free(priv->token); + priv->token = g_value_dup_string(value); + break; + case PROP_DHCP_DUID: + g_free(priv->dhcp_duid); + priv->dhcp_duid = g_value_dup_string(value); + break; + case PROP_RA_TIMEOUT: + priv->ra_timeout = g_value_get_int(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } } /*****************************************************************************/ static void -nm_setting_ip6_config_init (NMSettingIP6Config *setting) +nm_setting_ip6_config_init(NMSettingIP6Config *setting) { - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); + NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting); - priv->ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN; - priv->addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY; + priv->ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN; + priv->addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY; } /** @@ -552,39 +590,39 @@ nm_setting_ip6_config_init (NMSettingIP6Config *setting) * Returns: (transfer full): the new empty #NMSettingIP6Config object **/ NMSetting * -nm_setting_ip6_config_new (void) +nm_setting_ip6_config_new(void) { - return (NMSetting *) g_object_new (NM_TYPE_SETTING_IP6_CONFIG, NULL); + return (NMSetting *) g_object_new(NM_TYPE_SETTING_IP6_CONFIG, NULL); } static void -finalize (GObject *object) +finalize(GObject *object) { - NMSettingIP6Config *self = NM_SETTING_IP6_CONFIG (object); - NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (self); + NMSettingIP6Config * self = NM_SETTING_IP6_CONFIG(object); + NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(self); - g_free (priv->token); - g_free (priv->dhcp_duid); + g_free(priv->token); + g_free(priv->dhcp_duid); - G_OBJECT_CLASS (nm_setting_ip6_config_parent_class)->finalize (object); + G_OBJECT_CLASS(nm_setting_ip6_config_parent_class)->finalize(object); } static void -nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) +nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - NMSettingClass *setting_class = NM_SETTING_CLASS (klass); - GArray *properties_override = _nm_sett_info_property_override_create_array_ip_config (); + GObjectClass * object_class = G_OBJECT_CLASS(klass); + NMSettingClass *setting_class = NM_SETTING_CLASS(klass); + GArray * properties_override = _nm_sett_info_property_override_create_array_ip_config(); - g_type_class_add_private (klass, sizeof (NMSettingIP6ConfigPrivate)); + g_type_class_add_private(klass, sizeof(NMSettingIP6ConfigPrivate)); - object_class->get_property = get_property; - object_class->set_property = set_property; - object_class->finalize = finalize; + object_class->get_property = get_property; + object_class->set_property = set_property; + object_class->finalize = finalize; - setting_class->verify = verify; + setting_class->verify = verify; - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: method * variable: IPV6INIT, IPV6FORWARDING, IPV6_AUTOCONF, DHCPV6C, IPV6_DISABLED * default: IPV6INIT=yes; IPV6FORWARDING=no; IPV6_AUTOCONF=!IPV6FORWARDING, DHCPV6=no @@ -594,7 +632,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---keyfile--- + /* ---keyfile--- * property: dns * format: list of DNS IP addresses * description: List of DNS servers. @@ -609,7 +647,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dns-search * variable: IPV6_DOMAIN(+) * format: string (space-separated domains) @@ -617,7 +655,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---keyfile--- + /* ---keyfile--- * property: addresses * variable: address1, address2, ... * format: address/plen @@ -633,7 +671,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---keyfile--- + /* ---keyfile--- * property: gateway * variable: gateway * format: string @@ -648,7 +686,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---keyfile--- + /* ---keyfile--- * property: routes * variable: route1, route2, ... * format: route/plen[,gateway,metric] @@ -663,7 +701,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: ignore-auto-routes * variable: IPV6_PEERROUTES(+) * default: yes @@ -671,7 +709,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: ignore-auto-dns * variable: IPV6_PEERDNS(+) * default: yes @@ -679,14 +717,14 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dhcp-hostname * variable: DHCPV6_HOSTNAME * description: Hostname to send the DHCP server. * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dhcp-timeout * variable: IPV6_DHCP_TIMEOUT(+) * description: A timeout after which the DHCP transaction fails in case of no response. @@ -694,14 +732,14 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dhcp-hostname-flags * variable: DHCPV6_HOSTNAME_FLAGS * description: flags for the DHCP hostname property * example: DHCPV6_HOSTNAME_FLAGS=5 */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: never-default * variable: IPV6_DEFROUTE(+), (and IPV6_DEFAULTGW, IPV6_DEFAULTDEV in /etc/sysconfig/network) * default: IPV6_DEFROUTE=yes (when no variable specified) @@ -711,7 +749,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: may-fail * variable: IPV6_FAILURE_FATAL(+) * default: no @@ -719,7 +757,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: route-metric * variable: IPV6_ROUTE_METRIC(+) * default: -1 @@ -728,7 +766,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: route-table * variable: IPV6_ROUTE_TABLE(+) * default: 0 @@ -736,7 +774,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dns-priority * variable: IPV6_DNS_PRIORITY(+) * description: The priority for DNS servers of this connection. Lower values have higher priority. @@ -747,7 +785,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dns-options * variable: IPV6_RES_OPTIONS(+) * description: List of DNS options to be added to /etc/resolv.conf @@ -755,7 +793,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - /** + /** * NMSettingIP6Config:ip6-privacy: * * Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If @@ -776,7 +814,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * that can be enabled with the "addr-gen-mode" property's "stable-privacy" * setting as another way of avoiding host tracking with IPv6 addresses. **/ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: ip6-privacy * variable: IPV6_PRIVACY, IPV6_PRIVACY_PREFER_PUBLIC_IP(+) * values: IPV6_PRIVACY: no, yes (rfc3041 or rfc4941); @@ -786,14 +824,15 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * example: IPV6_PRIVACY=rfc3041 IPV6_PRIVACY_PREFER_PUBLIC_IP=yes * ---end--- */ - obj_properties[PROP_IP6_PRIVACY] = - g_param_spec_enum (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, "", "", - NM_TYPE_SETTING_IP6_CONFIG_PRIVACY, - NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS); - - /** + obj_properties[PROP_IP6_PRIVACY] = + g_param_spec_enum(NM_SETTING_IP6_CONFIG_IP6_PRIVACY, + "", + "", + NM_TYPE_SETTING_IP6_CONFIG_PRIVACY, + NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + /** * NMSettingIP6Config:addr-gen-mode: * * Configure method for creating the address for use with RFC4862 IPv6 @@ -825,7 +864,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * * Since: 1.2 **/ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: addr-gen-mode * variable: IPV6_ADDR_GEN_MODE * values: IPV6_ADDR_GEN_MODE: eui64, stable-privacy @@ -834,14 +873,16 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * example: IPV6_ADDR_GEN_MODE=stable-privacy * ---end--- */ - obj_properties[PROP_ADDR_GEN_MODE] = - g_param_spec_int (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, "", "", - G_MININT, G_MAXINT, - NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS); - - /** + obj_properties[PROP_ADDR_GEN_MODE] = + g_param_spec_int(NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, + "", + "", + G_MININT, + G_MAXINT, + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + /** * NMSettingIP6Config:token: * * Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 @@ -849,21 +890,21 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * * Since: 1.4 **/ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: token * variable: IPV6_TOKEN * description: The IPv6 tokenized interface identifier token * example: IPV6_TOKEN=::53 * ---end--- */ - obj_properties[PROP_TOKEN] = - g_param_spec_string (NM_SETTING_IP6_CONFIG_TOKEN, "", "", - NULL, - G_PARAM_READWRITE | - NM_SETTING_PARAM_INFERRABLE | - G_PARAM_STATIC_STRINGS); - - /** + obj_properties[PROP_TOKEN] = g_param_spec_string(NM_SETTING_IP6_CONFIG_TOKEN, + "", + "", + NULL, + G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE + | G_PARAM_STATIC_STRINGS); + + /** * NMSettingIP6Config:ra-timeout: * * A timeout for waiting Router Advertisements in seconds. If zero (the default), a @@ -874,7 +915,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * * Since: 1.24 **/ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dhcp-timeout * variable: IPV6_RA_TIMEOUT(+) * description: A timeout for waiting Router Advertisements in seconds. @@ -882,14 +923,16 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * ---end--- */ - obj_properties[PROP_RA_TIMEOUT] = - g_param_spec_int (NM_SETTING_IP6_CONFIG_RA_TIMEOUT, "", "", - 0, G_MAXINT32, 0, - G_PARAM_READWRITE | - NM_SETTING_PARAM_FUZZY_IGNORE | - G_PARAM_STATIC_STRINGS); + obj_properties[PROP_RA_TIMEOUT] = g_param_spec_int( + NM_SETTING_IP6_CONFIG_RA_TIMEOUT, + "", + "", + 0, + G_MAXINT32, + 0, + G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS); - /** + /** * NMSettingIP6Config:dhcp-duid: * * A string containing the DHCPv6 Unique Identifier (DUID) used by the dhcp @@ -924,7 +967,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * * Since: 1.12 **/ - /* ---ifcfg-rh--- + /* ---ifcfg-rh--- * property: dhcp-duid * variable: DHCPV6_DUID(+) * description: A string sent to the DHCPv6 server to identify the local machine. @@ -934,30 +977,29 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * example: DHCPV6_DUID=LL; DHCPV6_DUID=0301deadbeef0001; DHCPV6_DUID=03:01:de:ad:be:ef:00:01 * ---end--- */ - obj_properties[PROP_DHCP_DUID] = - g_param_spec_string (NM_SETTING_IP6_CONFIG_DHCP_DUID, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS); + obj_properties[PROP_DHCP_DUID] = + g_param_spec_string(NM_SETTING_IP6_CONFIG_DHCP_DUID, + "", + "", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - /* IP6-specific property overrides */ + /* IP6-specific property overrides */ - /* ---dbus--- + /* ---dbus--- * property: dns * format: array of byte array * description: Array of IP addresses of DNS servers (in network byte order) * ---end--- */ - _nm_properties_override_gobj (properties_override, - g_object_class_find_property (G_OBJECT_CLASS (setting_class), - NM_SETTING_IP_CONFIG_DNS), - NM_SETT_INFO_PROPERT_TYPE ( - .dbus_type = NM_G_VARIANT_TYPE ("aay"), - .gprop_to_dbus_fcn = ip6_dns_to_dbus, - .gprop_from_dbus_fcn = ip6_dns_from_dbus, - )); - - /* ---dbus--- + _nm_properties_override_gobj( + properties_override, + g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_DNS), + NM_SETT_INFO_PROPERT_TYPE(.dbus_type = NM_G_VARIANT_TYPE("aay"), + .gprop_to_dbus_fcn = ip6_dns_to_dbus, + .gprop_from_dbus_fcn = ip6_dns_from_dbus, )); + + /* ---dbus--- * property: addresses * format: array of legacy IPv6 address struct (a(ayuay)) * description: Deprecated in favor of the 'address-data' and 'gateway' @@ -971,16 +1013,14 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * that subnet. * ---end--- */ - _nm_properties_override_gobj (properties_override, - g_object_class_find_property (G_OBJECT_CLASS (setting_class), - NM_SETTING_IP_CONFIG_ADDRESSES), - NM_SETT_INFO_PROPERT_TYPE ( - .dbus_type = NM_G_VARIANT_TYPE ("a(ayuay)"), - .to_dbus_fcn = ip6_addresses_get, - .from_dbus_fcn = ip6_addresses_set, - )); - - /* ---dbus--- + _nm_properties_override_gobj( + properties_override, + g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_ADDRESSES), + NM_SETT_INFO_PROPERT_TYPE(.dbus_type = NM_G_VARIANT_TYPE("a(ayuay)"), + .to_dbus_fcn = ip6_addresses_get, + .from_dbus_fcn = ip6_addresses_set, )); + + /* ---dbus--- * property: address-data * format: array of vardict * description: Array of IPv6 addresses. Each address dictionary contains at @@ -989,15 +1029,14 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * also exist on some addresses. * ---end--- */ - _nm_properties_override_dbus (properties_override, - "address-data", - NM_SETT_INFO_PROPERT_TYPE ( - .dbus_type = NM_G_VARIANT_TYPE ("aa{sv}"), - .to_dbus_fcn = ip6_address_data_get, - .from_dbus_fcn = ip6_address_data_set, - )); - - /* ---dbus--- + _nm_properties_override_dbus( + properties_override, + "address-data", + NM_SETT_INFO_PROPERT_TYPE(.dbus_type = NM_G_VARIANT_TYPE("aa{sv}"), + .to_dbus_fcn = ip6_address_data_get, + .from_dbus_fcn = ip6_address_data_set, )); + + /* ---dbus--- * property: routes * format: array of legacy IPv6 route struct (a(ayuayu)) * description: Deprecated in favor of the 'route-data' property, but this @@ -1011,16 +1050,14 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * default metric for the device. * ---end--- */ - _nm_properties_override_gobj (properties_override, - g_object_class_find_property (G_OBJECT_CLASS (setting_class), - NM_SETTING_IP_CONFIG_ROUTES), - NM_SETT_INFO_PROPERT_TYPE ( - .dbus_type = NM_G_VARIANT_TYPE ("a(ayuayu)"), - .to_dbus_fcn = ip6_routes_get, - .from_dbus_fcn = ip6_routes_set, - )); - - /* ---dbus--- + _nm_properties_override_gobj( + properties_override, + g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_ROUTES), + NM_SETT_INFO_PROPERT_TYPE(.dbus_type = NM_G_VARIANT_TYPE("a(ayuayu)"), + .to_dbus_fcn = ip6_routes_get, + .from_dbus_fcn = ip6_routes_set, )); + + /* ---dbus--- * property: route-data * format: array of vardict * description: Array of IPv6 routes. Each route dictionary contains at @@ -1033,16 +1070,16 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) * also exist on some routes. * ---end--- */ - _nm_properties_override_dbus (properties_override, - "route-data", - NM_SETT_INFO_PROPERT_TYPE ( - .dbus_type = NM_G_VARIANT_TYPE ("aa{sv}"), - .to_dbus_fcn = ip6_route_data_get, - .from_dbus_fcn = ip6_route_data_set, - )); - - g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); - - _nm_setting_class_commit_full (setting_class, NM_META_SETTING_TYPE_IP6_CONFIG, - NULL, properties_override); + _nm_properties_override_dbus(properties_override, + "route-data", + NM_SETT_INFO_PROPERT_TYPE(.dbus_type = NM_G_VARIANT_TYPE("aa{sv}"), + .to_dbus_fcn = ip6_route_data_get, + .from_dbus_fcn = ip6_route_data_set, )); + + g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties); + + _nm_setting_class_commit_full(setting_class, + NM_META_SETTING_TYPE_IP6_CONFIG, + NULL, + properties_override); } |