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 1/3] network: connectable flag in network structure
      ([email protected])
   2. [PATCH 2/3] plugin/wifi: Marking network's Connectable flag
      as true. ([email protected])
   3. [PATCH 3/3] device: Use network's connectable flag
      ([email protected])
   4. Re: [PATCH 2/2] Connectable network in wpa_s should not be
      marked unavailable (Naveen Singh)


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

Message: 1
Date: Thu, 19 May 2016 17:30:54 -0700
From: [email protected]
To: [email protected]
Cc: Naveen Singh <[email protected]>
Subject: [PATCH 1/3] network: connectable flag in network structure
Message-ID: <[email protected]>

From: Naveen Singh <[email protected]>

Adding connectable flag in the network structure and API to set and get
that flag. The set API can be used to mark a particular network connectable
so that this network is never removed or maked unavailable.
---
 include/network.h |  5 +++++
 src/network.c     | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/network.h b/include/network.h
index d772699..bb9647f 100644
--- a/include/network.h
+++ b/include/network.h
@@ -102,6 +102,11 @@ bool connman_network_get_connected(struct connman_network 
*network);
 
 bool connman_network_get_associating(struct connman_network *network);
 
+bool connman_network_get_connectable(struct connman_network *network);
+
+int connman_network_set_connectable(struct connman_network *network,
+               bool connectable);
+
 void connman_network_clear_hidden(void *user_data);
 int connman_network_connect_hidden(struct connman_network *network,
                        char *identity, char* passphrase, void *user_data);
diff --git a/src/network.c b/src/network.c
index db3d2f3..2e423bc 100644
--- a/src/network.c
+++ b/src/network.c
@@ -50,6 +50,7 @@ struct connman_network {
        bool available;
        bool connected;
        bool roaming;
+       bool connectable;
        uint8_t strength;
        uint16_t frequency;
        char *identifier;
@@ -825,6 +826,18 @@ static gint compare_priority(gconstpointer a, 
gconstpointer b)
        return driver2->priority - driver1->priority;
 }
 
+int connman_network_set_connectable(struct connman_network *network,
+               bool connectable)
+{
+       network->connectable = connectable;
+       return 0;
+}
+
+bool connman_network_get_connectable(struct connman_network *network)
+{
+       return network->connectable;
+}
+
 /**
  * connman_network_driver_register:
  * @driver: network driver definition
-- 
2.8.0.rc3.226.g39d4020



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

Message: 2
Date: Thu, 19 May 2016 17:30:55 -0700
From: [email protected]
To: [email protected]
Cc: Naveen Singh <[email protected]>
Subject: [PATCH 2/3] plugin/wifi: Marking network's Connectable flag
        as true.
Message-ID: <[email protected]>

From: Naveen Singh <[email protected]>

On network_connect, mark previosuly connected network's connectable flag as
false and current network's one as true. Also do not remove the connected
network on network_removed.
---
 plugins/wifi.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index e76423d..f0b978a 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2100,7 +2100,21 @@ static int network_connect(struct connman_network 
*network)
                wifi->pending_network = network;
                g_free(ssid);
        } else {
+
+               /*
+                * This is the network that is going to get plumbed into wpa_s
+                * Mark the previous network that is plumbed in wpa_s as not
+                * connectable and then the current one as connectable.
+                * This flag will be used to ensure that the network that is
+                * sitting in wpa_s never gets marked unavailable even though
+                * the scan did not find this network.
+                */
+               if (wifi->network) {
+                       connman_network_set_connectable(wifi->network, false);
+               }
+
                wifi->network = connman_network_ref(network);
