diff options
| author | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-02-22 16:46:07 -0500 |
|---|---|---|
| committer | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-02-22 16:46:07 -0500 |
| commit | 297ac7f51b68aaa0e281336e6c6154bb2c913580 (patch) | |
| tree | ff98cec3cc8eeb03b58cfeae184f2da4bfa6c93f /src/libnm-core-impl/nm-setting-ip4-config.c | |
| parent | c713c9f47084b639644c0b9a8bb04faa3ccd21e3 (diff) | |
| parent | 7d8baf4ac0480a542f000c1201df85427a22332c (diff) | |
Update to upstream version '1.35.90
Diffstat (limited to 'src/libnm-core-impl/nm-setting-ip4-config.c')
| -rw-r--r-- | src/libnm-core-impl/nm-setting-ip4-config.c | 73 |
1 files changed, 13 insertions, 60 deletions
diff --git a/src/libnm-core-impl/nm-setting-ip4-config.c b/src/libnm-core-impl/nm-setting-ip4-config.c index a7b3d68b..6c2ba10d 100644 --- a/src/libnm-core-impl/nm-setting-ip4-config.c +++ b/src/libnm-core-impl/nm-setting-ip4-config.c @@ -131,9 +131,9 @@ static gboolean verify(NMSetting *setting, NMConnection *connection, GError **error) { NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE(setting); - NMSettingIPConfig * s_ip = NM_SETTING_IP_CONFIG(setting); + NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG(setting); NMSettingVerifyResult ret; - const char * method; + const char *method; ret = NM_SETTING_CLASS(nm_setting_ip4_config_parent_class)->verify(setting, connection, error); if (ret != NM_SETTING_VERIFY_SUCCESS) @@ -344,7 +344,7 @@ static GVariant * ip4_addresses_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil) { gs_unref_ptrarray GPtrArray *addrs = NULL; - const char * gateway; + 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)); @@ -355,8 +355,8 @@ static gboolean ip4_addresses_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil) { GPtrArray *addrs; - GVariant * s_ip4; - char ** labels, *gateway = NULL; + GVariant *s_ip4; + char **labels, *gateway = NULL; int i; /* FIXME: properly handle errors */ @@ -397,8 +397,8 @@ 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; - GPtrArray * labels; - GVariant * ret; + GPtrArray *labels; + GVariant *ret; int num_addrs, i; if (!_nm_connection_serialize_non_secret(flags)) @@ -407,7 +407,7 @@ ip4_address_labels_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil) num_addrs = nm_setting_ip_config_get_num_addresses(s_ip); for (i = 0; i < num_addrs; i++) { NMIPAddress *addr = nm_setting_ip_config_get_address(s_ip, i); - GVariant * label = nm_ip_address_get_attribute(addr, NM_IP_ADDRESS_ATTRIBUTE_LABEL); + GVariant *label = nm_ip_address_get_attribute(addr, NM_IP_ADDRESS_ATTRIBUTE_LABEL); if (label) { have_labels = TRUE; @@ -420,7 +420,7 @@ ip4_address_labels_get(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil) labels = g_ptr_array_sized_new(num_addrs); for (i = 0; i < num_addrs; i++) { NMIPAddress *addr = nm_setting_ip_config_get_address(s_ip, i); - GVariant * label = nm_ip_address_get_attribute(addr, NM_IP_ADDRESS_ATTRIBUTE_LABEL); + GVariant *label = nm_ip_address_get_attribute(addr, NM_IP_ADDRESS_ATTRIBUTE_LABEL); g_ptr_array_add(labels, (char *) (label ? g_variant_get_string(label, NULL) : "")); } @@ -523,53 +523,6 @@ ip4_route_data_set(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil) /*****************************************************************************/ static void -get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG(object); - - switch (prop_id) { - case PROP_DHCP_CLIENT_ID: - g_value_set_string(value, nm_setting_ip4_config_get_dhcp_client_id(s_ip4)); - break; - case PROP_DHCP_FQDN: - g_value_set_string(value, nm_setting_ip4_config_get_dhcp_fqdn(s_ip4)); - break; - case PROP_DHCP_VENDOR_CLASS_IDENTIFIER: - g_value_set_string(value, nm_setting_ip4_config_get_dhcp_vendor_class_identifier(s_ip4)); - 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) -{ - NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_DHCP_CLIENT_ID: - g_free(priv->dhcp_client_id); - priv->dhcp_client_id = g_value_dup_string(value); - break; - case PROP_DHCP_FQDN: - g_free(priv->dhcp_fqdn); - priv->dhcp_fqdn = g_value_dup_string(value); - break; - case PROP_DHCP_VENDOR_CLASS_IDENTIFIER: - g_free(priv->dhcp_vendor_class_identifier); - priv->dhcp_vendor_class_identifier = g_value_dup_string(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; - } -} - -/*****************************************************************************/ - -static void nm_setting_ip4_config_init(NMSettingIP4Config *setting) { NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE(setting); @@ -593,15 +546,15 @@ nm_setting_ip4_config_new(void) static void nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) { - GObjectClass * object_class = G_OBJECT_CLASS(klass); - NMSettingClass * setting_class = NM_SETTING_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS(klass); + NMSettingClass *setting_class = NM_SETTING_CLASS(klass); NMSettingIPConfigClass *setting_ip_config_class = NM_SETTING_IP_CONFIG_CLASS(klass); GArray *properties_override = _nm_sett_info_property_override_create_array_ip_config(AF_INET); g_type_class_add_private(klass, sizeof(NMSettingIP4ConfigPrivate)); - object_class->get_property = get_property; - object_class->set_property = set_property; + object_class->get_property = _nm_setting_property_get_property_direct; + object_class->set_property = _nm_setting_property_set_property_direct; setting_class->verify = verify; |