merge: branch 'bg/dhcp-timeout-property-bgo761464'

https://bugzilla.gnome.org/show_bug.cgi?id=761464
This commit is contained in:
Beniamino Galvani 2016-02-16 11:38:12 +01:00
commit 3ac6769e60
10 changed files with 55 additions and 55 deletions

View file

@ -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,

View file

@ -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));
}

View file

@ -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

View file

@ -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
@ -102,26 +100,6 @@ nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting)
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_client_id;
}
/**
* 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:

View file

@ -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

View file

@ -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 },

View file

@ -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;

View file

@ -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;

View 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_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);

View file

@ -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);