return -EINVAL;
if (T1)
- *T1 = dhcp_client->T1;
+ *T1 = (dhcp_client->expire == 0xffffffff) ? 0xffffffff:
+ dhcp_client->T1;
if (T2)
- *T2 = dhcp_client->T2;
+ *T2 = (dhcp_client->expire == 0xffffffff) ? 0xffffffff:
+ dhcp_client->T2;
if (started)
*started = dhcp_client->last_request;
if (expire)
- *expire = dhcp_client->last_request + dhcp_client->expire;
+ *expire = (dhcp_client->expire == 0xffffffff) ? 0xffffffff:
+ dhcp_client->last_request + dhcp_client->expire;
return 0;
}
g_dhcpv6_client_get_timeouts(dhcp->dhcp_client, NULL, NULL,
NULL, &expired);
+
+ /* infinite lifetime for an DHCPv6 address */
+ if (expired == 0xffffffff)
+ return -EISCONN;
+
current = time(NULL);
if (current >= expired) {
DBG("expired by %d secs", (int)(current - expired));
- g_timeout_add(0, dhcpv6_restart, dhcp);
+ g_idle_add(dhcpv6_restart, dhcp);
return -ETIMEDOUT;
}
/* RFC 3315, chapter 18.1.3, start rebind */
DBG("start rebind immediately");
- dhcp->timeout = g_timeout_add_seconds(0, start_rebind,
- dhcp);
+ dhcp->timeout = g_idle_add(start_rebind, dhcp);
} else if ((unsigned)current < (unsigned)started + T1) {
delta = started + T1 - current;
if (current > expired) {
DBG("expired by %d secs", (int)(current - expired));
- g_timeout_add(0, dhcpv6_restart, dhcp);
+ g_idle_add(dhcpv6_restart, dhcp);
return -ETIMEDOUT;
}