libnm-util: add ipv4.dhcp-timeout property

https://bugzilla.redhat.com/show_bug.cgi?id=1262922
This commit is contained in:
Lubomir Rintel
2015-09-28 19:19:29 +02:00
parent 3f0d595cc8
commit c17ab1b6ff
4 changed files with 44 additions and 0 deletions

View File

@@ -355,6 +355,7 @@ global:
nm_setting_ip4_config_get_dhcp_client_id;
nm_setting_ip4_config_get_dhcp_hostname;
nm_setting_ip4_config_get_dhcp_send_hostname;
nm_setting_ip4_config_get_dhcp_timeout;
nm_setting_ip4_config_get_dns;
nm_setting_ip4_config_get_dns_search;
nm_setting_ip4_config_get_ignore_auto_dns;

View File

@@ -82,6 +82,7 @@ typedef struct {
char *dhcp_client_id;
gboolean dhcp_send_hostname;
char *dhcp_hostname;
int dhcp_timeout;
gboolean never_default;
gboolean may_fail;
} NMSettingIP4ConfigPrivate;
@@ -97,6 +98,7 @@ enum {
PROP_IGNORE_AUTO_ROUTES,
PROP_IGNORE_AUTO_DNS,
PROP_DHCP_CLIENT_ID,
PROP_DHCP_TIMEOUT,
PROP_DHCP_SEND_HOSTNAME,
PROP_DHCP_HOSTNAME,
PROP_NEVER_DEFAULT,
@@ -800,6 +802,24 @@ nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting)
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
}
/**
* nm_setting_ip4_config_get_dhcp_timeout:
* @setting: the #NMSettingIP4Config
*
* Returns the value contained in the #NMSettingIP4Config:dhcp-timeout
* property.
*
* Returns: The number of seconds after which unfinished DHCP transaction
* fails or zero for "default".
**/
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_never_default:
* @setting: the #NMSettingIP4Config
@@ -1050,6 +1070,9 @@ set_property (GObject *object, guint prop_id,
g_free (priv->dhcp_hostname);
priv->dhcp_hostname = g_value_dup_string (value);
break;
case PROP_DHCP_TIMEOUT:
priv->dhcp_timeout = g_value_get_uint (value);
break;
case PROP_NEVER_DEFAULT:
priv->never_default = g_value_get_boolean (value);
break;
@@ -1103,6 +1126,9 @@ get_property (GObject *object, guint prop_id,
case PROP_DHCP_HOSTNAME:
g_value_set_string (value, nm_setting_ip4_config_get_dhcp_hostname (setting));
break;
case PROP_DHCP_TIMEOUT:
g_value_set_uint (value, nm_setting_ip4_config_get_dhcp_timeout (setting));
break;
case PROP_NEVER_DEFAULT:
g_value_set_boolean (value, priv->never_default);
break;
@@ -1325,6 +1351,19 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class)
NM_SETTING_PARAM_INFERRABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingIP4Config:dhcp-timeout:
*
* Number of seconds after which the unfinished DHCP transaction fails
* or zero for default.
**/
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 |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingIP4Config:never-default:
*

View File

@@ -66,6 +66,7 @@ GQuark nm_setting_ip4_config_error_quark (void);
#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id"
#define NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
#define NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT "dhcp-timeout"
#define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default"
#define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail"
@@ -223,6 +224,8 @@ gboolean nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *
const char * nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting);
gboolean nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting);
const char * nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting);
NM_AVAILABLE_IN_1_2
int nm_setting_ip4_config_get_dhcp_timeout (NMSettingIP4Config *setting);
gboolean nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting);

View File

@@ -1283,6 +1283,7 @@ test_connection_diff_a_only (void)
{ NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_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_IP4_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A },
{ NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A },