Wicd-gtk shows I'm connected to the wrong network

Bug #1037759 reported by asdfadf
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
wicd
New
Undecided
Unassigned

Bug Description

When two wireless networks have the same ESSID (but different channels), no matter which one I connect to, wicd-gtk shows I'm connected to the one with the lower channel.

Again:
Two wireless networks are available. Both have the ESSID "linksys". One is using channel 1, one is using channel 6. I click "connect" for the one using channel 1. I get connected, and wicd-gtk shows I'm connected to the network using channel 1. I click "disconnect", then for the one using channel 6, I click "connect". I get connected, and wicd-gtk shows I'm connected to the network using channel 1. I click "disconnect" and in the terminal, type: sudo iwconfig wlan0 essid linksys channel 6; sudo dhcpcd wlan0 . I get connected, and wicd-gtk shows I am connected to the network using channel 1.

I have tried this also with the channel 1 network set to refuse connections from my MAC address, so I know I'm connected to the network using channel 6. But wicd-gtk still shows I'm connected to the one using channel 1.

Revision history for this message
John Boiles (johnaboiles) wrote :

This patched fixed the same issue using wicd-curses. I bet it fixes wicd-gtk as well.

Note: Ideally we'd modify GetApBssid to also accept an iwconfig parameter so we don't have to do extra work. BUT, this was causing dbus errors for me that I didn't have time to dig into, so I went with the simple option which has one extra call to iwconfig every time GetCurrentNetworkID is called.

=== modified file 'wicd/wicd-daemon.py'
--- wicd/wicd-daemon.py 2012-11-22 08:02:04 +0000
+++ wicd/wicd-daemon.py 2014-05-28 23:29:37 +0000
@@ -1177,8 +1177,9 @@
     def GetCurrentNetworkID(self, iwconfig=None):
         """ Returns the id of the current network, or -1 if its not found. """
         currentESSID = self.GetCurrentNetwork(iwconfig)
+ currentBSSID = self.GetApBssid()
         for x in xrange(0, len(self.LastScan)):
- if self.LastScan[x]['essid'] == currentESSID:
+ if self.LastScan[x]['essid'] == currentESSID and self.LastScan[x]['bssid'] == currentBSSID:
                 return x
         if self.debug_mode:
             print 'GetCurrentNetworkID: Returning -1, current network not found'

Revision history for this message
John Boiles (johnaboiles) wrote :
Download full text (3.6 KiB)

Here's a better patch that removes the extra calls to iwconfig. Turns out using named arguments with defaults in python method definitions doesn't play well with dbus. So if you don't already have an iwconfig output, just call GetApBssid('') instead of GetApBssid(). I see this is done elsewhere in the codebase.

=== modified file 'gtk/gui.py'
--- gtk/gui.py 2013-01-23 19:38:10 +0000
+++ gtk/gui.py 2014-05-29 00:09:39 +0000
@@ -614,7 +614,7 @@
             state in [misc.WIRED, misc.WIRELESS]
         )
         if self.prev_state != state or force_check:
- apbssid = wireless.GetApBssid()
+ apbssid = wireless.GetApBssid('')
             for entry in chain(self.network_list, self.wired_network_box):
                 if hasattr(entry, "update_connect_button"):
                     entry.update_connect_button(state, apbssid)

=== modified file 'gtk/netentry.py'
--- gtk/netentry.py 2012-11-28 15:54:31 +0000
+++ gtk/netentry.py 2014-05-29 00:09:39 +0000
@@ -1110,7 +1110,7 @@
         if to_bool(self.format_entry(self.networkID, "never")):
             self.connect_button.set_sensitive(False)
         if not apbssid:
- apbssid = wireless.GetApBssid()
+ apbssid = wireless.GetApBssid('')
         if state == misc.WIRELESS and \
            apbssid == wireless.GetWirelessProperty(self.networkID, "bssid"):
             self.disconnect_button.show()

=== modified file 'wicd/monitor.py'
--- wicd/monitor.py 2012-11-17 00:07:08 +0000
+++ wicd/monitor.py 2014-05-29 00:09:46 +0000
@@ -178,7 +178,7 @@
             self.iwconfig = ''
         # Reset this, just in case.
         self.tried_reconnect = False
- bssid = wireless.GetApBssid()
+ bssid = wireless.GetApBssid('')
         if not bssid:
             return False

=== modified file 'wicd/networking.py'
--- wicd/networking.py 2013-02-01 21:14:15 +0000
+++ wicd/networking.py 2014-05-28 23:55:05 +0000
@@ -710,7 +710,7 @@
             return self.connecting_thread.network['essid']
         return self.wiface.GetCurrentNetwork(iwconfig)

- def GetBSSID(self):
+ def GetBSSID(self, iwconfig=""):
         """ Get the BSSID of the current access point.

         Returns:
@@ -718,7 +718,7 @@
         None the BSSID can't be found.

         """
- return self.wiface.GetBSSID()
+ return self.wiface.GetBSSID(iwconfig)

     def GetCurrentBitrate(self, iwconfig):
         """ Get the current bitrate of the interface.

=== modified file 'wicd/wicd-daemon.py'
--- wicd/wicd-daemon.py 2012-11-22 08:02:04 +0000
+++ wicd/wicd-daemon.py 2014-05-29 00:07:28 +0000
@@ -1045,9 +1045,9 @@
         return len(self.LastScan)

     @dbus.service.method('org.wicd.daemon.wireless')
- def GetApBssid(self):
+ def GetApBssid(self, iwconfig):
         """ Gets the MAC address for the active network. """
- return self.wifi.GetBSSID()
+ return self.wifi.GetBSSID(iwconfig)

     @dbus.service.method('org.wicd.daemon.wireless')
     def GetCurrentBitrate(self, iwconfig):
@@ -1177,8 +1177,9 @@
     def GetCurrentNetworkID(self, iwconfig=None):
         """ Returns the id of the current network, or -1 if its not found. ...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.