Merge "[SPIN] Enable the ntp by connman if device does not use the cellular." into...
authortaesub kim <taesub.kim@samsung.com>
Mon, 13 Jun 2016 02:21:15 +0000 (19:21 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 13 Jun 2016 02:21:15 +0000 (19:21 -0700)
17 files changed:
Makefile.am
gdhcp/client.c
gdhcp/gdhcp.h
gsupplicant/supplicant.c
packaging/connman.spec
resources/usr/share/dbus-1/system-services/net.connman.service
src/connman.service.in
src/connman_tv.service.in
src/inet.c
src/iptables.c
src/net.connman.service.in
src/network.c
src/rtnl.c
src/service.c
src/wispr.c
vpn/connman-vpn.service.in
vpn/net.connman.vpn.service.in

index 95761e2..5be7625 100755 (executable)
@@ -63,16 +63,15 @@ endif
 
 if SYSTEMD
 systemdunitdir = @SYSTEMD_UNITDIR@
-
-systemdunit_DATA = src/connman.service
+systemdunit_DATA = src/connman.service vpn/connman-vpn.service
 
 endif
 endif
 
 service_files_sources = src/connman.service.in src/net.connman.service.in \
-                               vpn/net.connman.vpn.service.in
+                               vpn/net.connman.vpn.service.in vpn/connman-vpn.service.in
 service_files = src/connman.service src/net.connman.service \
-                               vpn/net.connman.vpn.service
+                               vpn/net.connman.vpn.service vpn/connman-vpn.service
 
 plugin_LTLIBRARIES =
 
index 106c777..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,
@@ -2776,7 +2809,7 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
                if (addr == 0xFFFFFFFF || ((addr & LINKLOCAL_ADDR) ==
                                        LINKLOCAL_ADDR)) {
                        addr = 0;
-               } else {
+               } else if (dhcp_client->last_address != last_address) {
                        g_free(dhcp_client->last_address);
                        dhcp_client->last_address = g_strdup(last_address);
                }
@@ -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 834be59..fc8fd3d 100755 (executable)
@@ -4216,8 +4216,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;
@@ -4485,8 +4490,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",
@@ -4495,9 +4502,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);
@@ -4529,8 +4538,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,
@@ -4540,9 +4551,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 93642e8..47f8552 100755 (executable)
@@ -4,7 +4,7 @@
 
 Name:           connman
 Version:        1.29
-Release:        9
+Release:        11
 License:        GPL-2.0+
 Summary:        Connection Manager
 Url:            http://connman.net
@@ -15,7 +15,6 @@ BuildRequires:  pkgconfig(dbus-1)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(libiptc)
 BuildRequires:  pkgconfig(xtables)
-BuildRequires:  pkgconfig(gnutls)
 BuildRequires:  pkgconfig(libsmack)
 BuildRequires:  pkgconfig(tpkp-gnutls)
 %if %{with connman_openconnect}
@@ -128,7 +127,8 @@ chmod +x bootstrap
                        --enable-loopback \
                        --enable-ethernet \
             --with-systemdunitdir=%{_libdir}/systemd/system \
-            --enable-pie
+            --enable-pie \
+                       --disable-wispr
 
 make %{?_smp_mflags}
 
@@ -146,6 +146,7 @@ cp src/connman_tv.service %{buildroot}%{_libdir}/systemd/system/connman.service
 %else
 %if "%{?_lib}" == "lib64"
 cp src/connman.service %{buildroot}%{_unitdir}/connman.service
+cp vpn/connman-vpn.service %{buildroot}%{_unitdir}/connman-vpn.service
 %endif
 %endif
 
@@ -197,9 +198,11 @@ systemctl daemon-reload
 %{_sysconfdir}/dbus-1/system.d/*.conf
 %attr(644,root,root) %{_libdir}/systemd/system/connman.service
 %attr(644,root,root) %{_libdir}/systemd/system/multi-user.target.wants/connman.service
+%attr(644,root,root) %{_libdir}/systemd/system/connman-vpn.service
 %if "%{?_lib}" == "lib64"
 %attr(644,root,root) %{_unitdir}/connman.service
 %attr(644,root,root) %{_unitdir}/multi-user.target.wants/connman.service
+%attr(644,root,root) %{_unitdir}/connman-vpn.service
 %endif
 %{_datadir}/license/connman
 
index d7730d8..9679c1b 100644 (file)
@@ -1,5 +1,5 @@
 [D-BUS Service]
 Name=net.connman
-Exec=@sbindir@/connmand -n
+Exec=/bin/false
 User=root
-SystemdService=connman.service
\ No newline at end of file
+SystemdService=connman.service
index adf7a62..503ec45 100755 (executable)
@@ -9,6 +9,8 @@ BusName=net.connman
 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 2922aa8..c032846 100644 (file)
@@ -7,6 +7,8 @@ BusName=net.connman
 RemainAfterExit=yes
 ExecStartPre=/usr/bin/dbus-send --system --dest=net.netconfig / net.netconfig.auto.activate
 ExecStart=/usr/sbin/connmand --noplugin vpn
+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 dd1b2e6..c65f9ef 100755 (executable)
@@ -2311,6 +2311,10 @@ int __connman_iptables_commit(const char *table_name)
                return -EINVAL;
 
        repl = iptables_blob(table);
+#if defined TIZEN_EXT
+       if(!repl)
+               return -ENOMEM;
+#endif
 
        if (debug_enabled)
                dump_ipt_replace(repl);
index f7f6a7c..9679c1b 100755 (executable)
@@ -1,5 +1,5 @@
 [D-BUS Service]
 Name=net.connman
-Exec=@sbindir@/connmand -n
+Exec=/bin/false
 User=root
 SystemdService=connman.service
index ad67746..4b2ae11 100755 (executable)
@@ -1311,15 +1311,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 9f197dd..ca29119 100755 (executable)
@@ -1896,8 +1896,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",
@@ -2716,11 +2718,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],
@@ -2734,6 +2738,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
 
@@ -5144,6 +5150,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);
@@ -6846,6 +6856,19 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
                        is_connected_state(service, new_state))
                nameserver_add_all(service);
 
+#if defined TIZEN_EXT
+       int ret = service_indicate_state(service);
+       /*Sent the Ready changed signal again in case IPv4 IP set
+         after IPv6 IP set*/
+
+       if(ret == -EALREADY && type == CONNMAN_IPCONFIG_TYPE_IPV4
+                       && new_state == CONNMAN_SERVICE_STATE_READY) {
+               DBG("Notify IPv4 state new/old %d/%d", new_state,old_state);
+               state_changed(service);
+       }
+
+       return ret;
+#endif
        return service_indicate_state(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;
 
index de65a70..71abb57 100755 (executable)
@@ -8,6 +8,8 @@ Type=dbus
 BusName=net.connman.vpn
 ExecStart=@sbindir@/connman-vpnd -n
 StandardOutput=null
+CapabilityBoundingSet=~CAP_MAC_ADMIN
+CapabilityBoundingSet=~CAP_MAC_OVERRIDE
 
 [Install]
 WantedBy=multi-user.target
index 9487201..8dcf254 100755 (executable)
@@ -1,4 +1,5 @@
 [D-BUS Service]
 Name=net.connman.vpn
-Exec=@sbindir@/connman-vpnd -n
+Exec=/bin/false
 User=root
+SystemdService=connman-vpn.service