Merge "[connman]: Fixed: ConnMan keep trying connection infintely" into tizen
authortaesub kim <taesub.kim@samsung.com>
Tue, 7 Feb 2017 10:24:21 +0000 (02:24 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 7 Feb 2017 10:24:21 +0000 (02:24 -0800)
gsupplicant/supplicant.c
packaging/connman.spec
plugins/wifi.c
src/connman.h
src/connman_tv.service.in
src/main.c
src/main_tv.conf [new file with mode: 0755]
src/rtnl.c
src/service.c

index e9d6b9d..c596619 100755 (executable)
@@ -4385,7 +4385,11 @@ static void interface_select_network_result(const char *error,
 
        err = 0;
        if (error) {
+#if defined TIZEN_EXT
+               SUPPLICANT_DBG("SelectNetwork errorFreq %s", error);
+#else
                SUPPLICANT_DBG("SelectNetwork error %s", error);
+#endif
                err = parse_supplicant_error(iter);
        }
 
@@ -4403,9 +4407,15 @@ static void interface_select_network_params(DBusMessageIter *iter,
 {
        struct interface_connect_data *data = user_data;
        GSupplicantInterface *interface = data->interface;
+#if defined TIZEN_EXT
+       GSupplicantSSID *ssid = data->ssid;
+#endif
 
        dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
                                        &interface->network_path);
+#if defined TIZEN_EXT
+       dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &ssid->freq);
+#endif
 }
 
 static void interface_add_network_result(const char *error,
@@ -4428,11 +4438,23 @@ static void interface_add_network_result(const char *error,
        g_free(interface->network_path);
        interface->network_path = g_strdup(path);
 
+#if defined TIZEN_EXT
+       SUPPLICANT_DBG(".Interface.SelectNetworkFreq");
+#endif
+
+#if defined TIZEN_EXT
+       supplicant_dbus_method_call(data->interface->path,
+                       SUPPLICANT_INTERFACE ".Interface", "SelectNetworkFreq",
+                       interface_select_network_params,
+                       interface_select_network_result, data,
+                       interface);
+#else
        supplicant_dbus_method_call(data->interface->path,
                        SUPPLICANT_INTERFACE ".Interface", "SelectNetwork",
                        interface_select_network_params,
                        interface_select_network_result, data,
                        interface);
+#endif
 
        return;
 
index 5db54f0..b2e1d6a 100755 (executable)
@@ -33,6 +33,9 @@ Requires(post):   systemd
 Requires(preun):  systemd
 Requires(postun): systemd
 Requires:         net-config
+Provides:       %{name}-profile_common = %{version}-%{release}
+Provides:       %{name}-profile_mobile = %{version}-%{release}
+Provides:       %{name}-profile_wearable = %{version}-%{release}
 
 %define upgrade_script_filename 500.connman_upgrade.sh
 %define upgrade_script_path /usr/share/upgrade/scripts
@@ -90,6 +93,24 @@ Requires:       %{name} = %{version}
 %description devel
 Header files and development files for connman.
 
+%package extension-tv
+Summary:        Connman service script for TV profile
+Requires:       %{name} = %{version}-%{release}
+Provides:       %{name}-profile_tv = %{version}-%{release}
+Conflicts:      %{name}-extension-ivi
+%description extension-tv
+Supplies Tizen TV profile systemd service scripts instead of the default one.
+This overwrites service script of %{name}.
+
+%package extension-ivi
+Summary:        Connman configuration for IVI profile
+Requires:       %{name} = %{version}-%{release}
+Provides:       %{name}-profile_ivi = %{version}-%{release}
+Conflicts:      %{name}-extension-tv
+%description extension-ivi
+Supplies Tizen IVI profile configuration instead of the default one.
+This overwrites conf file of %{name}.
+
 %prep
 %setup -q
 
@@ -97,9 +118,6 @@ Header files and development files for connman.
 %build
 CFLAGS+=" -DTIZEN_EXT -lsmack -Werror"
 CFLAGS+=" -DTIZEN_SYS_CA_BUNDLE=\"%TZ_SYS_RO_CA_BUNDLE\""
-%if "%{profile}" == "tv"
-CFLAGS+=" -DTIZEN_TV_EXT"
-%endif
 
 %if %{with connman_vpnd}
 VPN_CFLAGS+=" -DTIZEN_EXT -lsmack -Werror"
@@ -141,17 +159,12 @@ mkdir -p %{buildroot}%{_libdir}/systemd/system/
 mkdir -p %{buildroot}%{_unitdir}
 %endif
 
-%if "%{profile}" == "tv"
-cp src/connman_tv.service %{buildroot}%{_libdir}/systemd/system/connman.service
-%if "%{?_lib}" == "lib64"
-cp src/connman_tv.service %{buildroot}%{_unitdir}/connman.service
-cp vpn/connman-vpn.service %{buildroot}%{_unitdir}/connman-vpn.service
-%endif
-%else
 %if "%{?_lib}" == "lib64"
+cp src/connman_tv.service %{buildroot}%{_unitdir}/connman.service.tv
 cp src/connman.service %{buildroot}%{_unitdir}/connman.service
 cp vpn/connman-vpn.service %{buildroot}%{_unitdir}/connman-vpn.service
-%endif
+%else
+cp src/connman_tv.service %{buildroot}%{_libdir}/systemd/system/connman.service.tv
 %endif
 
 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
@@ -178,11 +191,9 @@ mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
 cp resources/usr/share/dbus-1/system-services/net.connman.service %{buildroot}%{_datadir}/dbus-1/system-services/net.connman.service
 mkdir -p %{buildroot}/etc/connman
 
-%if "%{profile}" == "ivi"
-cp src/main_ivi.conf %{buildroot}/etc/connman/main.conf
-%else
+cp src/main_ivi.conf %{buildroot}/etc/connman/main.conf.ivi
+cp src/main_tv.conf %{buildroot}/etc/connman/main.conf.tv
 cp src/main.conf %{buildroot}/etc/connman/main.conf
-%endif
 
 rm %{buildroot}%{_sysconfdir}/dbus-1/system.d/*.conf
 mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d/
@@ -274,4 +285,17 @@ systemctl daemon-reload
 %{_datadir}/dbus-1/system-services/net.connman.vpn.service
 %endif
 
-
+%post extension-tv
+mv -f %{_libdir}/systemd/system/connman.service.tv %{_libdir}/systemd/system/connman.service
+mv -f %{_sysconfdir}/connman/main.conf.tv %{_sysconfdir}/connman/main.conf
+%files extension-tv
+%attr(644,root,root) %{_sysconfdir}/connman/main.conf.tv
+%if "%{?_lib}" == "lib64"
+%attr(644,root,root) %{_unitdir}/connman.service.tv
+%else
+%attr(644,root,root) %{_libdir}/systemd/system/connman.service.tv
+%endif
+%post extension-ivi
+mv -f %{_sysconfdir}/connman/main.conf.ivi %{_sysconfdir}/connman/main.conf
+%files extension-ivi
+%attr(644,root,root) %{_sysconfdir}/connman/main.conf.ivi
index 1c136f3..84d0708 100755 (executable)
@@ -2170,6 +2170,9 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
 #if defined TIZEN_EXT
        ssid->bssid = connman_network_get_bssid(network);
 #endif
+#if defined TIZEN_EXT
+       ssid->freq = connman_network_get_frequency(network);
+#endif
 
        if (connman_setting_get_bool("BackgroundScanning"))
                ssid->bgscan = BGSCAN_DEFAULT;
index 56f9dd9..2217cc4 100755 (executable)
@@ -1067,3 +1067,12 @@ void __connman_machine_cleanup(void);
 int __connman_util_get_random(uint64_t *val);
 int __connman_util_init(void);
 void __connman_util_cleanup(void);
+
+#ifdef TIZEN_EXT
+__attribute__ ((unused)) static int __tizentvextension = -1;
+#define TIZEN_TV_EXT (__builtin_expect(__tizentvextension != -1, 1) ? \
+       __tizentvextension : \
+       (__tizentvextension = connman_setting_get_bool("TizenTVExtension")))
+#else /* TIZEN_EXT */
+#define TIZEN_TV_EXT (0) /* Always False */
+#endif /* TIZEN_EXT */
index c032846..3bc442a 100644 (file)
@@ -1,12 +1,15 @@
 [Unit]
 Description=Connection service
+After=net-config.service
+DefaultDependencies=no
 
 [Service]
 Type=dbus
 BusName=net.connman
-RemainAfterExit=yes
-ExecStartPre=/usr/bin/dbus-send --system --dest=net.netconfig / net.netconfig.auto.activate
-ExecStart=/usr/sbin/connmand --noplugin vpn
+Restart=on-failure
+SmackProcessLabel=System
+ExecStart=@sbindir@/connmand -n --noplugin vpn
+StandardOutput=null
 CapabilityBoundingSet=~CAP_MAC_ADMIN
 CapabilityBoundingSet=~CAP_MAC_OVERRIDE
 
index f622d8f..28e3edb 100755 (executable)
@@ -78,6 +78,7 @@ static struct {
        bool enable_6to4;
 #if defined TIZEN_EXT
        char **cellular_interfaces;
+       bool tizen_tv_extension;
 #endif
 } connman_settings  = {
        .bg_scan = true,
@@ -95,6 +96,7 @@ static struct {
        .enable_6to4 = false,
 #if defined TIZEN_EXT
        .cellular_interfaces = NULL,
+       .tizen_tv_extension = false,
 #endif
 };
 
@@ -113,6 +115,7 @@ static struct {
 #define CONF_ENABLE_6TO4                "Enable6to4"
 #if defined TIZEN_EXT
 #define CONF_CELLULAR_INTERFACE         "NetworkCellularInterfaceList"
+#define CONF_TIZEN_TV_EXT              "TizenTVExtension"
 #endif
 
 static const char *supported_options[] = {
@@ -131,6 +134,7 @@ static const char *supported_options[] = {
        CONF_ENABLE_6TO4,
 #if defined TIZEN_EXT
        CONF_CELLULAR_INTERFACE,
+       CONF_TIZEN_TV_EXT,
 #endif
        NULL
 };
@@ -251,6 +255,7 @@ static void check_Tizen_configuration(GKeyFile *config)
 {
        GError *error = NULL;
        char **cellular_interfaces;
+       bool boolean;
        gsize len;
 
        cellular_interfaces = g_key_file_get_string_list(config, "General",
@@ -260,6 +265,13 @@ static void check_Tizen_configuration(GKeyFile *config)
                connman_settings.cellular_interfaces = cellular_interfaces;
 
        g_clear_error(&error);
+
+       boolean = __connman_config_get_bool(config, "General",
+                       CONF_TIZEN_TV_EXT, &error);
+       if (!error)
+               connman_settings.tizen_tv_extension = boolean;
+
+       g_clear_error(&error);
 }
 
 static void set_nofile_inc(void)
diff --git a/src/main_tv.conf b/src/main_tv.conf
new file mode 100755 (executable)
index 0000000..fd3afc9
--- /dev/null
@@ -0,0 +1,116 @@
+[General]
+
+# Set input request timeout. Default is 120 seconds
+# The request for inputs like passphrase will timeout
+# after certain amount of time. Use this setting to
+# increase the value in case of different user
+# interface designs.
+# InputRequestTimeout = 120
+
+# Set browser launch timeout. Default is 300 seconds
+# The request for launching a browser for portal pages
+# will timeout after certain amount of time. Use this
+# setting to increase the value in case of different
+# user interface designs.
+# BrowserLaunchTimeout = 300
+
+# Enable background scanning. Default is true.
+# Background scanning will start every 5 minutes unless
+# the scan list is empty. In that case, a simple backoff
+# mechanism starting from 10s up to 5 minutes will run.
+# BackgroundScanning = true
+BackgroundScanning = false
+
+# List of Fallback timeservers separated by ",".
+# These timeservers are used for NTP sync when there are
+# no timeserver set by the user or by the service.
+# These can contain mixed combination of fully qualified
+# domain names, IPv4 and IPv6 addresses.
+# FallbackTimeservers =
+#FallbackTimeservers = pool.ntp.org
+
+# List of fallback nameservers separated by "," used if no
+# nameservers are otherwise provided by the service. The
+# nameserver entries must be in numeric format, host
+# names are ignored.
+# FallbackNameservers =
+
+# List of technologies that are marked autoconnectable
+# by default, separated by commas ",". The default value
+# for this entry when empty is ethernet,wifi,cellular.
+# Services that are automatically connected must have been
+# set up and saved to storage beforehand.
+# DefaultAutoConnectTechnologies =
+
+# List of preferred technologies from the most preferred
+# one to the least preferred one separated by commas ",".
+# Services of the listed technology type will be tried one
+# by one in the order given, until one of them gets connected
+# or they are all tried. A service of a preferred technology
+# type in state 'ready' will get the default route when
+# compared to another preferred type further down the list
+# with state 'ready' or with a non-preferred type; a service
+# of a preferred technology type in state 'online' will get
+# the default route when compared to either a non-preferred
+# type or a preferred type further down in the list.
+# PreferredTechnologies =
+PreferredTechnologies = wifi, ethernet
+
+# List of blacklisted network interfaces separated by ",".
+# Found interfaces will be compared to the list and will
+# not be handled by connman, if their first characters
+# match any of the list entries. Default value is
+# vmnet,vboxnet,virbr,ifb.
+# NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb
+NetworkInterfaceBlacklist = veth, vmnet,vboxnet,virbr,usb,rndis,rmnet,rev_rmnet,dummy,seth_td,seth_w
+
+# Allow connman to change the system hostname. This can
+# happen for example if we receive DHCP hostname option.
+# Default value is true.
+# AllowHostnameUpdates = true
+
+# Keep only a single connected technology at any time. When a new
+# service is connected by the user or a better one is found according
+# to PreferredTechnologies, the new service is kept connected and all
+# the other previously connected services are disconnected. With this
+# setting it does not matter whether the previously connected services
+# are in 'online' or 'ready' states, the newly connected service is
+# the only one that will be kept connected. A service connected by the
+# user will be used until going out of network coverage. With this
+# setting enabled applications will notice more network breaks than
+# normal. Default value is false.
+# SingleConnectedTechnology = false
+SingleConnectedTechnology = true
+
+# List of technologies for which tethering is allowed separated by ",".
+# The default value is wifi,bluetooth,gadget. Only those technologies
+# listed here are used for tethering. If ethernet tethering is desired,
+# then ethernet should be added to the list. The technologies listed here
+# have to support tethering, currently tethering is implemented for wifi,
+# bluetooth, gadget and ethernet.
+# NOTE that if ethernet tethering is enabled, then a DHCP server is
+# started on all ethernet interfaces. Tethered ethernet should
+# never be connected to corporate or home network as it will disrupt
+# normal operation of these networks. Due to this ethernet is not
+# tethered by default. Do not activate ethernet tethering unless you
+# really know what you are doing.
+# TetheringTechnologies = wifi,bluetooth,gadget
+
+# Restore earlier tethering status when returning from offline mode,
+# re-enabling a technology, and after restarts and reboots.
+# Default value is false.
+# PersistentTetheringMode = false
+
+# Automatically enable Anycast 6to4 if possible. This is not recommended, as
+# the use of 6to4 will generally lead to a severe degradation of connection
+# quality. See RFC6343. Default value is false (as recommended by RFC6343
+# section 4.1).
+# Enable6to4 = false
+
+NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w
+
+
+
+# Enable Tizen TV Profile Features
+TizenTVExtension = true
+
index 684668b..42ebd4a 100755 (executable)
@@ -489,8 +489,8 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
                return;
        }
 
-#if defined TIZEN_TV_EXT
-       if (g_strcmp0(ident, "eeeeeeeeeeee") == 0) {
+#ifdef TIZEN_EXT
+       if (TIZEN_TV_EXT && g_strcmp0(ident, "eeeeeeeeeeee") == 0) {
                DBG("Newlink event with Dummy MAC. Ignored!");
                return;
        }
index fa2f709..f561170 100755 (executable)
@@ -77,7 +77,7 @@ struct connman_service_user {
        uid_t current_user;
 };
 
-#if defined TIZEN_TV_EXT
+#ifdef TIZEN_EXT
 enum connman_dnsconfig_method {
        CONNMAN_DNSCONFIG_METHOD_UNKNOWN = 0,
        CONNMAN_DNSCONFIG_METHOD_MANUAL  = 1,
@@ -165,7 +165,7 @@ struct connman_service {
        char *keymgmt_type;
        int disconnect_reason;
 #endif
-#if defined TIZEN_TV_EXT
+#ifdef TIZEN_EXT
        enum connman_dnsconfig_method dns_config_method;
 #endif
 };
@@ -447,7 +447,7 @@ static enum connman_service_proxy_method string2proxymethod(const char *method)
                return CONNMAN_SERVICE_PROXY_METHOD_UNKNOWN;
 }
 
-#if defined TIZEN_TV_EXT
+#ifdef TIZEN_EXT
 static const char *__connman_dnsconfig_method2string(enum connman_dnsconfig_method method)
 {
        switch (method) {
@@ -754,11 +754,13 @@ static int service_load(struct connman_service *service)
                service->nameservers_config = NULL;
        }
 
-#if defined TIZEN_TV_EXT
+#ifdef TIZEN_EXT
        char *dns_method;
-       dns_method = g_key_file_get_string(keyfile, service->identifier,
-                       "Nameservers.method", NULL);
-       service->dns_config_method = __connman_dnsconfig_string2method(dns_method);
+       if (TIZEN_TV_EXT) {
+               dns_method = g_key_file_get_string(keyfile, service->identifier,
+                               "Nameservers.method", NULL);
+               service->dns_config_method = __connman_dnsconfig_string2method(dns_method);
+       }
 #endif
 
        service->timeservers_config = g_key_file_get_string_list(keyfile,
@@ -997,16 +999,18 @@ static int service_save(struct connman_service *service)
        g_key_file_remove_key(keyfile, service->identifier,
                                                        "Nameservers", NULL);
 
-#if defined TIZEN_TV_EXT
-       if(service->dns_config_method != 0) {
-               const char *method;
-               method = __connman_dnsconfig_method2string(
-                               service->dns_config_method);
-               g_key_file_set_string(keyfile, service->identifier,
-                               "Nameservers.method", method);
-       } else
-       g_key_file_remove_key(keyfile, service->identifier,
-                                               "Nameservers.method", NULL);
+#ifdef TIZEN_EXT
+       if (TIZEN_TV_EXT) {
+               if(service->dns_config_method != 0) {
+                       const char *method;
+                       method = __connman_dnsconfig_method2string(
+                                       service->dns_config_method);
+                       g_key_file_set_string(keyfile, service->identifier,
+                                       "Nameservers.method", method);
+               } else
+               g_key_file_remove_key(keyfile, service->identifier,
+                                                       "Nameservers.method", NULL);
+       }
 #endif
 
        if (service->timeservers_config) {
@@ -1493,8 +1497,9 @@ int __connman_service_nameserver_append(struct connman_service *service,
 
        nameservers[len + 1] = NULL;
 
-#if defined TIZEN_TV_EXT
-       if(service->dns_config_method == CONNMAN_DNSCONFIG_METHOD_UNKNOWN)
+#ifdef TIZEN_EXT
+       if(TIZEN_TV_EXT &&
+          service->dns_config_method == CONNMAN_DNSCONFIG_METHOD_UNKNOWN)
                service->dns_config_method = CONNMAN_DNSCONFIG_METHOD_DHCP;
 #endif
 
@@ -2114,13 +2119,15 @@ static void append_dns(DBusMessageIter *iter, void *user_data)
        if (!is_connected(service))
                return;
 
-#if defined TIZEN_TV_EXT
-       /* Append DNS Config Type */
+#ifdef TIZEN_EXT
        const char *str;
-       str = __connman_dnsconfig_method2string(service->dns_config_method);
-       if(str != NULL)
-               dbus_message_iter_append_basic(iter,
-                       DBUS_TYPE_STRING, &str);
+       if (TIZEN_TV_EXT) {
+               /* Append DNS Config Type */
+               str = __connman_dnsconfig_method2string(service->dns_config_method);
+               if(str != NULL)
+                       dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &str);
+       }
 #endif
 
        if (service->nameservers_config) {
@@ -2151,13 +2158,15 @@ static void append_dnsconfig(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
 
-#if defined TIZEN_TV_EXT
+#ifdef TIZEN_EXT
        /* Append DNS Config Type */
        const char *str;
-       str = __connman_dnsconfig_method2string(service->dns_config_method);
-       if(str != NULL)
-               dbus_message_iter_append_basic(iter,
-                       DBUS_TYPE_STRING, &str);
+       if (TIZEN_TV_EXT) {
+               str = __connman_dnsconfig_method2string(service->dns_config_method);
+               if(str != NULL)
+                       dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &str);
+       }
 #endif
 
        if (!service->nameservers_config)
@@ -2796,11 +2805,13 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                connman_dbus_dict_append_basic(dict, "State",
                                                DBUS_TYPE_STRING, &str);
 
-#if defined TIZEN_TV_EXT
-       str = state2string(service->state_ipv6);
-       if (str != NULL)
-               connman_dbus_dict_append_basic(dict, "StateIPv6",
-                                               DBUS_TYPE_STRING, &str);
+#ifdef TIZEN_EXT
+       if (TIZEN_TV_EXT) {
+               str = state2string(service->state_ipv6);
+               if (str != NULL)
+                       connman_dbus_dict_append_basic(dict, "StateIPv6",
+                                                       DBUS_TYPE_STRING, &str);
+       }
 #endif
 
        str = error2string(service->error);
@@ -3856,16 +3867,18 @@ static DBusMessage *set_property(DBusConnection *conn,
                        const char *val;
                        dbus_message_iter_get_basic(&entry, &val);
                        dbus_message_iter_next(&entry);
-#if defined TIZEN_TV_EXT
-                       /* First unpack the DNS Config Method */
-                       if(g_strcmp0(val, "manual") == 0) {
-                               service->dns_config_method =
-                                       CONNMAN_DNSCONFIG_METHOD_MANUAL;
-                               continue;
-                       } else if(g_strcmp0(val, "dhcp") == 0) {
-                               service->dns_config_method =
-                                       CONNMAN_DNSCONFIG_METHOD_DHCP;
-                               continue;
+#ifdef TIZEN_EXT
+                       if (TIZEN_TV_EXT) {
+                               /* First unpack the DNS Config Method */
+                               if(g_strcmp0(val, "manual") == 0) {
+                                       service->dns_config_method =
+                                               CONNMAN_DNSCONFIG_METHOD_MANUAL;
+                                       continue;
+                               } else if(g_strcmp0(val, "dhcp") == 0) {
+                                       service->dns_config_method =
+                                               CONNMAN_DNSCONFIG_METHOD_DHCP;
+                                       continue;
+                               }
                        }
 #endif
                        if (connman_inet_check_ipaddress(val) > 0) {
@@ -4791,9 +4804,11 @@ bool __connman_service_remove(struct connman_service *service)
                        __connman_provider_is_immutable(service->provider))
                return false;
 
+#if !defined TIZEN_EXT
        if (!service->favorite && service->state !=
                                                CONNMAN_SERVICE_STATE_FAILURE)
                return false;
+#endif
 
        __connman_service_disconnect(service);