Merge "Add support for WPS2-PSK security type in Security property of service interfa... accepted/tizen/common/20160614.144019 accepted/tizen/ivi/20160614.103653 accepted/tizen/mobile/20160614.103642 accepted/tizen/tv/20160614.103619 accepted/tizen/wearable/20160614.103626 submit/tizen/20160614.053635
authortaesub kim <taesub.kim@samsung.com>
Tue, 14 Jun 2016 04:30:50 +0000 (21:30 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 14 Jun 2016 04:30:50 +0000 (21:30 -0700)
13 files changed:
gdhcp/client.c
gdhcp/gdhcp.h
gsupplicant/supplicant.c
packaging/connman.spec
src/clock.c
src/connman.service.in
src/inet.c
src/main.c
src/network.c
src/rtnl.c
src/service.c
src/timeserver.c
src/wispr.c

index 2c442e5..9b2de9d 100755 (executable)
@@ -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
index 22fa9f4..59b562b 100755 (executable)
@@ -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
index f558afb..806b4bd 100755 (executable)
@@ -4228,8 +4228,13 @@ int g_supplicant_interface_scan(GSupplicantInterface *interface,
 
        data->interface = interface;
        data->path = g_strdup(interface->path);
+#if defined TIZEN_EXT
+       data->interface->scan_callback = data->callback = callback;
+       data->interface->scan_data = data->user_data = user_data;
+#else
        data->callback = callback;
        data->user_data = user_data;
+#endif
        data->scan_params = scan_data;
 
         interface->scan_callback = callback;
@@ -4497,8 +4502,10 @@ static void add_network_security_tls(DBusMessageIter *dict,
        if (!ssid->private_key_path)
                return;
 
+#if !defined TIZEN_EXT
        if (!ssid->private_key_passphrase)
                return;
+#endif
 
        if (ssid->ca_cert_path)
                supplicant_dbus_dict_append_basic(dict, "ca_cert",
@@ -4507,9 +4514,11 @@ static void add_network_security_tls(DBusMessageIter *dict,
        supplicant_dbus_dict_append_basic(dict, "private_key",
                                                DBUS_TYPE_STRING,
                                                &ssid->private_key_path);
+#if !defined TIZEN_EXT
        supplicant_dbus_dict_append_basic(dict, "private_key_passwd",
                                                DBUS_TYPE_STRING,
                                                &ssid->private_key_passphrase);
+#endif
        supplicant_dbus_dict_append_basic(dict, "client_cert",
                                                DBUS_TYPE_STRING,
                                                &ssid->client_cert_path);
@@ -4541,8 +4550,10 @@ static void add_network_security_peap(DBusMessageIter *dict,
                if (!ssid->private_key_path)
                        return;
 
+#if !defined TIZEN_EXT
                if (!ssid->private_key_passphrase)
                        return;
+#endif
 
                supplicant_dbus_dict_append_basic(dict, "client_cert",
                                                DBUS_TYPE_STRING,
@@ -4552,9 +4563,11 @@ static void add_network_security_peap(DBusMessageIter *dict,
                                                DBUS_TYPE_STRING,
                                                &ssid->private_key_path);
 
+#if !defined TIZEN_EXT
                supplicant_dbus_dict_append_basic(dict, "private_key_passwd",
                                                DBUS_TYPE_STRING,
                                                &ssid->private_key_passphrase);
+#endif
 
        }
 
index fd58f95..ed731fe 100755 (executable)
@@ -99,6 +99,10 @@ CFLAGS+=" -DTIZEN_TV_EXT"
 
 %if %{with connman_vpnd}
 VPN_CFLAGS+=" -DTIZEN_EXT -lsmack -Werror"
+
+%if 0%{?sec_product_feature_telephony_disable} == 1
+       CFLAGS+=" -DTIZEN_CONNMAN_NTP"
+%endif
 %endif
 
 chmod +x bootstrap
index 0fde2c3..f04cf17 100755 (executable)
@@ -241,6 +241,11 @@ static DBusMessage *set_property(DBusConnection *conn,
        type = dbus_message_iter_get_arg_type(&value);
 
        if (g_str_equal(name, "Time")) {
+#if defined TIZEN_EXT
+               /* Tizen updates time (ntp) by system service */
+
+               return __connman_error_permission_denied(msg);
+#else
                struct timeval tv;
                dbus_uint64_t newval;
 
@@ -261,6 +266,7 @@ static DBusMessage *set_property(DBusConnection *conn,
                connman_dbus_property_changed_basic(CONNMAN_MANAGER_PATH,
                                CONNMAN_CLOCK_INTERFACE, "Time",
                                DBUS_TYPE_UINT64, &newval);
+#endif
        } else if (g_str_equal(name, "TimeUpdates")) {
                const char *strval;
                enum time_updates newval;
index 503ec45..ae7cbea 100755 (executable)
@@ -10,7 +10,6 @@ Restart=on-failure
 ExecStart=@sbindir@/connmand -n --noplugin vpn
 StandardOutput=null
 CapabilityBoundingSet=~CAP_MAC_ADMIN
-CapabilityBoundingSet=~CAP_MAC_OVERRIDE
 
 [Install]
 WantedBy=multi-user.target
index bfad01c..972fdff 100755 (executable)
@@ -2706,7 +2706,14 @@ char **__connman_inet_get_running_interfaces(void)
        g_free(ifr);
 
        if (count < numif)
+       {
+               char **prev_result = result;
                result = g_try_realloc(result, (count + 1) * sizeof(char *));
+               if (!result) {
+                       g_free(prev_result);
+                       goto error;
+               }
+       }
 
        return result;
 
index c594adb..5bd7e16 100755 (executable)
@@ -721,7 +721,9 @@ int main(int argc, char *argv[])
        __connman_proxy_init();
        __connman_detect_init();
        __connman_session_init();
+#if !defined TIZEN_EXT || defined TIZEN_CONNMAN_NTP
        __connman_timeserver_init();
+#endif
        __connman_connection_init();
 
        __connman_plugin_init(option_plugin, option_noplugin);
@@ -753,7 +755,9 @@ int main(int argc, char *argv[])
        __connman_plugin_cleanup();
        __connman_provider_cleanup();
        __connman_connection_cleanup();
+#if !defined TIZEN_EXT || defined TIZEN_CONNMAN_NTP
        __connman_timeserver_cleanup();
+#endif
        __connman_detect_cleanup();
        __connman_proxy_cleanup();
        __connman_task_cleanup();
index 3552056..0d6b442 100755 (executable)
@@ -1312,15 +1312,8 @@ static gboolean __connman_network_clear_associating_delayed(gpointer user_data)
 
        if (network->associating == FALSE &&
                        state_ipv4 == CONNMAN_SERVICE_STATE_ASSOCIATION &&
-                       state_ipv6 == CONNMAN_SERVICE_STATE_ASSOCIATION) {
-               __connman_service_ipconfig_indicate_state(service,
-                                                       CONNMAN_SERVICE_STATE_IDLE,
-                                                       CONNMAN_IPCONFIG_TYPE_IPV4);
-
-               __connman_service_ipconfig_indicate_state(service,
-                                                       CONNMAN_SERVICE_STATE_IDLE,
-                                                       CONNMAN_IPCONFIG_TYPE_IPV6);
-       }
+                       state_ipv6 == CONNMAN_SERVICE_STATE_ASSOCIATION)
+               connman_network_clear_associating(network);
 
        return FALSE;
 }
index dc15b33..684668b 100755 (executable)
@@ -100,6 +100,7 @@ static bool ether_blacklisted(const char *name)
        return false;
 }
 
+#if !defined TIZEN_EXT
 static bool wext_interface(char *ifname)
 {
        struct iwreq wrq;
@@ -121,6 +122,7 @@ static bool wext_interface(char *ifname)
 
        return true;
 }
+#endif
 
 #if defined TIZEN_EXT
 static bool __connman_rtnl_is_cellular_device(const char *name)
@@ -222,6 +224,8 @@ static void read_uevent(struct interface_data *interface)
        if (found_devtype)
                goto out;
 
+#if !defined TIZEN_EXT
+       /* TIZEN does not use old wext interface */
        /* We haven't got a DEVTYPE, let's check if it's a wireless device */
        if (wext_interface(name)) {
                interface->service_type = CONNMAN_SERVICE_TYPE_WIFI;
@@ -229,6 +233,7 @@ static void read_uevent(struct interface_data *interface)
 
                connman_error("%s runs an unsupported 802.11 driver", name);
        }
+#endif
 
 out:
        g_free(name);
index ca32698..b424bd5 100755 (executable)
@@ -1906,8 +1906,10 @@ static void state_changed(struct connman_service *service)
        if (!str)
                return;
 
+#if !defined TIZEN_EXT
        if (!allow_property_changed(service))
                return;
+#endif
 
        connman_dbus_property_changed_basic(service->path,
                                CONNMAN_SERVICE_INTERFACE, "State",
@@ -2726,11 +2728,13 @@ static void append_wifi_ext_info(DBusMessageIter *dict,
        unsigned int maxrate;
        uint16_t frequency;
        const char *enc_mode;
+       gboolean passpoint;
 
        bssid = connman_network_get_bssid(network);
        maxrate = connman_network_get_maxrate(network);
        frequency = connman_network_get_frequency(network);
        enc_mode = connman_network_get_enc_mode(network);
+       passpoint = connman_network_get_is_hs20AP(network);
 
        snprintf(bssid_str, WIFI_BSSID_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
                                bssid[0], bssid[1], bssid[2],
@@ -2744,6 +2748,8 @@ static void append_wifi_ext_info(DBusMessageIter *dict,
                                        DBUS_TYPE_UINT16, &frequency);
        connman_dbus_dict_append_basic(dict, "EncryptionMode",
                                        DBUS_TYPE_STRING, &enc_mode);
+       connman_dbus_dict_append_basic(dict, "Passpoint",
+                                       DBUS_TYPE_BOOLEAN, &passpoint);
 }
 #endif
 
@@ -5159,6 +5165,10 @@ static void service_schedule_removed(struct connman_service *service)
 
 static bool allow_property_changed(struct connman_service *service)
 {
+#if defined TIZEN_EXT
+       if (service->path == NULL)
+               return FALSE;
+#endif
        if (g_hash_table_lookup_extended(services_notify->add, service->path,
                                        NULL, NULL)) {
                DBG("no property updates for service %p", service);
index f0d33e5..8b9afb1 100755 (executable)
@@ -290,6 +290,11 @@ static void ts_recheck_enable(void)
  */
 int __connman_timeserver_sync(struct connman_service *default_service)
 {
+#if defined TIZEN_EXT && !defined TIZEN_CONNMAN_NTP
+       /* Tizen updates time (ntp) by system service */
+
+       return 0;
+#endif
        struct connman_service *service;
 
        if (default_service)
index ef4bdab..330aa1d 100755 (executable)
@@ -926,6 +926,11 @@ int __connman_wispr_start(struct connman_service *service,
 
        DBG("service %p", service);
 
+#if defined TIZEN_EXT
+       if (connman_service_get_type(service) == CONNMAN_SERVICE_TYPE_CELLULAR)
+               return -EPERM;
+#endif
+
        if (!wispr_portal_list)
                return -EINVAL;