+               connman_network_set_connectable(wifi->network, true);
                wifi->retries = 0;
 
                return g_supplicant_interface_connect(interface, ssid,
@@ -2124,6 +2138,7 @@ static void disconnect_callback(int result, 
GSupplicantInterface *interface,
        }
 
        if (wifi->network) {
+               connman_network_set_connectable(wifi->network, false);
                connman_network_set_connected(wifi->network, false);
                wifi->network = NULL;
        }
@@ -2741,6 +2756,22 @@ static void network_removed(GSupplicantNetwork *network)
        if (!connman_network)
                return;
 
+       /*
+        * wpa_s did not find this network in last scan and hence it generated
+        * this callback. In case if this is the network with which device
+        * was connected to, even though network_removed was called, wpa_s
+        * will keep trying to connect to the same network and once the
+        * network is back, it will proceed with the connection. Now if
+        * connman would have removed this network from network hash table,
+        * on a successful connection complete indication service state
+        * machine will not move. End result would be only a L2 level
+        * connection and no IP address. This check ensures that even if the
+        * network_removed gets called for the previously connected network
+        * do not remove it from network hash table.
+        */
+       if (wifi->network == connman_network)
+               return;
+
        wifi->networks = g_slist_remove(wifi->networks, connman_network);
 
        connman_device_remove_network(wifi->device, connman_network);
-- 
2.8.0.rc3.226.g39d4020



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

Message: 3
Date: Thu, 19 May 2016 17:30:56 -0700
From: [email protected]
To: [email protected]
Cc: Naveen Singh <[email protected]>
Subject: [PATCH 3/3] device: Use network's connectable flag
Message-ID: <[email protected]>

From: Naveen Singh <[email protected]>

Do not mark a network unavailable if connectable flag is true. Similarly
do not remove a network if connectable flag is set.
---
 src/device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 188106c..742b3c4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -671,7 +671,8 @@ static void mark_network_unavailable(gpointer key, gpointer 
value,
        struct connman_network *network = value;
 
        if (connman_network_get_connected(network) ||
-                       connman_network_get_connecting(network))
+                       connman_network_get_connecting(network) ||
+                       connman_network_get_connectable(network))
                return;
 
        connman_network_set_available(network, false);
@@ -688,6 +689,9 @@ static gboolean remove_unavailable_network(gpointer key, 
gpointer value,
        if (connman_network_get_available(network))
                return FALSE;
 
+       if (connman_network_get_connectable(network))
+               return FALSE;
+
        return TRUE;
 }
 
-- 
2.8.0.rc3.226.g39d4020



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

Message: 4
Date: Thu, 19 May 2016 17:33:27 -0700
From: Naveen Singh <[email protected]>
To: Patrik Flykt <[email protected]>
Cc: [email protected], Naveen Singh <[email protected]>
Subject: Re: [PATCH 2/2] Connectable network in wpa_s should not be
        marked unavailable
Message-ID:
        <cafk1zraoax4qtdx51ptkrj1r6aulxvpu+esd-j9ijovm6qq...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi Patrik
On Thu, May 19, 2016 at 6:28 AM, Patrik Flykt <[email protected]>
wrote:

>
>         Hi,
>
> This patch seems to work. However, please chop it in three pieces: one
> for the network.c helpers, one for device.c and the final one for
> wifi.c and add proper commit messages to all pieces. Please keep line
> lengths and commit messages below 80 characters.
>

I divided this patch into 3 different patch as per your suggestion.

>
> Cheers,
>
>         Patrik


> On Fri, 2016-04-08 at 00:29 -0700, [email protected] wrote:
> > From: Naveen Singh <[email protected]>
> >
> > If a network is added to wpa_s through AddNetwork, never mark that
> > network unavailable even if scan did not find this network. The
> > reason
> > for this is that even if this network is not seen in scan results,
> > wpa_s
> > will keep tring to connect to same network and in case this network
> > is
> > found later on, wifi connection will be established but since it was
> > marked unavailable earlier, connman service state transition would
> > not
> > happen.
> > ---
> >  include/network.h |  4 ++++
> >  plugins/wifi.c    | 29 +++++++++++++++++++++++++++++
> >  src/device.c      |  5 ++++-
> >  src/network.c     | 12 ++++++++++++
> >  4 files changed, 49 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/network.h b/include/network.h
> > index d772699..bf8d809 100644
> > --- a/include/network.h
> > +++ b/include/network.h
> > @@ -102,6 +102,10 @@ bool connman_network_get_connected(struct
> > connman_network *network);
> >
> >  bool connman_network_get_associating(struct connman_network
> > *network);
> >
> > +bool connman_network_get_connectable(struct connman_network
> > *network);
> > +
> > +int connman_network_set_connectable(struct connman_network *network,
> > bool connectable);
> > +
> >  void connman_network_clear_hidden(void *user_data);
> >  int connman_network_connect_hidden(struct connman_network *network,
> >                       char *identity, char* passphrase, void
> > *user_data);
> > diff --git a/plugins/wifi.c b/plugins/wifi.c
> > index e76423d..64d42d8 100644
> > --- a/plugins/wifi.c
> > +++ b/plugins/wifi.c
> > @@ -2100,7 +2100,21 @@ static int network_connect(struct
> > connman_network *network)
> >               wifi->pending_network = network;
> >               g_free(ssid);
> >       } else {
> > +
> > +             /*
> > +              * This is the network that is going to get plumbed
> > into wpa_s
> > +              * Mark the previous network that is plumbed in
> > wpa_s as not
> > +              * connectable and then the current one as
> > connectable. This flag
> > +              * will be used to ensure that the network that is
> > sitting in wpa_s
> > +              * never gets marked unavailable even though the
> > scan did not find
> > +              * this network.
> > +              */
> > +             if (wifi->network) {
> > +                     connman_network_set_connectable(wifi-
> > >network, false);
> > +             }
> > +
> >               wifi->network = connman_network_ref(network);
> > +             connman_network_set_connectable(wifi->network,
> > true);
> >               wifi->retries = 0;
> >
> >               return g_supplicant_interface_connect(interface,
> > ssid,
> > @@ -2124,6 +2138,7 @@ static void disconnect_callback(int result,
> > GSupplicantInterface *interface,
> >       }
> >
> >       if (wifi->network) {
> > +             connman_network_set_connectable(wifi->network,
> > false);
> >               connman_network_set_connected(wifi->network, false);
> >               wifi->network = NULL;
> >       }
> > @@ -2741,6 +2756,20 @@ static void network_removed(GSupplicantNetwork
> > *network)
> >       if (!connman_network)
> >               return;
> >
> > +     /*
> > +      * wpa_s did not find this network in last scan and hence it
> > generated
> > +      * this callback. In case if this is the network with which
> > device was connected
> > +      * to, even though network_removed was called, wpa_s will
> > keep trying to connect to
> > +      * the same network and once the network is back, it will
> > proceed with the connection.
> > +      * Now if connman would have removed this network from
> > network hash table, on a successful
> > +      * connection complete indication service state machine will
> > not move. End result would be
> > +      * only a L2 level connection and no IP address. This check
> > ensures that even if the
> > +      * network_removed gets called for the previously connected
> > network do not remove it from
> > +      * network hash table.
> > +      */
> > +     if (wifi->network == connman_network)
> > +             return;
> > +
> >       wifi->networks = g_slist_remove(wifi->networks,
> > connman_network);
> >
> >       connman_device_remove_network(wifi->device,
> > connman_network);
> > diff --git a/src/device.c b/src/device.c
> > index 188106c..22d9cde 100644
> > --- a/src/device.c
> > +++ b/src/device.c
> > @@ -671,7 +671,7 @@ static void mark_network_unavailable(gpointer
> > key, gpointer value,
> >       struct connman_network *network = value;
> >
> >       if (connman_network_get_connected(network) ||
> > -                     connman_network_get_connecting(network))
> > +                     connman_network_get_connecting(network) ||
> > connman_network_get_connectable(network))
> >               return;
> >
> >       connman_network_set_available(network, false);
> > @@ -688,6 +688,9 @@ static gboolean
> > remove_unavailable_network(gpointer key, gpointer value,
> >       if (connman_network_get_available(network))
> >               return FALSE;
> >
> > +     if (connman_network_get_connectable(network))
> > +             return FALSE;
> > +
> >       return TRUE;
> >  }
> >
> > diff --git a/src/network.c b/src/network.c
> > index db3d2f3..a24eadb 100644
> > --- a/src/network.c
> > +++ b/src/network.c
> > @@ -50,6 +50,7 @@ struct connman_network {
> >       bool available;
> >       bool connected;
> >       bool roaming;
> > +     bool connectable;
> >       uint8_t strength;
> >       uint16_t frequency;
> >       char *identifier;
> > @@ -825,6 +826,17 @@ static gint compare_priority(gconstpointer a,
> > gconstpointer b)
> >       return driver2->priority - driver1->priority;
> >  }
> >
> > +int connman_network_set_connectable(struct connman_network *network,
> > bool connectable)
> > +{
> > +     network->connectable = connectable;
> > +     return 0;
> > +}
> > +
> > +bool connman_network_get_connectable(struct connman_network
> > *network)
> > +{
> > +     return network->connectable;
> > +}
> > +
> >  /**
> >   * connman_network_driver_register:
> >   * @driver: network driver definition
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.01.org/pipermail/connman/attachments/20160519/dbc32ded/attachment.html>

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

Subject: Digest Footer

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


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

End of connman Digest, Vol 7, Issue 11
**************************************

Reply via email to