summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaesub kim <taesub.kim@samsung.com>2017-03-28 08:41:45 (GMT)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-03-28 08:41:45 (GMT)
commit619c30df57f62fbbc958f707f681ebe5ef4a5470 (patch)
treec80c870ce3542cef13fe5bb2ba1396b57def49fe
parent0d3b96f6fe23316f15444576b5a590a917beb8a5 (diff)
parente4d49d1aa74f8682807bf57a969795eb1bae1862 (diff)
downloadconnman-619c30df57f62fbbc958f707f681ebe5ef4a5470.zip
connman-619c30df57f62fbbc958f707f681ebe5ef4a5470.tar.gz
connman-619c30df57f62fbbc958f707f681ebe5ef4a5470.tar.bz2
Merge "Modified the DHCP descover/request timeout and disable DHCP reququest for last address" into tizen
-rwxr-xr-xgdhcp/client.c55
-rwxr-xr-xsrc/connman.h5
-rwxr-xr-xsrc/dhcp.c11
3 files changed, 70 insertions, 1 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 9b2de9d..3157632 100755
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -50,9 +50,30 @@
#define DISCOVER_TIMEOUT 5
#define DISCOVER_RETRIES 6
+#if defined TIZEN_EXT
+#define REQUEST_TIMEOUT 1
+#else
#define REQUEST_TIMEOUT 5
+#endif
#define REQUEST_RETRIES 3
+#if defined TIZEN_EXT
+#define DISCOVER_TIMEOUT_WIFI 1
+#define DISCOVER_RETRIES_WIFI 10
+static int dhcp_discover_timeout = DISCOVER_TIMEOUT_WIFI;
+static int dhcp_discover_max_retry = DISCOVER_RETRIES_WIFI;
+
+void set_dhcp_discover_timeout(int timeout_value)
+{
+ dhcp_discover_timeout = timeout_value;
+}
+
+void set_dhcp_discover_retry_count(int retry_count)
+{
+ dhcp_discover_max_retry = retry_count;
+}
+#endif
+
typedef enum _listen_mode {
L_NONE,
L2,
@@ -2688,6 +2709,11 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
uint32_t addr;
uint64_t rand;
+#if defined TIZEN_EXT
+ int discover_retry = 0;
+ int timeout = 0;
+#endif
+
remove_timeouts(dhcp_client);
if (dhcp_client->type == G_DHCP_IPV6) {
@@ -2774,13 +2800,32 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
return 0;
}
+#if defined TIZEN_EXT
+ if (g_ascii_strncasecmp(dhcp_client->interface, "wlan", 4)
+ == 0) {
+ discover_retry = DISCOVER_RETRIES_WIFI;
+ timeout = DISCOVER_TIMEOUT_WIFI;
+ } else {
+ discover_retry = DISCOVER_RETRIES;
+ timeout = DISCOVER_TIMEOUT;
+ }
+
+ debug(dhcp_client, "[DHCPC] Discover retry/total : [%d]/[%d] timeout [%d]",
+ dhcp_client->retry_times, discover_retry, timeout);
+#endif
+
+
if (dhcp_client->type == G_DHCP_IPV4LL) {
dhcp_client->state = INIT_SELECTING;
ipv4ll_start(dhcp_client);
return 0;
}
- if (dhcp_client->retry_times == DISCOVER_RETRIES) {
+#if defined TIZEN_EXT
+ if (dhcp_client->retry_times == discover_retry) {
+#else
+ if (dhcp_client->retry_times == DISCOVER_RETRIES) {
+#endif
if (dhcp_client->no_lease_cb)
dhcp_client->no_lease_cb(dhcp_client,
dhcp_client->no_lease_data);
@@ -2823,7 +2868,11 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
dhcp_client->timeout = g_timeout_add_seconds_full(
G_PRIORITY_HIGH,
+#if defined TIZEN_EXT
+ timeout,
+#else
REQUEST_TIMEOUT,
+#endif
reboot_timeout,
dhcp_client,
NULL);
@@ -2832,7 +2881,11 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
send_discover(dhcp_client, addr);
dhcp_client->timeout = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
+#if defined TIZEN_EXT
+ timeout,
+#else
DISCOVER_TIMEOUT,
+#endif
discover_timeout,
dhcp_client,
NULL);
diff --git a/src/connman.h b/src/connman.h
index 499f38d..c8e0ab0 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -455,6 +455,11 @@ enum __connman_dhcpv6_status {
CONNMAN_DHCPV6_STATUS_RESTART = 2,
};
+#if defined TIZEN_EXT
+void set_dhcp_discover_timeout(int timeout_value);
+void set_dhcp_discover_retry_count(int retry_count);
+#endif
+
typedef void (* dhcpv6_cb) (struct connman_network *network,
enum __connman_dhcpv6_status status, gpointer data);
diff --git a/src/dhcp.c b/src/dhcp.c
index 5b0beab..013948e 100755
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -634,7 +634,9 @@ int __connman_dhcp_start(struct connman_ipconfig *ipconfig,
struct connman_network *network, dhcp_cb callback,
gpointer user_data)
{
+#if !defined TIZEN_EXT
const char *last_addr = NULL;
+#endif
struct connman_dhcp *dhcp;
int err;
@@ -648,7 +650,9 @@ int __connman_dhcp_start(struct connman_ipconfig *ipconfig,
return -EINVAL;
}
+#if !defined TIZEN_EXT
last_addr = __connman_ipconfig_get_dhcp_address(ipconfig);
+#endif
dhcp = g_hash_table_lookup(ipconfig_table, ipconfig);
if (!dhcp) {
@@ -680,7 +684,14 @@ int __connman_dhcp_start(struct connman_ipconfig *ipconfig,
dhcp->callback = callback;
dhcp->user_data = user_data;
+#if defined TIZEN_EXT
+ DBG("Start DHCP with DHCPDISCOVER request");
+
+ return g_dhcp_client_start(dhcp->dhcp_client, NULL);
+#else
return g_dhcp_client_start(dhcp->dhcp_client, last_addr);
+#endif
+
}
void __connman_dhcp_stop(struct connman_ipconfig *ipconfig)