After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684824 - Tries to activate out of range networks
Tries to activate out of range networks
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Network
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-25 21:25 UTC by Cosimo Cecchi
Modified: 2012-10-02 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
don't try to activate out-of-range connections (1.24 KB, patch)
2012-09-29 23:36 UTC, Matthias Clasen
committed Details | Review

Description Cosimo Cecchi 2012-09-25 21:25:29 UTC
When I click on a network that is out of range, it still tries to connect to it; the shell indicator will turn to "..." and I will get a password prompt and a subsequent "Activation of connection failed" notification after a timeout.

I think clicking on an out of range network should bring you directly to its configuration page.
Comment 1 Matthias Clasen 2012-09-29 23:36:22 UTC
Created attachment 225403 [details] [review]
don't try to activate out-of-range connections

Here is a patch that just stops the pointles connection attempt.
Comment 2 Bastien Nocera 2012-10-01 10:33:46 UTC
Review of attachment 225403 [details] [review]:

::: panels/network/net-device-wifi.c
@@ -1651,3 @@
-        else if (connection_id)
-                activate_connection (device_wifi, connection_id);
-        else if (ap_in_range || mode == NM_802_11_MODE_UNKNOWN)

What's NM_802_11_MODE_UNKNOWN supposed to be?
Comment 3 Matthias Clasen 2012-10-01 23:01:14 UTC
> What's NM_802_11_MODE_UNKNOWN supposed to be?

its a fancy name for 0. Which is unfortunately the value we stuff in the mode column for all the out-of-range aps...
Comment 4 Bastien Nocera 2012-10-02 10:08:51 UTC
Wouldn't something as simple as this fix it?

diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 4794bff..2b8cb67 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -47,6 +47,8 @@
 
 #include "net-device-wifi.h"
 
+#define INVALID_AP_MODE -1
+
 #define NET_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE_WIFI, NetDeviceWifiPrivate))
 
 static void nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi);
@@ -585,7 +587,7 @@ add_saved_connection (NetDeviceWifi *device_wifi, NMConnection *connection, NMDe
                                                    COLUMN_TITLE, title,
                                                    COLUMN_SORT, ssid_text,
                                                    COLUMN_STRENGTH, 0,
-                                                   COLUMN_MODE, 0,
+                                                   COLUMN_MODE, INVALID_AP_MODE,
                                                    COLUMN_SECURITY, 0,
                                                    COLUMN_ACTIVE, FALSE,
                                                    COLUMN_AP_IN_RANGE, FALSE,


I also don't understand why that got removed:
-        else if (connection_id)
-                activate_connection (device_wifi, connection_id);
Comment 5 Matthias Clasen 2012-10-02 10:44:27 UTC
(In reply to comment #4)
> Wouldn't something as simple as this fix it?


It would have the same effect, pretty much. But it would leave the conditions in connect_wifi_network as confused as they are now - we only ever want to try connecting if ap_in_range is true.

> 
> I also don't understand why that got removed:
> -        else if (connection_id)
> -                activate_connection (device_wifi, connection_id);

Because we only want to try connecting if ap_in_range is true.
Comment 6 Bastien Nocera 2012-10-02 11:01:34 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Wouldn't something as simple as this fix it?
> 
> 
> It would have the same effect, pretty much. But it would leave the conditions
> in connect_wifi_network as confused as they are now - we only ever want to try
> connecting if ap_in_range is true.

Right, that needs fixing.

> > I also don't understand why that got removed:
> > -        else if (connection_id)
> > -                activate_connection (device_wifi, connection_id);
> 
> Because we only want to try connecting if ap_in_range is true.

But we also want to check for a connection_id, no? When would activate_connection() be called?
Comment 7 Matthias Clasen 2012-10-02 12:49:57 UTC
(In reply to comment #6)


> > Because we only want to try connecting if ap_in_range is true.
> 
> But we also want to check for a connection_id, no? When would
> activate_connection() be called?

Right, so I guess the logic needs to be:

 if (in range)
   {
      if (has connection)
        activate_connection (...)
      else
        wireless_try_to_connect (...)
   }
Comment 8 Bastien Nocera 2012-10-02 13:12:39 UTC
(In reply to comment #7)
> (In reply to comment #6)
> 
> 
> > > Because we only want to try connecting if ap_in_range is true.
> > 
> > But we also want to check for a connection_id, no? When would
> > activate_connection() be called?
> 
> Right, so I guess the logic needs to be:
> 
>  if (in range)
>    {
>       if (has connection)
>         activate_connection (...)
>       else
>         wireless_try_to_connect (...)
>    }

Pushed that code to git.