Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH] service: Fix autoconnect after rejection (Yasser)
   2. [PATCH] timezone : Fix timezone without subpath (Yasser)
   3. [PATCH] network: Fix disconnect_callback crash on error (Yasser)
   4. [PATCH] Force BSS expiration (Yasser)
   5. [PATCH] dbus: Add dbus time synchronization method (Yasser)


----------------------------------------------------------------------

Message: 1
Date: Mon, 27 May 2019 11:02:06 +0200
From: Yasser <[email protected]>
To: [email protected]
Subject: [PATCH] service: Fix autoconnect after rejection
Message-ID:
        <cakiau+1mee9i3h5tevhmz7jkbzwldgfgjhogmjahba+af8o...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

We have had an issue with autoconnect where if the association failed,
connman would not autoconnect. It happened when there were lots of
wireless networks around but none with good signal strength. To fix
this, we schedule  another autoconnect attempt after a delay.


diff --git a/src/service.c b/src/service.c
index 0c5e647..d740848 100644
--- a/src/service.c
+++ b/src/service.c
@@ -38,6 +38,7 @@
 #include "connman.h"

 #define CONNECT_TIMEOUT                120
+#define AUTO_CONNECT_FAILURE_DELAY     10

 #define VPN_AUTOCONNECT_TIMEOUT_DEFAULT 1
 #define VPN_AUTOCONNECT_TIMEOUT_STEP 30
@@ -3918,8 +3919,21 @@ static void service_complete(struct
connman_service *service)
 {
        reply_pending(service, EIO);

-       if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
-               do_auto_connect(service, service->connect_reason);
+       if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER) {
+               if(service->state == CONNMAN_SERVICE_STATE_FAILURE &&
+
connman_network_get_associating(service->network) == true) {
+                       /*
+                        * If association failed, schedule next autoconnect
+                        * attempt after <AUTO_CONNECT_FAILURE_DELAY> seconds
+                        *
+                        */
+                       g_timeout_add_seconds(AUTO_CONNECT_FAILURE_DELAY,
+                       do_auto_connect,
+                       GUINT_TO_POINTER(service->connect_reason));
+               } else {
+                       do_auto_connect(service, service->connect_reason);
+               }
+       }

        g_get_current_time(&service->modified);
        service_save(service);


------------------------------

Message: 2
Date: Mon, 27 May 2019 11:12:58 +0200
From: Yasser <[email protected]>
To: [email protected]
Subject: [PATCH] timezone : Fix timezone without subpath
Message-ID:
        <CAKiAu+1iCNS+BEbnHD_pyyiQU++tuVmMdO=c+vljgk3hmov...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

A small patch to fix the handling of timezones with and without subpath.

