[SPIN] gsupplicant: fix stucking in scanning state when scan failed. 14/74514/3
authorNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 14 Jun 2016 16:54:37 +0000 (22:24 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 14 Jun 2016 19:56:32 +0000 (01:26 +0530)
- 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 <niraj.g@samsung.com>
Makefile.am
gsupplicant/supplicant.c
packaging/connman.spec
plugins/loopback.c
plugins/wifi.c
src/connman.service.in
src/service.c

index 5be7625..f5535da 100755 (executable)
@@ -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
index 30237a3..2bb676e 100755 (executable)
@@ -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)
index ed731fe..23b8d52 100755 (executable)
@@ -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
index e113887..cfb33a8 100755 (executable)
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
+
 #include <errno.h>
 #include <unistd.h>
 #include <limits.h>
@@ -34,6 +36,8 @@
 #include <net/if.h>
 
 #include <glib.h>
+#include <glib/gprintf.h>
+
 
 #define CONNMAN_API_SUBJECT_TO_CHANGE
 #include <connman/plugin.h>
@@ -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));
 
index 570c97d..4bf4047 100755 (executable)
@@ -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;
index ae7cbea..1df1670 100755 (executable)
@@ -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
index 22da1e2..9149dd2 100755 (executable)
@@ -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);