apply upstream fixes 56/122156/1 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170403.190030 accepted/tizen/ivi/20170403.124556 accepted/tizen/mobile/20170403.124303 accepted/tizen/tv/20170403.124414 accepted/tizen/unified/20170403.124614 accepted/tizen/wearable/20170403.124441 submit/tizen/20170403.015738
authorEun Chul Kim <ec4537.kim@samsung.com>
Mon, 27 Feb 2017 06:57:08 +0000 (15:57 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 30 Mar 2017 09:46:32 +0000 (18:46 +0900)
 - Replace g_timeout_add_seconds() with 0 as timeout to g_idle_add()
 - gdhcp: Set T1 and T2 to infinite if expiry time is infinite
 - dhcpv6: Return -EISCONN when the expiry time is inifinite

Change-Id: I59ddd9b4c2d1af0f1ee8898381bc0372fba8e8ad

gdhcp/client.c
src/dhcpv6.c

index 3157632..7e04176 100755 (executable)
@@ -854,16 +854,19 @@ int g_dhcpv6_client_get_timeouts(GDHCPClient *dhcp_client,
                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;
 }
index 55dcd61..bf4da3e 100755 (executable)
@@ -1234,12 +1234,17 @@ static int check_restart(struct connman_dhcpv6 *dhcp)
 
        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;
        }
@@ -1498,8 +1503,7 @@ int __connman_dhcpv6_start_renew(struct connman_network *network,
                        /* 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;
@@ -2205,7 +2209,7 @@ static int check_pd_restart(struct connman_dhcpv6 *dhcp)
        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;
        }