mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 02:50:10 +01:00
device: introduce a global default value for ipv4.dhcp-timeout
This allows the ipv4.dhcp-timeout default value to be set from user configuration. https://bugzilla.gnome.org/show_bug.cgi?id=756423
This commit is contained in:
parent
b1ab958def
commit
9184418b2e
2 changed files with 28 additions and 1 deletions
|
|
@ -583,6 +583,11 @@ ipv6.ip6-privacy=1
|
|||
<varlistentry>
|
||||
<term><varname>ipv4.route-metric</varname></term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>ipv4.dhcp-timeout</varname></term>
|
||||
<listitem><para>If left unspecified, the default value for
|
||||
the interface type is used.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>ipv6.ip6-privacy</varname></term>
|
||||
<listitem><para>If <literal>ipv6.ip6-privacy</literal> is unset, use the content of
|
||||
|
|
|
|||
|
|
@ -3883,6 +3883,28 @@ dhcp4_state_changed (NMDhcpClient *client,
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
dhcp4_get_timeout (NMDevice *self, NMSettingIP4Config *s_ip4)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
gs_free char *value = NULL;
|
||||
int timeout;
|
||||
|
||||
timeout = nm_setting_ip4_config_get_dhcp_timeout (s_ip4);
|
||||
if (timeout)
|
||||
return timeout;
|
||||
|
||||
value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"ipv4.dhcp-timeout",
|
||||
self);
|
||||
timeout = _nm_utils_ascii_str_to_int64 (value, 10,
|
||||
0, G_MAXINT32, 0);
|
||||
if (timeout)
|
||||
return timeout;
|
||||
|
||||
return priv->dhcp_timeout;
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
dhcp4_start (NMDevice *self,
|
||||
NMConnection *connection,
|
||||
|
|
@ -3918,7 +3940,7 @@ dhcp4_start (NMDevice *self,
|
|||
nm_setting_ip_config_get_dhcp_send_hostname (s_ip4),
|
||||
nm_setting_ip_config_get_dhcp_hostname (s_ip4),
|
||||
nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)),
|
||||
nm_setting_ip4_config_get_dhcp_timeout (NM_SETTING_IP4_CONFIG (s_ip4)) ?: priv->dhcp_timeout,
|
||||
dhcp4_get_timeout (self, NM_SETTING_IP4_CONFIG (s_ip4)),
|
||||
priv->dhcp_anycast_address,
|
||||
NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue