mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-15 08:00:37 +01:00
dhcp: consider a timeout equal to MAXINT32 as infinity
This will avoid to spawn internally a timer for the lease to complete.
This commit is contained in:
parent
239c59a627
commit
a245554984
2 changed files with 14 additions and 3 deletions
|
|
@ -404,6 +404,10 @@ nm_dhcp_client_start_timeout (NMDhcpClient *self)
|
|||
|
||||
/* Set up a timeout on the transaction to kill it after the timeout */
|
||||
g_assert (priv->timeout_id == 0);
|
||||
|
||||
if (priv->timeout == NM_DHCP_TIMEOUT_INFINITY)
|
||||
return;
|
||||
|
||||
priv->timeout_id = g_timeout_add_seconds (priv->timeout,
|
||||
transaction_timeout,
|
||||
self);
|
||||
|
|
@ -441,7 +445,10 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
|
|||
g_return_val_if_fail (priv->addr_family == AF_INET, FALSE);
|
||||
g_return_val_if_fail (priv->uuid != NULL, FALSE);
|
||||
|
||||
_LOGI ("activation: beginning transaction (timeout in %u seconds)", (guint) priv->timeout);
|
||||
if (priv->timeout == NM_DHCP_TIMEOUT_INFINITY)
|
||||
_LOGI ("activation: beginning transaction (no timeout)");
|
||||
else
|
||||
_LOGI ("activation: beginning transaction (timeout in %u seconds)", (guint) priv->timeout);
|
||||
|
||||
if (dhcp_client_id)
|
||||
tmp = nm_dhcp_utils_client_id_string_to_bytes (dhcp_client_id);
|
||||
|
|
@ -556,8 +563,10 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
|
|||
|
||||
priv->info_only = info_only;
|
||||
|
||||
_LOGI ("activation: beginning transaction (timeout in %u seconds)",
|
||||
(guint) priv->timeout);
|
||||
if (priv->timeout == NM_DHCP_TIMEOUT_INFINITY)
|
||||
_LOGI ("activation: beginning transaction (no timeout)");
|
||||
else
|
||||
_LOGI ("activation: beginning transaction (timeout in %u seconds)", (guint) priv->timeout);
|
||||
|
||||
return NM_DHCP_CLIENT_GET_CLASS (self)->ip6_start (self,
|
||||
dhcp_anycast_addr,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "nm-ip6-config.h"
|
||||
|
||||
#define NM_DHCP_TIMEOUT_DEFAULT ((guint32) 45) /* default DHCP timeout, in seconds */
|
||||
#define NM_DHCP_TIMEOUT_INFINITY G_MAXINT32
|
||||
|
||||
#define NM_TYPE_DHCP_CLIENT (nm_dhcp_client_get_type ())
|
||||
#define NM_DHCP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP_CLIENT, NMDhcpClient))
|
||||
|
|
@ -45,6 +46,7 @@
|
|||
#define NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED "state-changed"
|
||||
#define NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED "prefix-delegated"
|
||||
|
||||
|
||||
typedef enum {
|
||||
NM_DHCP_STATE_UNKNOWN = 0,
|
||||
NM_DHCP_STATE_BOUND, /* new lease or lease changed */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue