libnm-core: make ipvx.dhcp-timeout signed
authorBeniamino Galvani <bgalvani@redhat.com>
Fri, 5 Feb 2016 07:47:38 +0000 (08:47 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Tue, 16 Feb 2016 10:37:26 +0000 (11:37 +0100)
Change the dhcp-timeout property in NMSettingIPConfig to int type for
consistency with the dad-timeout property. For dad-timeout -1 means
"use default value", while for dhcp-timeout probably we will never use
negative values, but it seems more correct to use the same type for
the two properties.

clients/cli/settings.c
libnm-core/nm-setting-ip-config.c
src/settings/plugins/ifcfg-rh/reader.c

index 51ac2ff..c341ce7 100644 (file)
@@ -6462,7 +6462,7 @@ nmc_properties_init (void)
                            NULL);
        nmc_add_prop_funcs (GLUE_IP (4, DHCP_TIMEOUT),
                            nmc_property_ipv4_get_dhcp_timeout,
-                           nmc_property_set_uint,
+                           nmc_property_set_int,
                            NULL,
                            NULL,
                            NULL,
index 9db10a3..5454b4d 100644 (file)
@@ -2391,7 +2391,7 @@ set_property (GObject *object, guint prop_id,
                priv->dad_timeout = g_value_get_int (value);
                break;
        case PROP_DHCP_TIMEOUT:
-               priv->dhcp_timeout = g_value_get_uint (value);
+               priv->dhcp_timeout = g_value_get_int (value);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2457,7 +2457,7 @@ get_property (GObject *object, guint prop_id,
                g_value_set_int (value, nm_setting_ip_config_get_dad_timeout (setting));
                break;
        case PROP_DHCP_TIMEOUT:
-               g_value_set_uint (value, nm_setting_ip_config_get_dhcp_timeout (setting));
+               g_value_set_int (value, nm_setting_ip_config_get_dhcp_timeout (setting));
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2768,9 +2768,9 @@ nm_setting_ip_config_class_init (NMSettingIPConfigClass *setting_class)
         **/
        g_object_class_install_property
                (object_class, PROP_DHCP_TIMEOUT,
-                g_param_spec_uint (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, "", "",
-                                   0, G_MAXUINT32, 0,
-                                   G_PARAM_READWRITE |
-                                   NM_SETTING_PARAM_FUZZY_IGNORE |
-                                   G_PARAM_STATIC_STRINGS));
+                g_param_spec_int (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, "", "",
+                                  0, G_MAXINT32, 0,
+                                  G_PARAM_READWRITE |
+                                  NM_SETTING_PARAM_FUZZY_IGNORE |
+                                  G_PARAM_STATIC_STRINGS));
 }
index 9ce1458..0f79ca0 100644 (file)
@@ -1040,7 +1040,7 @@ make_ip4_setting (shvarFile *ifcfg,
 
                g_object_set (s_ip4,
                              NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, svGetValueBoolean (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
-                             NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, svGetValueInt64 (ifcfg, "IPV4_DHCP_TIMEOUT", 10, 0, G_MAXUINT32, 0),
+                             NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, svGetValueInt64 (ifcfg, "IPV4_DHCP_TIMEOUT", 10, 0, G_MAXINT32, 0),
                              NULL);
 
                value = svGetValue (ifcfg, "DHCP_CLIENT_ID", FALSE);