summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgsupplicant/gsupplicant.h15
-rwxr-xr-xgsupplicant/supplicant.c85
-rwxr-xr-xpackaging/connman.spec5
-rwxr-xr-xplugins/wifi.c52
-rw-r--r--resources/usr/share/dbus-1/system-services/net.connman.service5
-rwxr-xr-xsrc/connection.c9
-rwxr-xr-xsrc/connman.service.in3
-rwxr-xr-xsrc/dnsproxy.c6
-rwxr-xr-xsrc/ipconfig.c10
-rwxr-xr-xsrc/network.c3
-rwxr-xr-xsrc/service.c60
11 files changed, 243 insertions, 10 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 6c702001..ad78c29d 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -157,10 +157,22 @@ struct _GSupplicantSSID {
const char *pin_wps;
const char *bgscan;
int ignore_broadcast_ssid;
+#if defined TIZEN_EXT
+ unsigned char *bssid;
+#endif
};
typedef struct _GSupplicantSSID GSupplicantSSID;
+/*
+ * Max number of SSIDs that can be scanned.
+ * In wpa_s 0.7x the limit is 4.
+ * In wps_s 0.8 or later it is 16.
+ * The value is only used if wpa_supplicant does not return any max limit
+ * for number of scannable SSIDs.
+ */
+#define WPAS_MAX_SCAN_SSIDS 4
+
struct scan_ssid {
unsigned char ssid[32];
uint8_t ssid_len;
@@ -369,6 +381,9 @@ struct _GSupplicantCallbacks {
#endif
void (*network_changed) (GSupplicantNetwork *network,
const char *property);
+#if defined TIZEN_EXT
+ void (*system_power_off) (void);
+#endif
void (*add_station) (const char *mac);
void (*remove_station) (const char *mac);
void (*peer_found) (GSupplicantPeer *peer);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 3ef7fd08..73f5bc31 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -416,6 +416,7 @@ static void callback_interface_removed(GSupplicantInterface *interface)
callbacks_pointer->interface_removed(interface);
}
+#if !defined TIZEN_EXT
static void callback_p2p_support(GSupplicantInterface *interface)
{
SUPPLICANT_DBG("");
@@ -426,6 +427,7 @@ static void callback_p2p_support(GSupplicantInterface *interface)
if (callbacks_pointer && callbacks_pointer->p2p_support)
callbacks_pointer->p2p_support(interface);
}
+#endif
static void callback_scan_started(GSupplicantInterface *interface)
{
@@ -584,6 +586,9 @@ static void remove_interface(gpointer data)
g_free(interface->wps_cred.key);
g_free(interface->path);
g_free(interface->network_path);
+#if defined TIZEN_EXT
+ interface->network_path = NULL;
+#endif
g_free(interface->ifname);
g_free(interface->driver);
g_free(interface->bridge);
@@ -921,6 +926,9 @@ unsigned int g_supplicant_interface_get_max_scan_ssids(
if (!interface)
return 0;
+ if (interface->max_scan_ssids == 0)
+ return WPAS_MAX_SCAN_SSIDS;
+
return interface->max_scan_ssids;
}
@@ -2606,8 +2614,23 @@ static void signal_bss_changed(const char *path, DBusMessageIter *iter)
return;
}
+#if defined TIZEN_EXT
+ if ((bss->keymgmt & G_SUPPLICANT_KEYMGMT_WPS) != 0) {
+ network->wps = TRUE;
+ network->wps_capabilities |= bss->wps_capabilities;
+ } else
+ network->wps = FALSE;
+#endif
+
if (bss->signal == network->signal)
+#ifndef TIZEN_EXT
return;
+#else
+ {
+ callback_network_changed(network, "");
+ return;
+ }
+#endif
/*
* If the new signal is lower than the SSID signal, we need
@@ -2615,7 +2638,14 @@ static void signal_bss_changed(const char *path, DBusMessageIter *iter)
*/
if (bss->signal < network->signal) {
if (bss != network->best_bss)
+#ifndef TIZEN_EXT
return;
+#else
+ {
+ callback_network_changed(network, "");
+ return;
+ }
+#endif
network->signal = bss->signal;
update_network_signal(network);
} else {
@@ -2717,7 +2747,7 @@ static void signal_wps_event(const char *path, DBusMessageIter *iter)
if (g_strcmp0(name, "success") == 0)
interface->wps_state = G_SUPPLICANT_WPS_STATE_SUCCESS;
- else if (g_strcmp0(name, "fail") == 0)
+ else if (g_strcmp0(name, "failed") == 0)
interface->wps_state = G_SUPPLICANT_WPS_STATE_FAIL;
else
interface->wps_state = G_SUPPLICANT_WPS_STATE_UNKNOWN;
@@ -2730,6 +2760,29 @@ static void signal_wps_event(const char *path, DBusMessageIter *iter)
supplicant_dbus_property_foreach(iter, wps_event_args, interface);
}
+#if defined TIZEN_EXT
+static void signal_power_off(const char *path, DBusMessageIter *iter)
+{
+ int poweroff_state = 0;
+
+ dbus_message_iter_get_basic(iter, &poweroff_state);
+
+ SUPPLICANT_DBG("poweroff_state(%d)", poweroff_state);
+
+ /* POWER_OFF_DIRECT 2 && POWER_OFF_RESTART 3 */
+ if (poweroff_state != 2 && poweroff_state != 3)
+ return;
+
+ if (callbacks_pointer == NULL)
+ return;
+
+ if (callbacks_pointer->system_power_off == NULL)
+ return;
+
+ callbacks_pointer->system_power_off();
+}
+#endif
+
static void signal_station_connected(const char *path, DBusMessageIter *iter)
{
GSupplicantInterface *interface;
@@ -3344,6 +3397,9 @@ static struct {
{ SUPPLICANT_INTERFACE ".Interface.WPS", "Credentials", signal_wps_credentials },
{ SUPPLICANT_INTERFACE ".Interface.WPS", "Event", signal_wps_event },
+#if defined TIZEN_EXT
+ { "org.tizen.system.deviced.PowerOff", "ChangeState", signal_power_off },
+#endif
{ SUPPLICANT_INTERFACE".Interface", "StaAuthorized", signal_station_connected },
{ SUPPLICANT_INTERFACE".Interface", "StaDeauthorized", signal_station_disconnected },
@@ -3687,7 +3743,9 @@ static void interface_create_property(const char *key, DBusMessageIter *iter,
if (!key) {
if (data->callback) {
data->callback(0, data->interface, data->user_data);
+#if !defined TIZEN_EXT
callback_p2p_support(interface);
+#endif
}
interface_create_data_free(data);
@@ -3797,7 +3855,9 @@ static void interface_get_result(const char *error,
if (data->callback) {
data->callback(0, interface, data->user_data);
+#if !defined TIZEN_EXT
callback_p2p_support(interface);
+#endif
}
interface_create_data_free(data);
@@ -4782,6 +4842,12 @@ static void interface_add_wps_params(DBusMessageIter *iter, void *user_data)
supplicant_dbus_dict_append_basic(&dict, "Type",
DBUS_TYPE_STRING, &type);
+#if defined TIZEN_EXT
+ if (ssid->bssid)
+ supplicant_dbus_dict_append_fixed_array(&dict, "Bssid",
+ DBUS_TYPE_BYTE, &ssid->bssid, 6);
+#endif
+
supplicant_dbus_dict_close(iter, &dict);
}
@@ -4798,7 +4864,17 @@ static void wps_start(const char *error, DBusMessageIter *iter, void *user_data)
dbus_free(data);
return;
}
-
+#if defined TIZEN_EXT
+ GSupplicantSSID *ssid = data->ssid;
+ if (ssid->pin_wps != NULL) {
+ if (!g_utf8_validate(ssid->pin_wps, 8, NULL)) {
+ SUPPLICANT_DBG("Invalid characters in WPS_PIN");
+ g_free(data->ssid);
+ dbus_free(data);
+ return;
+ }
+ }
+#endif
supplicant_dbus_method_call(data->interface->path,
SUPPLICANT_INTERFACE ".Interface.WPS", "Start",
interface_add_wps_params,
@@ -5515,6 +5591,11 @@ int g_supplicant_register(const GSupplicantCallbacks *callbacks)
dbus_bus_add_match(connection, g_supplicant_rule3, NULL);
dbus_bus_add_match(connection, g_supplicant_rule4, NULL);
dbus_bus_add_match(connection, g_supplicant_rule5, NULL);
+#if defined TIZEN_EXT
+ dbus_bus_add_match(connection,
+ "type=signal,interface=org.tizen.system.deviced.PowerOff,"
+ "member=ChangeState", NULL);
+#endif
#if !defined TIZEN_EXT
dbus_bus_add_match(connection, g_supplicant_rule6, NULL);
dbus_bus_add_match(connection, g_supplicant_rule7, NULL);
diff --git a/packaging/connman.spec b/packaging/connman.spec
index 82fe26ed..a802c5aa 100755
--- a/packaging/connman.spec
+++ b/packaging/connman.spec
@@ -1,6 +1,6 @@
Name: connman
Version: 1.26
-Release: 5
+Release: 6
License: GPL-2.0+
Summary: Connection Manager
Url: http://connman.net
@@ -101,6 +101,8 @@ ln -s ../connman.service %{buildroot}%{_unitdir}/multi-user.target.wants/connman
mkdir -p %{buildroot}/%{_localstatedir}/lib/connman
cp resources/var/lib/connman/settings %{buildroot}/%{_localstatedir}/lib/connman/settings
+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
cp src/main.conf %{buildroot}/etc/connman/main.conf
@@ -130,6 +132,7 @@ cp COPYING %{buildroot}%{_datadir}/license/connman
%attr(500,root,root) %{_bindir}/connmanctl
%attr(600,root,root) /%{_localstatedir}/lib/connman/settings
#%{_libdir}/connman/plugins/*.so
+%attr(644,root,root) %{_datadir}/dbus-1/system-services/*
#%{_datadir}/dbus-1/services/*
%{_sysconfdir}/dbus-1/system.d/*
%attr(644,root,root) %{_sysconfdir}/connman/main.conf
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 415447b7..e8c7ae57 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1932,8 +1932,14 @@ static int wifi_scan(enum connman_service_type type,
reset_autoscan(device);
#if defined TIZEN_EXT
- ret = g_supplicant_interface_scan(wifi->interface, NULL,
- scan_callback_hidden, device);
+ if (wifi->hidden) {
+ ret = g_supplicant_interface_scan(wifi->interface, scan_params,
+ scan_callback, device);
+ }
+ else {
+ ret = g_supplicant_interface_scan(wifi->interface, NULL,
+ scan_callback_hidden, device);
+ }
#else
ret = g_supplicant_interface_scan(wifi->interface, scan_params,
scan_callback, device);
@@ -2149,6 +2155,10 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
ssid->use_wps = connman_network_get_bool(network, "WiFi.UseWPS");
ssid->pin_wps = connman_network_get_string(network, "WiFi.PinWPS");
+#if defined TIZEN_EXT
+ ssid->bssid = connman_network_get_bssid(network);
+#endif
+
if (connman_setting_get_bool("BackgroundScanning"))
ssid->bgscan = BGSCAN_DEFAULT;
}
@@ -2932,8 +2942,13 @@ static void network_added(GSupplicantNetwork *supplicant_network)
/* Is AP advertizing for WPS association?
* If so, we decide to use WPS by default */
if (wps_ready && wps_pbc &&
- wps_advertizing)
+ wps_advertizing) {
+#if !defined TIZEN_EXT
connman_network_set_bool(network, "WiFi.UseWPS", true);
+#else
+ DBG("wps is activating by ap but ignore it.");
+#endif
+ }
}
connman_network_set_frequency(network,
@@ -3003,6 +3018,13 @@ static void network_removed(GSupplicantNetwork *network)
if (connman_network == wifi->interface_disconnected_network)
wifi->interface_disconnected_network = NULL;
+
+ if (connman_network == wifi->pending_network)
+ wifi->pending_network = NULL;
+
+ if(connman_network_get_connecting(connman_network) == true){
+ connman_network_set_connected(connman_network, false);
+ }
#endif
wifi->networks = g_slist_remove(wifi->networks, connman_network);
@@ -3022,6 +3044,7 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
const unsigned char *bssid;
unsigned int maxrate;
uint16_t frequency;
+ bool wps;
#endif
interface = g_supplicant_network_get_interface(network);
@@ -3048,10 +3071,12 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
bssid = g_supplicant_network_get_bssid(network);
maxrate = g_supplicant_network_get_maxrate(network);
frequency = g_supplicant_network_get_frequency(network);
+ wps = g_supplicant_network_get_wps(network);
connman_network_set_bssid(connman_network, bssid);
connman_network_set_maxrate(connman_network, maxrate);
connman_network_set_frequency(connman_network, frequency);
+ connman_network_set_bool(connman_network, "WiFi.WPS", wps);
#endif
}
@@ -3233,6 +3258,26 @@ static void peer_request(GSupplicantPeer *peer)
}
#if defined TIZEN_EXT
+static void system_power_off(void)
+{
+ GList *list;
+ struct wifi_data *wifi;
+ struct connman_service *service;
+ struct connman_ipconfig *ipconfig_ipv4;
+
+ if (connman_setting_get_bool("WiFiDHCPRelease") == true) {
+ for (list = iface_list; list; list = list->next) {
+ wifi = list->data;
+
+ if (wifi->network != NULL) {
+ service = connman_service_lookup_from_network(wifi->network);
+ ipconfig_ipv4 = __connman_service_get_ip4config(service);
+ __connman_dhcp_stop(ipconfig_ipv4);
+ }
+ }
+ }
+}
+
static void network_merged(GSupplicantNetwork *network)
{
GSupplicantInterface *interface;
@@ -3326,6 +3371,7 @@ static const GSupplicantCallbacks callbacks = {
.peer_changed = peer_changed,
.peer_request = peer_request,
#if defined TIZEN_EXT
+ .system_power_off = system_power_off,
.network_merged = network_merged,
#endif
.debug = debug,
diff --git a/resources/usr/share/dbus-1/system-services/net.connman.service b/resources/usr/share/dbus-1/system-services/net.connman.service
new file mode 100644
index 00000000..d7730d8a
--- /dev/null
+++ b/resources/usr/share/dbus-1/system-services/net.connman.service
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=net.connman
+Exec=@sbindir@/connmand -n
+User=root
+SystemdService=connman.service \ No newline at end of file
diff --git a/src/connection.c b/src/connection.c
index aa4e1c05..db79ac79 100755
--- a/src/connection.c
+++ b/src/connection.c
@@ -1022,6 +1022,9 @@ bool __connman_connection_update_gateway(void)
bool updated = false;
GHashTableIter iter;
gpointer value, key;
+#if defined TIZEN_EXT
+ static struct gateway_data *old_default = NULL;
+#endif
if (!gateway_hash)
return updated;
@@ -1063,6 +1066,12 @@ bool __connman_connection_update_gateway(void)
}
}
+#if defined TIZEN_EXT
+ if (updated == false && old_default != default_gateway) {
+ updated = true;
+ old_default = default_gateway;
+ }
+#endif
if (updated && default_gateway) {
if (default_gateway->ipv4_gateway)
set_default_gateway(default_gateway,
diff --git a/src/connman.service.in b/src/connman.service.in
index c079054c..b55c571f 100755
--- a/src/connman.service.in
+++ b/src/connman.service.in
@@ -1,6 +1,7 @@
[Unit]
Description=Connection service
-After=tizen-system.target shutdown.target
+After=net-config.service
+DefaultDependencies=no
[Service]
Type=dbus
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index f5ec5021..6e1870f6 100755
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2586,7 +2586,7 @@ static void destroy_server_sec(struct server_data *server)
GList *list;
int fd;
- if(server->channel)
+ if (server->channel)
fd = g_io_channel_unix_get_fd(server->channel);
else
fd = -1;
@@ -2594,8 +2594,10 @@ static void destroy_server_sec(struct server_data *server)
DBG("index %d server %s sock %d", server->index, server->server, fd);
server_list_sec = g_slist_remove(server_list_sec, server);
- if(fd > 0)
+
+ if (fd > 0)
close(fd);
+
server_destroy_socket(server);
if (server->protocol == IPPROTO_UDP && server->enabled)
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 5d6da915..8987ab1a 100755
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -1845,6 +1845,11 @@ void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig,
case CONNMAN_IPCONFIG_METHOD_MANUAL:
case CONNMAN_IPCONFIG_METHOD_DHCP:
append_addr = ipconfig->system;
+#if defined TIZEN_EXT
+ /* TIZEN enables get_properties before __connman_ipconfig_newaddr */
+ if (append_addr && append_addr->local == NULL)
+ append_addr = ipconfig->address;
+#endif
break;
}
@@ -1908,6 +1913,11 @@ void __connman_ipconfig_append_ipv6(struct connman_ipconfig *ipconfig,
case CONNMAN_IPCONFIG_METHOD_DHCP:
case CONNMAN_IPCONFIG_METHOD_AUTO:
append_addr = ipconfig->system;
+#if defined TIZEN_EXT
+ /* TIZEN enables get_properties before __connman_ipconfig_newaddr */
+ if (append_addr && append_addr->local == NULL)
+ append_addr = ipconfig->address;
+#endif
break;
}
diff --git a/src/network.c b/src/network.c
index f928b6af..ad677467 100755
--- a/src/network.c
+++ b/src/network.c
@@ -1355,7 +1355,8 @@ int connman_network_set_associating(struct connman_network *network,
}
#if defined TIZEN_EXT
- if (associating == FALSE)
+ if (associating == FALSE &&
+ connman_network_get_bool(network, "WiFi.UseWPS") == FALSE)
g_timeout_add_seconds(1,
__connman_network_clear_associating_delayed,
network);
diff --git a/src/service.c b/src/service.c
index 320e7cc9..1ee4c4c0 100755
--- a/src/service.c
+++ b/src/service.c
@@ -4040,6 +4040,14 @@ static void set_error(struct connman_service *service,
DBUS_TYPE_STRING, &str);
}
+static void set_idle(struct connman_service *service)
+{
+ service->state = service->state_ipv4 = service->state_ipv6 =
+ CONNMAN_SERVICE_STATE_IDLE;
+ set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
+ state_changed(service);
+}
+
static DBusMessage *clear_property(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
@@ -4344,7 +4352,23 @@ void __connman_service_auto_connect(enum connman_service_connect_reason reason)
if (!__connman_session_policy_autoconnect(reason))
return;
+#if defined TIZEN_EXT
+ /* Adding Timeout of 500ms before trying to auto connect.
+ * This is done because of below scenario
+ * 1. Device is connected to AP1
+ * 2. WPS Connection request is initiated for AP2
+ * 3. Immediately WPS Connection is Cancelled
+ * When WPS Connection Connection is initiated for AP2 then
+ * sometimes there is a scenario where connman gets in ASSOCIATED
+ * state with AP1 due to autoconnect and subsequently the connection
+ * initiated by AP1 fails and connman service for AP1 comes in
+ * FAILURE state due to this when connection with AP2 is cancelled
+ * then autoconnect with AP1 doesn't works because its autoconnection
+ * is ignored as its last state was FAILURE rather than IDLE */
+ autoconnect_timeout = g_timeout_add(500, run_auto_connect,
+#else
autoconnect_timeout = g_timeout_add_seconds(0, run_auto_connect,
+#endif
GUINT_TO_POINTER(reason));
}
@@ -4696,6 +4720,38 @@ bool __connman_service_remove(struct connman_service *service)
g_free(service->eap);
service->eap = NULL;
+#if defined TIZEN_EXT
+ g_free(service->ca_cert_file);
+ service->ca_cert_file = NULL;
+
+ g_free(service->client_cert_file);
+ service->client_cert_file = NULL;
+
+ g_free(service->private_key_file);
+ service->private_key_file = NULL;
+
+ g_free(service->private_key_passphrase);
+ service->private_key_passphrase = NULL;
+
+ g_free(service->phase2);
+ service->phase2 = NULL;
+
+ __connman_ipconfig_set_method(service->ipconfig_ipv4, CONNMAN_IPCONFIG_METHOD_DHCP);
+ __connman_ipconfig_set_method(service->ipconfig_ipv6, CONNMAN_IPCONFIG_METHOD_AUTO);
+ connman_service_set_proxy(service, NULL, false);
+
+ __connman_service_nameserver_clear(service);
+
+ g_strfreev(service->nameservers_config);
+ service->nameservers_config = NULL;
+
+#endif
+
+#if defined TIZEN_EXT
+ if (service->security != CONNMAN_SERVICE_SECURITY_8021X)
+#endif
+ set_idle(service);
+
service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;
service->user.favorite_user = USER_NONE;
@@ -4704,7 +4760,11 @@ bool __connman_service_remove(struct connman_service *service)
__connman_ipconfig_ipv6_reset_privacy(service->ipconfig_ipv6);
+#if defined TIZEN_EXT
+ __connman_storage_remove_service(service->identifier);
+#else
service_save(service);
+#endif
return true;
}