summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaesub kim <taesub.kim@samsung.com>2016-06-13 02:20:52 (GMT)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2016-06-13 02:20:53 (GMT)
commit74b79a30bb7d74d9b7d3ff0e8dd122f64e847e5f (patch)
treececd2bb55b98ae4c637238facdc7239be8da32d0
parent994f590a7fd8de241481c4335cf22675afefefc9 (diff)
parent1a1a27626501580e4d6e0490cdd1bd39653a753e (diff)
downloadconnman-74b79a30bb7d74d9b7d3ff0e8dd122f64e847e5f.zip
connman-74b79a30bb7d74d9b7d3ff0e8dd122f64e847e5f.tar.gz
connman-74b79a30bb7d74d9b7d3ff0e8dd122f64e847e5f.tar.bz2
Merge "[SPIN] Restart dhcp as soon as INIT-REBOOT has been failed" into tizen
-rwxr-xr-xgdhcp/client.c49
-rwxr-xr-xgdhcp/gdhcp.h4
2 files changed, 53 insertions, 0 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 2c442e5..9b2de9d 100755
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -156,6 +156,9 @@ struct _GDHCPClient {
bool retransmit;
struct timeval start_time;
bool request_bcast;
+#if defined TIZEN_EXT
+ gboolean init_reboot;
+#endif
};
static inline void debug(GDHCPClient *client, const char *format, ...)
@@ -480,6 +483,9 @@ static int send_request(GDHCPClient *dhcp_client)
init_packet(dhcp_client, &packet, DHCPREQUEST);
packet.xid = dhcp_client->xid;
+#if defined TIZEN_EXT
+ if (dhcp_client->init_reboot != TRUE)
+#endif
packet.secs = dhcp_attempt_secs(dhcp_client);
if (dhcp_client->state == REQUESTING || dhcp_client->state == REBOOTING)
@@ -1513,6 +1519,21 @@ static gboolean request_timeout(gpointer user_data)
{
GDHCPClient *dhcp_client = user_data;
+#if defined TIZEN_EXT
+ if (dhcp_client->init_reboot) {
+ debug(dhcp_client, "DHCPREQUEST of INIT-REBOOT has failed");
+
+ /* Start DHCPDISCOVERY when DHCPREQUEST of INIT-REBOOT has failed */
+ g_dhcp_client_set_address_known(dhcp_client, FALSE);
+
+ dhcp_client->retry_times = 0;
+ dhcp_client->requested_ip = 0;
+
+ g_dhcp_client_start(dhcp_client, dhcp_client->last_address);
+
+ return FALSE;
+ }
+#endif
debug(dhcp_client, "request timeout (retries %d)",
dhcp_client->retry_times);
@@ -2362,6 +2383,18 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
remove_timeouts(dhcp_client);
+#if defined TIZEN_EXT
+ if (dhcp_client->init_reboot) {
+ g_dhcp_client_set_address_known(dhcp_client, FALSE);
+ dhcp_client->timeout = g_idle_add_full(
+ G_PRIORITY_HIGH,
+ restart_dhcp_timeout,
+ dhcp_client,
+ NULL);
+
+ break;
+ }
+#endif
dhcp_client->timeout = g_timeout_add_seconds_full(
G_PRIORITY_HIGH, 3,
restart_dhcp_timeout,
@@ -3205,3 +3238,19 @@ GSList *g_dhcpv6_copy_prefixes(GSList *prefixes)
return copy;
}
+
+#if defined TIZEN_EXT
+void g_dhcp_client_set_address_known(GDHCPClient *dhcp_client, gboolean known)
+{
+ /* DHCPREQUEST during INIT-REBOOT state (rfc2131)
+ * 4.4.3 Initialization with known network address
+ * 4.3.2 DHCPREQUEST generated during INIT-REBOOT state
+ */
+ debug(dhcp_client, "known network address (%d)", known);
+
+ if (dhcp_client->init_reboot == known)
+ return;
+
+ dhcp_client->init_reboot = known;
+}
+#endif
diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h
index 22fa9f4..59b562b 100755
--- a/gdhcp/gdhcp.h
+++ b/gdhcp/gdhcp.h
@@ -238,6 +238,10 @@ void g_dhcp_server_set_save_ack_lease(GDHCPServer *dhcp_server,
int dhcp_get_random(uint64_t *val);
void dhcp_cleanup_random(void);
+#if defined TIZEN_EXT
+void g_dhcp_client_set_address_known(GDHCPClient *client, gboolean known);
+#endif
+
#ifdef __cplusplus
}
#endif