summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-02-16 11:38:12 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2016-02-16 11:38:12 +0100
commit3ac6769e60d2c0fb88421cea199292e6279e40e0 (patch)
treed3bbd1cb1b2309ade384e5425067d23ae3109c02
parenta058cf41dc8dd6f952c4652ae689f3ed8ac042d6 (diff)
parentb6f98126c7d184245466cc15e08d482825315837 (diff)
downloadNetworkManager-3ac6769e60d2c0fb88421cea199292e6279e40e0.tar.gz
merge: branch 'bg/dhcp-timeout-property-bgo761464'
https://bugzilla.gnome.org/show_bug.cgi?id=761464
-rw-r--r--clients/cli/settings.c10
-rw-r--r--libnm-core/nm-setting-ip-config.c40
-rw-r--r--libnm-core/nm-setting-ip-config.h3
-rw-r--r--libnm-core/nm-setting-ip4-config.c44
-rw-r--r--libnm-core/nm-setting-ip4-config.h3
-rw-r--r--libnm-core/tests/test-general.c2
-rw-r--r--libnm/libnm.ver2
-rw-r--r--src/devices/nm-device.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c2
10 files changed, 55 insertions, 55 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index 71d3713d9d..c341ce72d2 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -276,7 +276,7 @@ NmcOutputField nmc_fields_setting_ip4_config[] = {
SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES), /* 9 */
SETTING_FIELD (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS), /* 10 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID), /* 11 */
- SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT), /* 12 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT), /* 12 */
SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 13 */
SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 14 */
SETTING_FIELD (NM_SETTING_IP4_CONFIG_DHCP_FQDN), /* 15 */
@@ -297,7 +297,7 @@ NmcOutputField nmc_fields_setting_ip4_config[] = {
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES","\
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS","\
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID","\
- NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT","\
+ NM_SETTING_IP_CONFIG_DHCP_TIMEOUT","\
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME","\
NM_SETTING_IP_CONFIG_DHCP_HOSTNAME","\
NM_SETTING_IP4_CONFIG_DHCP_FQDN","\
@@ -1516,7 +1516,7 @@ DEFINE_GETTER (nmc_property_ipv4_get_route_metric, NM_SETTING_IP_CONFIG_ROUTE_ME
DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_routes, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES)
DEFINE_GETTER (nmc_property_ipv4_get_ignore_auto_dns, NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS)
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_client_id, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID)
-DEFINE_GETTER (nmc_property_ipv4_get_dhcp_timeout, NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT)
+DEFINE_GETTER (nmc_property_ipv4_get_dhcp_timeout, NM_SETTING_IP_CONFIG_DHCP_TIMEOUT)
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_send_hostname, NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME)
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_hostname, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME)
DEFINE_GETTER (nmc_property_ipv4_get_dhcp_fqdn, NM_SETTING_IP4_CONFIG_DHCP_FQDN)
@@ -6460,9 +6460,9 @@ nmc_properties_init (void)
NULL,
NULL,
NULL);
- nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_TIMEOUT),
+ 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,
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 83af52f1e0..5454b4dbb7 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -1126,6 +1126,7 @@ typedef struct {
gboolean never_default;
gboolean may_fail;
gint dad_timeout;
+ gint dhcp_timeout;
} NMSettingIPConfigPrivate;
enum {
@@ -1145,6 +1146,7 @@ enum {
PROP_NEVER_DEFAULT,
PROP_MAY_FAIL,
PROP_DAD_TIMEOUT,
+ PROP_DHCP_TIMEOUT,
LAST_PROP
};
@@ -2105,6 +2107,26 @@ nm_setting_ip_config_get_dad_timeout (NMSettingIPConfig *setting)
return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dad_timeout;
}
+/**
+ * nm_setting_ip_config_get_dhcp_timeout:
+ * @setting: the #NMSettingIPConfig
+ *
+ * Returns the value contained in the #NMSettingIPConfig:dhcp-timeout
+ * property.
+ *
+ * Returns: the configured DHCP timeout in seconds. 0 = default for
+ * the particular kind of device.
+ *
+ * Since: 1.2
+ **/
+gint
+nm_setting_ip_config_get_dhcp_timeout (NMSettingIPConfig *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0);
+
+ return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dhcp_timeout;
+}
+
static gboolean
verify_label (const char *label)
{
@@ -2368,6 +2390,9 @@ set_property (GObject *object, guint prop_id,
case PROP_DAD_TIMEOUT:
priv->dad_timeout = g_value_get_int (value);
break;
+ case PROP_DHCP_TIMEOUT:
+ priv->dhcp_timeout = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2431,6 +2456,9 @@ get_property (GObject *object, guint prop_id,
case PROP_DAD_TIMEOUT:
g_value_set_int (value, nm_setting_ip_config_get_dad_timeout (setting));
break;
+ case PROP_DHCP_TIMEOUT:
+ 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);
break;
@@ -2733,4 +2761,16 @@ nm_setting_ip_config_class_init (NMSettingIPConfigClass *setting_class)
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_FUZZY_IGNORE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * NMSettingIPConfig:dhcp-timeout:
+ *
+ * A timeout for a DHCP transaction in seconds.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP_TIMEOUT,
+ 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));
}
diff --git a/libnm-core/nm-setting-ip-config.h b/libnm-core/nm-setting-ip-config.h
index 3cd0daf763..6d18233875 100644
--- a/libnm-core/nm-setting-ip-config.h
+++ b/libnm-core/nm-setting-ip-config.h
@@ -147,6 +147,7 @@ void nm_ip_route_set_attribute (NMIPRoute *route,
#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
#define NM_SETTING_IP_CONFIG_DAD_TIMEOUT "dad-timeout"
+#define NM_SETTING_IP_CONFIG_DHCP_TIMEOUT "dhcp-timeout"
#define NM_SETTING_DNS_OPTION_DEBUG "debug"
#define NM_SETTING_DNS_OPTION_NDOTS "ndots"
@@ -250,6 +251,8 @@ gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig
gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting);
NM_AVAILABLE_IN_1_2
gint nm_setting_ip_config_get_dad_timeout (NMSettingIPConfig *setting);
+NM_AVAILABLE_IN_1_2
+gint nm_setting_ip_config_get_dhcp_timeout (NMSettingIPConfig *setting);
G_END_DECLS
diff --git a/libnm-core/nm-setting-ip4-config.c b/libnm-core/nm-setting-ip4-config.c
index 35dbba4939..fec38eb7ff 100644
--- a/libnm-core/nm-setting-ip4-config.c
+++ b/libnm-core/nm-setting-ip4-config.c
@@ -58,14 +58,12 @@ NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_IP4_CONFIG)
typedef struct {
char *dhcp_client_id;
- int dhcp_timeout;
char *dhcp_fqdn;
} NMSettingIP4ConfigPrivate;
enum {
PROP_0,
PROP_DHCP_CLIENT_ID,
- PROP_DHCP_TIMEOUT,
PROP_DHCP_FQDN,
LAST_PROP
@@ -103,26 +101,6 @@ nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting)
}
/**
- * nm_setting_ip4_config_get_dhcp_timeout:
- * @setting: the #NMSettingIP4Config
- *
- * Returns the value contained in the #NMSettingIP4Config:dhcp-timeout
- * property.
- *
- * Returns: the configured DHCP timeout in seconds. 0 = default for
- * the particular kind of device.
- *
- * Since: 1.2
- **/
-int
-nm_setting_ip4_config_get_dhcp_timeout (NMSettingIP4Config *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0);
-
- return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_timeout;
-}
-
-/**
* nm_setting_ip4_config_get_dhcp_fqdn:
* @setting: the #NMSettingIP4Config
*
@@ -277,9 +255,6 @@ set_property (GObject *object, guint prop_id,
g_free (priv->dhcp_client_id);
priv->dhcp_client_id = g_value_dup_string (value);
break;
- case PROP_DHCP_TIMEOUT:
- priv->dhcp_timeout = g_value_get_uint (value);
- break;
case PROP_DHCP_FQDN:
g_free (priv->dhcp_fqdn);
priv->dhcp_fqdn = g_value_dup_string (value);
@@ -300,9 +275,6 @@ get_property (GObject *object, guint 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_TIMEOUT:
- g_value_set_uint (value, nm_setting_ip4_config_get_dhcp_timeout (s_ip4));
- break;
case PROP_DHCP_FQDN:
g_value_set_string (value, nm_setting_ip4_config_get_dhcp_fqdn (s_ip4));
break;
@@ -692,25 +664,13 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *ip4_class)
* ---end---
*/
- /**
- * NMSettingIP4Config:dhcp-timeout:
- *
- * A timeout for a DHCP transaction in seconds.
- **/
/* ---ifcfg-rh---
* property: dhcp-timeout
- * variable: DHCP_TIMEOUT(+)
+ * variable: IPV4_DHCP_TIMEOUT(+)
* description: A timeout after which the DHCP transaction fails in case of no response.
- * example: DHCP_TIMEOUT=10
+ * example: IPV4_DHCP_TIMEOUT=10
* ---end---
*/
- g_object_class_install_property
- (object_class, PROP_DHCP_TIMEOUT,
- g_param_spec_uint (NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT, "", "",
- 0, G_MAXUINT32, 0,
- G_PARAM_READWRITE |
- NM_SETTING_PARAM_FUZZY_IGNORE |
- G_PARAM_STATIC_STRINGS));
/**
* NMSettingIP4Config:dhcp-fqdn:
diff --git a/libnm-core/nm-setting-ip4-config.h b/libnm-core/nm-setting-ip4-config.h
index a78df70334..8e6524cb4f 100644
--- a/libnm-core/nm-setting-ip4-config.h
+++ b/libnm-core/nm-setting-ip4-config.h
@@ -41,7 +41,6 @@ G_BEGIN_DECLS
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4"
#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id"
-#define NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT "dhcp-timeout"
#define NM_SETTING_IP4_CONFIG_DHCP_FQDN "dhcp-fqdn"
/**
@@ -105,8 +104,6 @@ NMSetting *nm_setting_ip4_config_new (void);
const char *nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting);
NM_AVAILABLE_IN_1_2
-int nm_setting_ip4_config_get_dhcp_timeout (NMSettingIP4Config *setting);
-NM_AVAILABLE_IN_1_2
const char *nm_setting_ip4_config_get_dhcp_fqdn (NMSettingIP4Config *setting);
G_END_DECLS
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index 749653062a..80e2d001f3 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -1956,7 +1956,7 @@ test_connection_diff_a_only (void)
{ NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A },
- { NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A },
+ { NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DHCP_FQDN, NM_SETTING_DIFF_RESULT_IN_A },
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 944c49bef3..e3ede1d213 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -952,12 +952,12 @@ global:
nm_setting_gsm_get_sim_id;
nm_setting_gsm_get_sim_operator_id;
nm_setting_ip4_config_get_dhcp_fqdn;
- nm_setting_ip4_config_get_dhcp_timeout;
nm_setting_ip6_config_addr_gen_mode_get_type;
nm_setting_ip6_config_get_addr_gen_mode;
nm_setting_ip_config_add_dns_option;
nm_setting_ip_config_clear_dns_options;
nm_setting_ip_config_get_dad_timeout;
+ nm_setting_ip_config_get_dhcp_timeout;
nm_setting_ip_config_get_dns_option;
nm_setting_ip_config_get_num_dns_options;
nm_setting_ip_config_has_dns_options;
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e5b5e63472..711ac2acb0 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4499,7 +4499,7 @@ dhcp4_get_timeout (NMDevice *self, NMSettingIP4Config *s_ip4)
gs_free char *value = NULL;
int timeout;
- timeout = nm_setting_ip4_config_get_dhcp_timeout (s_ip4);
+ timeout = nm_setting_ip_config_get_dhcp_timeout (NM_SETTING_IP_CONFIG (s_ip4));
if (timeout)
return timeout;
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 042ad9a034..0f79ca07aa 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -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_IP4_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);
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index a524b7b79d..73d1dc546c 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -2165,7 +2165,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
if (value)
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
- timeout = nm_setting_ip4_config_get_dhcp_timeout (NM_SETTING_IP4_CONFIG (s_ip4));
+ timeout = nm_setting_ip_config_get_dhcp_timeout (s_ip4);
tmp = timeout ? g_strdup_printf ("%d", timeout) : NULL;
svSetValue (ifcfg, "IPV4_DHCP_TIMEOUT", tmp, FALSE);
g_free (tmp);