diff options
author | Niraj Kumar Goit <niraj.g@samsung.com> | 2016-06-15 15:39:36 +0530 |
---|---|---|
committer | Niraj Kumar Goit <niraj.g@samsung.com> | 2016-06-17 21:27:27 +0530 |
commit | a59c6e4a0176ca9ad05c1980dcebfbb07b8a188f (patch) | |
tree | 9e473cf3e56f21048704ac4674afe6718bda1ffe | |
parent | 46c06a384067f29cdd9f1550278cda29798db7b2 (diff) | |
download | connman-a59c6e4a0176ca9ad05c1980dcebfbb07b8a188f.tar.gz connman-a59c6e4a0176ca9ad05c1980dcebfbb07b8a188f.tar.bz2 connman-a59c6e4a0176ca9ad05c1980dcebfbb07b8a188f.zip |
[SPIN] Fix the connman bugs.
- Fixed NTP service's DNS resolving failure in Hive project.
- Do not turn "wlan0" interface down in cleanup_devices().
- Set resource limits "RLIMIT_NOFILE" for a process.
- After appending a file, fflush and fsync all modified in-core data of the file.
Change-Id: I2767b3302d6204d066fe2075027828ff209d0ee0
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-x | gweb/gresolv.c | 8 | ||||
-rwxr-xr-x | src/connection.c | 7 | ||||
-rwxr-xr-x | src/connman.h | 4 | ||||
-rwxr-xr-x | src/device.c | 3 | ||||
-rwxr-xr-x | src/dhcp.c | 8 | ||||
-rwxr-xr-x | src/main.c | 20 | ||||
-rwxr-xr-x | src/resolver.c | 5 | ||||
-rwxr-xr-x | src/service.c | 11 | ||||
-rwxr-xr-x | src/storage.c | 14 | ||||
-rwxr-xr-x | src/wispr.c | 2 | ||||
-rwxr-xr-x | src/wpad.c | 2 |
11 files changed, 84 insertions, 0 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c index 5cf7a9a6..93f156ea 100755 --- a/gweb/gresolv.c +++ b/gweb/gresolv.c @@ -948,10 +948,12 @@ bool g_resolv_add_nameserver(GResolv *resolv, const char *address, nameserver->flags = flags; nameserver->resolv = resolv; + debug(resolv, ""); if (connect_udp_channel(nameserver) < 0) { free_nameserver(nameserver); return false; } + debug(resolv, ""); resolv->nameserver_list = g_list_append(resolv->nameserver_list, nameserver); @@ -1053,6 +1055,8 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname, lookup->result_data = user_data; lookup->id = resolv->next_lookup_id++; + debug(resolv, ""); + if (resolv->result_family != AF_INET6) { if (add_query(lookup, hostname, ns_t_a)) { g_free(lookup); @@ -1060,6 +1064,8 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname, } } + debug(resolv, ""); + if (resolv->result_family != AF_INET) { if (add_query(lookup, hostname, ns_t_aaaa)) { if (resolv->result_family != AF_INET6) { @@ -1073,6 +1079,8 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname, } } + debug(resolv, ""); + g_queue_push_tail(resolv->lookup_queue, lookup); debug(resolv, "lookup %p id %d", lookup, lookup->id); diff --git a/src/connection.c b/src/connection.c index b87625f5..0b6dc4af 100755 --- a/src/connection.c +++ b/src/connection.c @@ -674,8 +674,15 @@ static void connection_newgateway(int index, const char *gateway) } if (!found) { +#if defined TIZEN_EXT + if (data->ipv4_gateway != NULL){ + set_default_gateway(data, CONNMAN_IPCONFIG_TYPE_IPV4); + connman_check_proxy_setup_and_wispr_start(data->service); + } +#else if (data->ipv4_gateway) set_default_gateway(data, CONNMAN_IPCONFIG_TYPE_IPV4); +#endif if (data->ipv6_gateway) set_default_gateway(data, CONNMAN_IPCONFIG_TYPE_IPV6); diff --git a/src/connman.h b/src/connman.h index 6f588bf2..26aa7e50 100755 --- a/src/connman.h +++ b/src/connman.h @@ -730,6 +730,10 @@ enum connman_service_state __connman_service_ipconfig_get_state( struct connman_service *service, enum connman_ipconfig_type type); +#if defined TIZEN_EXT +void connman_check_proxy_setup_and_wispr_start(struct connman_service *service); +#endif + int __connman_service_indicate_error(struct connman_service *service, enum connman_service_error error); int __connman_service_clear_error(struct connman_service *service); diff --git a/src/device.c b/src/device.c index 4d2d5403..aff0fa93 100755 --- a/src/device.c +++ b/src/device.c @@ -1432,6 +1432,9 @@ static void cleanup_devices(void) DBG("cleaning up %s index %d", interfaces[i], index); +#if defined TIZEN_EXT + if (strcmp(interfaces[i], "wlan0") != 0) +#endif connman_inet_ifdown(index); /* @@ -192,12 +192,16 @@ static int ipv4ll_start_client(struct connman_dhcp *dhcp) if (error != G_DHCP_CLIENT_ERROR_NONE) return -EINVAL; +#if !defined TIZEN_EXT if (getenv("CONNMAN_DHCP_DEBUG")) { +#endif dhcp->ipv4ll_debug_prefix = g_strdup_printf("IPv4LL index %d", index); g_dhcp_client_set_debug(ipv4ll_client, dhcp_debug, dhcp->ipv4ll_debug_prefix); +#if !defined TIZEN_EXT } +#endif g_dhcp_client_set_id(ipv4ll_client); @@ -526,12 +530,16 @@ static int dhcp_initialize(struct connman_dhcp *dhcp) if (error != G_DHCP_CLIENT_ERROR_NONE) return -EINVAL; +#if !defined TIZEN_EXT if (getenv("CONNMAN_DHCP_DEBUG")) { +#endif dhcp->dhcp_debug_prefix = g_strdup_printf("DHCP index %d", index); g_dhcp_client_set_debug(dhcp_client, dhcp_debug, dhcp->dhcp_debug_prefix); +#if !defined TIZEN_EXT } +#endif g_dhcp_client_set_id(dhcp_client); @@ -30,6 +30,8 @@ #include <string.h> #include <signal.h> #include <sys/signalfd.h> +#include <sys/types.h> +#include <sys/resource.h> #include <getopt.h> #include <sys/stat.h> #include <net/if.h> @@ -259,6 +261,21 @@ static void check_Tizen_configuration(GKeyFile *config) g_clear_error(&error); } + +static void set_nofile_inc(void) +{ + int err; + struct rlimit rlim; + + rlim.rlim_cur = 8192; + rlim.rlim_max = 8192; + + err = setrlimit(RLIMIT_NOFILE, &rlim); + if (err) + DBG("fail to increase FILENO err(%d)", err); + + return; +} #endif static void parse_config(GKeyFile *config) @@ -404,6 +421,9 @@ static int config_init(const char *file) { GKeyFile *config; +#if defined TIZEN_EXT + set_nofile_inc(); +#endif config = load_config(file); check_config(config); parse_config(config); diff --git a/src/resolver.c b/src/resolver.c index 6a649388..fae02a8d 100755 --- a/src/resolver.c +++ b/src/resolver.c @@ -356,6 +356,11 @@ static int append_resolver(int index, const char *domain, if (!server && !domain) return -EINVAL; +#ifdef TIZEN_EXT + if (g_strcmp0(server, "0.0.0.0") == 0) + return -EINVAL; +#endif + entry = g_try_new0(struct entry_data, 1); if (!entry) return -ENOMEM; diff --git a/src/service.c b/src/service.c index ed59930b..2baf8716 100755 --- a/src/service.c +++ b/src/service.c @@ -6746,6 +6746,15 @@ done: __connman_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV4); } +#if defined TIZEN_EXT +void connman_check_proxy_setup_and_wispr_start(struct connman_service *service){ + + DBG("check the proxy and start wispr"); + check_proxy_setup(service); + return; +} +#endif + /* * How many networks are connected at the same time. If more than 1, * then set the rp_filter setting properly (loose mode routing) so that network @@ -6914,7 +6923,9 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service, } #endif if (type == CONNMAN_IPCONFIG_TYPE_IPV4) { +#if !defined TIZEN_EXT check_proxy_setup(service); +#endif service_rp_filter(service, true); } else { service->online_check_count = 1; diff --git a/src/storage.c b/src/storage.c index 7d031303..2da54d6c 100755 --- a/src/storage.c +++ b/src/storage.c @@ -23,6 +23,7 @@ #include <config.h> #endif +#include <stdio.h> #include <errno.h> #include <unistd.h> #include <sys/stat.h> @@ -73,6 +74,19 @@ static int storage_save(GKeyFile *keyfile, char *pathname) ret = -EIO; } +#if defined TIZEN_EXT + { + FILE *fp = NULL; + fp = fopen(pathname, "a+"); + if(fp){ + fflush(fp); + fsync(fp->_fileno); + fclose(fp); + DBG("sync the file to disk"); + } + } +#endif + g_free(data); return ret; diff --git a/src/wispr.c b/src/wispr.c index 330aa1d4..c3b0c9c9 100755 --- a/src/wispr.c +++ b/src/wispr.c @@ -879,7 +879,9 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) goto done; } +#if !defined TIZEN_EXT if (getenv("CONNMAN_WEB_DEBUG")) +#endif g_web_set_debug(wp_context->web, web_debug, "WEB"); if (wp_context->type == CONNMAN_IPCONFIG_TYPE_IPV4) { @@ -160,7 +160,9 @@ int __connman_wpad_start(struct connman_service *service) return -ENOMEM; } +#if !defined TIZEN_EXT if (getenv("CONNMAN_RESOLV_DEBUG")) +#endif g_resolv_set_debug(wpad->resolv, resolv_debug, "RESOLV"); for (i = 0; nameservers[i]; i++) |