diff --git a/src/timezone.c b/src/timezone.c
index 8e91267..0538191 100644
--- a/src/timezone.c
+++ b/src/timezone.c
@@ -187,7 +187,11 @@ static char *find_origin(void *src_map, struct
stat *src_st,
                                                        subpath, d->d_name);

                        if (compare_file(src_map, src_st, pathname) == 0) {
-                               str = g_strdup_printf("%s/%s",
+                               if (!subpath)
+                                       str = g_strdup_printf("%s",
+                                                       d->d_name);
+                               else
+                                       str = g_strdup_printf("%s/%s",
                                                        subpath, d->d_name);
                                closedir(dir);
                                return str;


------------------------------

Message: 3
Date: Mon, 27 May 2019 11:32:58 +0200
From: Yasser <[email protected]>
To: [email protected]
Subject: [PATCH] network: Fix disconnect_callback crash on error
Message-ID:
        <CAKiAu+3H1MbKAW_s5SX==+vccmppf3sgzxpwd0efafapaat...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

We had a crash in connman_network_set_connected() when
disconnect_callback() was called but the value of wifi->network was
not checked. This has already been fixed for wifi.c. However
connman_network_set_connected() is called by other components where
the network parameter is not checked beforehand so we thought it might
be a good idea to verify in the function itself.

diff --git a/src/network.c b/src/network.c
index 56fe24f..0486fad 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1675,6 +1675,9 @@ void connman_network_set_error(struct
connman_network *network,
 int connman_network_set_connected(struct connman_network *network,
                                                bool connected)
 {
+       if (!network)
+               return 0;
+
        DBG("network %p connected %d/%d connecting %d associating %d",
                network, network->connected, connected, network->connecting,
                network->associating);


------------------------------

Message: 4
Date: Mon, 27 May 2019 12:05:11 +0200
From: Yasser <[email protected]>
To: [email protected]
Subject: [PATCH] Force BSS expiration
Message-ID:
        <CAKiAu+1MvaqsUyJsu2tER9F=8xup+d5hoa1jzgmkmhhxtmp...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

We were having a problem with our wifi scanning, where the list of
wifi available would become empty and would not be repopulated until
after a long delay. Researching the problem it seemed that it was
related to BSS expiration age. There were already some people who had
faced the same issue, so inspired by this we developed the following
patch which allows us to set the BSS expiration age to match ConnMan
long scanning interval to avoid the loss of networks during a long
interval between two scans.

diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index bfb52db..08d6b9e 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -267,7 +267,8 @@ int
g_supplicant_interface_connect(GSupplicantInterface *interface,
 int g_supplicant_interface_disconnect(GSupplicantInterface *interface,
                                        GSupplicantInterfaceCallback callback,
                                                        void *user_data);
-
+int g_supplicant_interface_set_bss_expiration_age(GSupplicantInterface
*interface,
+                                                       unsigned int
bss_expiration_age);
 int g_supplicant_interface_set_apscan(GSupplicantInterface *interface,
                                                        unsigned int ap_scan);

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 6052f7b..fe6ad48 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -981,6 +981,46 @@ static void interface_capability(const char *key,
DBusMessageIter *iter,
                                key, dbus_message_iter_get_arg_type(iter));
 }

+struct g_supplicant_bss_expiration_age
+{
+       GSupplicantInterface *interface;
+       unsigned int bss_expiration_age;
+};
+
+static void set_bss_expiration_age(DBusMessageIter *iter, void *user_data)
+{
+       struct g_supplicant_bss_expiration_age *data = user_data;
+       unsigned int bss_expiration_age = data->bss_expiration_age;
+
+       dbus_free(data);
+       dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
&bss_expiration_age);
+}
+
+int g_supplicant_interface_set_bss_expiration_age(GSupplicantInterface
*interface,
+                                                       unsigned int
bss_expiration_age)
+{
+       struct g_supplicant_bss_expiration_age *data;
+       int ret;
+
+       data = dbus_malloc0(sizeof(*data));
+
+       if (!data)
+               return -ENOMEM;
+
+       data->bss_expiration_age = bss_expiration_age;
+       data->interface = interface;
+
+       ret = supplicant_dbus_property_set(interface->path,
+                       SUPPLICANT_INTERFACE ".Interface",
+                       "BSSExpireAge", DBUS_TYPE_UINT32_AS_STRING,
+                       set_bss_expiration_age, NULL, data, NULL);
+       if (ret < 0)
+               dbus_free(data);
+
+       return ret;
+}
+
+
 struct set_apscan_data
 {
        unsigned int ap_scan;
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 910b739..57b63e2 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1522,6 +1522,7 @@ static void interface_create_callback(int result,
                                                        void *user_data)
 {
        struct wifi_data *wifi = user_data;
+       char * bgscan_range_max;

        DBG("result %d ifname %s, wifi %p", result,
                                g_supplicant_interface_get_ifname(interface),
@@ -1537,6 +1538,13 @@ static void interface_create_callback(int result,
                wifi->interface_ready = true;
                finalize_interface_creation(wifi);
        }
+       /* Force the BSS expiration age to match ConnMan long scanning
interval to avoid the loss of networks during a long interval between
two scannings. */
+       if ((bgscan_range_max = strrchr(BGSCAN_DEFAULT,':')) != NULL &&
+
g_supplicant_interface_set_bss_expiration_age(interface,
strtol(bgscan_range_max + 1, (char**)NULL, 10) + 10) >= 0) {
+               DBG("bss expiration age successfully updated");
+       } else {
+               DBG("bss expiration age update has failed");
+       }
 }

 static int wifi_enable(struct connman_device *device)


------------------------------

Message: 5
Date: Mon, 27 May 2019 14:53:09 +0200
From: Yasser <[email protected]>
To: [email protected]
Subject: [PATCH] dbus: Add dbus time synchronization method
Message-ID:
        <CAKiAu+2_mbgPY30eO_1NkBxX3Tg=s_7dnkai4h+zh+jgf08...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Our project has strict time requirements so we needed to have a time
synchronization method. Hopefully it will be useful to someone else
also.

diff --git a/include/dbus.h b/include/dbus.h
index bcab418..d83662d 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -85,6 +85,8 @@ dbus_bool_t connman_dbus_setting_changed_array(const
char *owner,
                                const char *path, const char *key, int type,
                                connman_dbus_append_cb_t function,
                                void *user_data);
+dbus_bool_t connman_dbus_time_synced(const char *path,
+                               const char *interface, double ts);

 static inline void connman_dbus_dict_open(DBusMessageIter *iter,
                                                        DBusMessageIter *dict)
diff --git a/src/clock.c b/src/clock.c
index 0fde2c3..8b5503c 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -368,7 +368,32 @@ static DBusMessage *set_property(DBusConnection *conn,
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }

+static DBusMessage *synchronize(DBusConnection *conn,
+                                       DBusMessage *msg, void *data)
+{
+       DBusMessage *reply;
+       DBusMessageIter iter;
+       gboolean result = FALSE;
+
+       DBG("conn %p", conn);
+
+       reply = dbus_message_new_method_return(msg);
+       if (!reply)
+               return NULL;
+
+       if (__connman_timeserver_sync(NULL) == 0)
+               result = TRUE;
+
+       dbus_message_iter_init_append(reply, &iter);
+       dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &result);
+
+       return reply;
+}
+
 static const GDBusMethodTable clock_methods[] = {
+       { GDBUS_METHOD("Synchronize",
+                       NULL, GDBUS_ARGS( { "success", "b" } ),
+                       synchronize) },
        { GDBUS_METHOD("GetProperties",
                        NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
                        get_properties) },
@@ -381,7 +406,8 @@ static const GDBusMethodTable clock_methods[] = {
 static const GDBusSignalTable clock_signals[] = {
        { GDBUS_SIGNAL("PropertyChanged",
                        GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
-       { },
+       { GDBUS_SIGNAL("TimeSynced",
+                       GDBUS_ARGS({ "timestamp", "d" })) },    { },
 };

 static DBusConnection *connection = NULL;
diff --git a/src/dbus.c b/src/dbus.c
index d80a46c..82d5cf0 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -382,6 +382,27 @@ dbus_bool_t
connman_dbus_setting_changed_array(const char *owner,
        return TRUE;
 }

+dbus_bool_t connman_dbus_time_synced(const char *path,
+                               const char *interface, double ts)
+{
+       DBusMessage *signal;
+       DBusMessageIter iter;
+
+       if (!path)
+               return FALSE;
+
+       signal = dbus_message_new_signal(path, interface, "TimeSynced");
+       if (!signal)
+               return FALSE;
+
+       dbus_message_iter_init_append(signal, &iter);
+       dbus_message_iter_append_basic(&iter, DBUS_TYPE_DOUBLE, &ts);
+
+       g_dbus_send_message(connection, signal);
+
+       return TRUE;
+}
+
 dbus_bool_t __connman_dbus_append_objpath_dict_array(DBusMessage *msg,
                connman_dbus_append_cb_t function, void *user_data)
 {
diff --git a/src/ntp.c b/src/ntp.c
index e7fee22..7d74f17 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -356,6 +356,7 @@ static void decode_msg(struct ntp_data *nd, void
*base, size_t len,
                tmx.esterror = 0;

                connman_info("ntp: adjust (slew): %+.6f sec", offset);
+               connman_dbus_time_synced(CONNMAN_MANAGER_PATH,
CONNMAN_CLOCK_INTERFACE, offset);
        } else {
                tmx.modes = ADJ_STATUS | ADJ_NANO | ADJ_SETOFFSET |
ADJ_MAXERROR | ADJ_ESTERROR;

@@ -372,6 +373,7 @@ static void decode_msg(struct ntp_data *nd, void
*base, size_t len,
                }

                connman_info("ntp: adjust (jump): %+.6f sec", offset);
+               connman_dbus_time_synced(CONNMAN_MANAGER_PATH,
CONNMAN_CLOCK_INTERFACE, offset);
        }

        if (NTP_FLAGS_LI_DECODE(msg->flags) & NTP_FLAG_LI_ADDSECOND)


------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 43, Issue 21
***************************************

Reply via email to