From 535e7f69c650dd1701cdb94152a88e644d079afb Mon Sep 17 00:00:00 2001 From: Niraj Kumar Goit Date: Tue, 14 Jun 2016 22:24:37 +0530 Subject: [SPIN] gsupplicant: fix stucking in scanning state when scan failed. - gsupplicant: fix stucking in scanning state when scan failed. - Apply ASLR option. - Add ""TIZEN_WEARABLE"" check in service file. - change the dhcp client device name. - default internet service: fix not cleared if pdp activation failed. - Change Russia cert build feature. - Update the Connman.service.in file. - Remove connection retry when association fail. Change-Id: I3ac8e49d0a3c229b298296f8e7cbf34845c2c90d Signed-off-by: Niraj Kumar Goit --- Makefile.am | 5 +-- gsupplicant/supplicant.c | 15 +++++++++ packaging/connman.spec | 6 ++++ plugins/loopback.c | 84 ++++++++++++++++++++++++++++++++++++++++++------ plugins/wifi.c | 2 -- src/connman.service.in | 9 +++--- src/service.c | 12 +++++++ 7 files changed, 115 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5be7625f..f5535da5 100755 --- a/Makefile.am +++ b/Makefile.am @@ -115,7 +115,7 @@ src_connmand_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \ @TPKP_GNUTLS_LIBS@ \ -lresolv -ldl -lrt -src_connmand_LDFLAGS = -Wl,--export-dynamic \ +src_connmand_LDFLAGS = -Wl,--export-dynamic -pie \ -Wl,--version-script=$(srcdir)/src/connman.ver if VPN @@ -209,7 +209,8 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \ -DSCRIPTDIR=\""$(build_scriptdir)"\" \ -DSTORAGEDIR=\""$(storagedir)\"" \ -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \ - -DCONFIGDIR=\""$(configdir)\"" + -DCONFIGDIR=\""$(configdir)\"" \ + -fPIE if VPN AM_CPPFLAGS = @TPKP_GNUTLS_CFLAGS@ -I$(builddir)/include -I$(srcdir)/gdbus diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 30237a32..2bb676eb 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2297,15 +2297,30 @@ static void scan_bss_data(const char *key, DBusMessageIter *iter, { GSupplicantInterface *interface = user_data; +/*Fixed : stucking in scanning state when scan failed*/ +#if defined TIZEN_EXT + GSupplicantInterfaceCallback scan_callback; +#endif + if (iter) supplicant_dbus_array_foreach(iter, scan_network_update, interface); +#if defined TIZEN_EXT + scan_callback = interface->scan_callback; +#endif + if (interface->scan_callback) interface->scan_callback(0, interface, interface->scan_data); +#if defined TIZEN_EXT + if (interface->scan_callback == scan_callback) { +#endif interface->scan_callback = NULL; interface->scan_data = NULL; +#if defined TIZEN_EXT + } +#endif } static GSupplicantInterface *interface_alloc(const char *path) diff --git a/packaging/connman.spec b/packaging/connman.spec index ed731fea..23b8d52c 100755 --- a/packaging/connman.spec +++ b/packaging/connman.spec @@ -103,6 +103,12 @@ VPN_CFLAGS+=" -DTIZEN_EXT -lsmack -Werror" %if 0%{?sec_product_feature_telephony_disable} == 1 CFLAGS+=" -DTIZEN_CONNMAN_NTP" %endif +%if 0%{?sec_product_feature_security_fstek_enable} == 1 + CFLAGS+=" -DTIZEN_CONNMAN_USE_BLACKLIST" +%endif +%if 0%{?sec_product_feature_profile_wearable} + CFLAGS+=" -DTIZEN_WEARABLE" +%endif %endif chmod +x bootstrap diff --git a/plugins/loopback.c b/plugins/loopback.c index e113887d..cfb33a8e 100755 --- a/plugins/loopback.c +++ b/plugins/loopback.c @@ -23,6 +23,8 @@ #include #endif +#include + #include #include #include @@ -34,6 +36,8 @@ #include #include +#include + #define CONNMAN_API_SUBJECT_TO_CHANGE #include @@ -62,16 +66,78 @@ static int setup_hostname(void) memset(system_hostname, 0, sizeof(system_hostname)); - if (gethostname(system_hostname, HOST_NAME_MAX) < 0) { - connman_error("Failed to get current hostname"); - return -EIO; - } +#if defined TIZEN_EXT + FILE *fp = NULL; + +#if defined TIZEN_WEARABLE +#define BT_MAC "/csa/bluetooth/.bd_addr" + { + gchar* dev_id = "GearS2"; + char bt_mac[HOST_NAME_MAX + 1]; + char addr[5] = {0, }; + + fp = fopen(BT_MAC, "r"); + if(!fp){ + connman_error("Failed to get current hostname"); + strncpy(system_hostname, dev_id, strlen(dev_id)); + goto host_name_end; + } + + // get the last line's address + while (fgets(bt_mac, HOST_NAME_MAX, fp)) {} + + if (strlen(bt_mac) == 6) { + addr[0] = bt_mac[2]; + addr[1] = bt_mac[3]; + addr[2] = bt_mac[4]; + addr[3] = bt_mac[5]; + g_sprintf(system_hostname, "%s-%s", dev_id, addr); + } else + strncpy(system_hostname, dev_id, strlen(dev_id)); + + fclose(fp); + } +#else +#define WIFI_MAC "/opt/etc/.mac.info" + { + char* rv = 0; + gchar* dev_id = "TIZEN"; + char wifi_mac[HOST_NAME_MAX + 1]; + + fp = fopen(WIFI_MAC, "r"); + if(!fp){ + connman_error("Failed to get current hostname"); + strncpy(system_hostname, dev_id, strlen(dev_id)); + goto host_name_end; + } + + rv = fgets(wifi_mac, HOST_NAME_MAX, fp); + if(!rv){ + connman_error("Failed to get current hostname"); + strncpy(system_hostname, dev_id, strlen(dev_id)); + fclose(fp); + goto host_name_end; + } + + dev_id = g_base64_encode((const guchar *)wifi_mac, strlen(wifi_mac)); + g_sprintf(system_hostname, "TIZEN-%s", dev_id); + g_free(dev_id); + fclose(fp); + } +#endif - if (strlen(system_hostname) > 0 && - strcmp(system_hostname, "(none)") != 0) - connman_info("System hostname is %s", system_hostname); - else - create_hostname(); + host_name_end : +#else + if (gethostname(system_hostname, HOST_NAME_MAX) < 0) { + connman_error("Failed to get current hostname"); + return -EIO; + } +#endif + if (strlen(system_hostname) > 0 && + strcmp(system_hostname, "(none)") != 0) + connman_info("System hostname is %s", system_hostname); + else + create_hostname(); memset(name, 0, sizeof(name)); diff --git a/plugins/wifi.c b/plugins/wifi.c index 570c97d0..4bf40473 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -2684,7 +2684,6 @@ static void interface_state(GSupplicantInterface *interface) /* To avoid unnecessary repeated association in wpa_supplicant, * "RemoveNetwork" should be made when Wi-Fi is disconnected */ if (wps != true && wifi->network && wifi->disconnecting == false) { -#if 0 /* temporary disabled */ int err; wifi->disconnecting = true; @@ -2692,7 +2691,6 @@ static void interface_state(GSupplicantInterface *interface) disconnect_callback, wifi->network); if (err < 0) wifi->disconnecting = false; -#endif if (wifi->connected) wifi->interface_disconnected_network = wifi->network; diff --git a/src/connman.service.in b/src/connman.service.in index ae7cbea8..1df16701 100755 --- a/src/connman.service.in +++ b/src/connman.service.in @@ -1,15 +1,14 @@ [Unit] Description=Connection service -After=net-config.service -DefaultDependencies=no +Requires=dbus.socket +After=dbus.socket [Service] Type=dbus BusName=net.connman +ExecStartPre=/usr/bin/dbus-send --system --dest=net.netconfig / net.netconfig.auto.activate Restart=on-failure -ExecStart=@sbindir@/connmand -n --noplugin vpn -StandardOutput=null -CapabilityBoundingSet=~CAP_MAC_ADMIN +ExecStart=/usr/sbin/connmand -n [Install] WantedBy=multi-user.target diff --git a/src/service.c b/src/service.c index 22da1e29..9149dd24 100755 --- a/src/service.c +++ b/src/service.c @@ -6602,6 +6602,18 @@ int __connman_service_indicate_error(struct connman_service *service, set_error(service, error); +/* default internet service: fix not cleared if pdp activation*/ +#if defined TIZEN_EXT + /* + * If connection failed for default service(DefaultInternet), + * default_connecting_device should be cleared. + */ + if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR && + service->error == CONNMAN_SERVICE_ERROR_CONNECT_FAILED) + __connman_service_disconnect_default(service); + +#endif + __connman_service_ipconfig_indicate_state(service, CONNMAN_SERVICE_STATE_FAILURE, CONNMAN_IPCONFIG_TYPE_IPV4); -- cgit v1.2.3