connect_wireless can unintentionally choose a non-wireless connection to connect to

Bug #877752 reported by Daniel Wiberg
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
Medium
Brendan Donegan
checkbox (Ubuntu)
Fix Released
Medium
Unassigned
Oneiric
Won't Fix
Undecided
Unassigned

Bug Description

Output from requested commands:

[danne@danne-fnuttbook] ~/Downloads> nmcli con status
NAME UUID DEVICES DEFAULT VPN
Auto wiberg.nu 00d990e8-dac8-4e7d-b74a-aae85dfea53a wlan0 yes no
[danne@danne-fnuttbook] ~/Downloads> nmcli dev list
GENERAL.DEVICE: wlan0
GENERAL.TYPE: 802-11-wireless
GENERAL.DRIVER: brcmsmac
GENERAL.HWADDR: 48:5D:60:D1:94:CA
GENERAL.STATE: connected
CAPABILITIES.CARRIER-DETECT: no
CAPABILITIES.SPEED: 72 Mb/s
WIFI-PROPERTIES.WEP: yes
WIFI-PROPERTIES.WPA: yes
WIFI-PROPERTIES.WPA2: yes
WIFI-PROPERTIES.TKIP: yes
WIFI-PROPERTIES.CCMP: yes
AP1.SSID: 'TN_private_A394FY'
AP1.BSSID: 90:84:0D:F0:1D:81
AP1.MODE: Infrastructure
AP1.FREQ: 2442 MHz
AP1.RATE: 54 MB/s
AP1.SIGNAL: 32
AP1.SECURITY: WPA
AP1.ACTIVE: no
AP2.SSID: 'TROSKVERK12'
AP2.BSSID: 00:14:6C:78:8E:32
AP2.MODE: Infrastructure
AP2.FREQ: 2462 MHz
AP2.RATE: 54 MB/s
AP2.SIGNAL: 35
AP2.SECURITY: WEP
AP2.ACTIVE: no
AP3.SSID: 'mickeHemma'
AP3.BSSID: 00:1F:33:42:91:FB
AP3.MODE: Infrastructure
AP3.FREQ: 2417 MHz
AP3.RATE: 54 MB/s
AP3.SIGNAL: 45
AP3.SECURITY: WPA WPA2
AP3.ACTIVE: no
AP4.SSID: 'wiberg.nu'
AP4.BSSID: 68:EF:BD:FC:D3:21
AP4.MODE: Infrastructure
AP4.FREQ: 2447 MHz
AP4.RATE: 54 MB/s
AP4.SIGNAL: 85
AP4.SECURITY: WPA2
AP4.ACTIVE: yes
IP4-SETTINGS.ADDRESS: 192.168.242.23
IP4-SETTINGS.PREFIX: 24 (255.255.255.0)
IP4-SETTINGS.GATEWAY: 192.168.242.1
IP4-DNS1.DNS: 192.168.243.12
IP4-DNS2.DNS: 8.8.8.8
GENERAL.DEVICE: eth0
GENERAL.TYPE: 802-3-ethernet
GENERAL.DRIVER: atl1c
GENERAL.HWADDR: BC:AE:C5:A4:59:09
GENERAL.STATE: unavailable
CAPABILITIES.CARRIER-DETECT: yes
CAPABILITIES.SPEED: unknown
WIRED-PROPERTIES.CARRIER: off

ProblemType: BugDistroRelease: Ubuntu 11.10
Package: checkbox 0.12.8
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic i686
ApportVersion: 1.23-0ubuntu3
Architecture: i386
CheckboxSubmission: 996d1de4f6d61b166432b4fc30b66f28
CheckboxSystem: 9c26adf6eed2f681ba41f94dd24c07e4
Date: Tue Oct 18 23:24:44 2011InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)SourcePackage: checkbox
UpgradeStatus: No upgrade log present (probably fresh install)

[Impact]
Under certain cases (such as the reported one, where a VPN and the wireless connection had the same name) the connect_wireless script can become confused and attempt to bring up the non-wireless connection. This obviously makes the wireless tests fail even though the wireless connection may be working fine. Wireless is considered important for portable systems, so this will also wrongly and negatively affect the Ubuntu Friendly ratings of systems.

[Development fix]
Checkbox revision 1113 fixes this by including the connection types when calling "nm con list" and then grepping to select only the ones with type "wireless".

[Stable fix]
This is fixed in http://bazaar.launchpad.net/~checkbox-dev/checkbox/trunk/revision/1113. Also, the linked branch (https://code.launchpad.net/~roadmr/ubuntu/oneiric/checkbox/0.12.8.1) contains this and other fixes and merges cleanly against Ubuntu checkbox 0.12.8.

[Test case]
- Configure a wireless and wired connections so that the name as returned in "nmcli -t -f NAME,TYPE con list" is the same for both.
- Ensure that the system is connected through wireless and the wired connection is not active (disconnect the cable).
- run /usr/share/checkbox/connect_wireless

Expected result:
- All connections are brought down, and the wireless connection is re-brought up. End result: only wireless is connected.

Actual result:
- All connections are brought down, and nothing is brought back up (though an attempt will be made to wrongly activate the ethernet connection).

[Regression potential]
An attempt to bring up an ethernet connection would fail anyway, so even if we find no wireless connections when we previously found at least one (potentially not wireless) connection (which would result in a failed test either way) this doesn't regress from a previous, known-good behavior.

About the only possible regression case is if the output of nmcli con list ever returns wireless connections with a type other than "wireless", as they will then not be picked up by the grep section of the script, where previously they were picked up.

Related branches

Revision history for this message
Daniel Wiberg (dannew) wrote :
Revision history for this message
Daniel Manrique (roadmr) wrote :

Based on discussion with the original reporter, it seems "eth0" was mentioned by the wireless_before_suspend test, this leads me to believe that at the time of running the test, eth0 was connected and maybe the wireless interface wasn't. Another possibility was that some other wireless connections were configured thus confusing the test script.

Even though strictly speaking it's unconfirmed I'll set to importance: High as wireless testing needs to be reliable.

Changed in checkbox (Ubuntu):
importance: Undecided → High
Revision history for this message
Daniel Wiberg (dannew) wrote :

[danne@danne-fnuttbook] ~/Downloads> nmcli con
NAME UUID TYPE TIMESTAMP-REAL
Auto Dannes Nalle 232a0551-6baf-400f-ae87-016f1fddb87c 802-11-wireless Fri 23 Sep 2011 08:07:26 AM CEST
Auto B2_private_8F 3f19c700-3591-4ee5-b6f1-c628ce09a47d 802-11-wireless never
Auto wiberg b0e56574-30e7-4218-95ae-4d111cb34878 802-11-wireless Sun 11 Sep 2011 11:01:53 AM CEST
Wired connection 1 ea3cb0b8-4028-4c0d-b046-b4c8977f7483 802-3-ethernet Tue 18 Oct 2011 07:14:03 PM CEST
wiberg.nu 971ebaeb-9ce2-40c3-bc43-be5f621c33ff vpn never
Auto wiberg.nu 00d990e8-dac8-4e7d-b74a-aae85dfea53a 802-11-wireless Tue 18 Oct 2011 11:36:01 PM CEST

Revision history for this message
Daniel Wiberg (dannew) wrote :

I tried removing all but the active wireless connection, but it didn't help. But I noticed that the test before and after suspend seems to disconnect the wireless, so I think the problem is that the test script disconnects the wireless and then reports it as not functioning. I will do the same tests on my work laptop tomorrow to compare the results.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Hi Daniel,

The logic of the test is as follows:

If checks if you *have* a wireless connection at the point of running the test with 'nmcli -f SSID,ACTIVE dev wifi list'

For you this should be 'wiberg.nu'

It then uses this to get the connection from the list of existing ones, and here's the problem - it picks up 'wiberg.nu 971ebaeb-9ce2-40c3-bc43-be5f621c33ff vpn never' as the connection to use in the test. It then knocks down all your existing connections and brings back up your 'wireless' connection (which in this case is not one).

Try:

> active_connection=$(nmcli -f SSID,ACTIVE dev wifi list | grep yes)
> ap=$(echo $active_connection | awk -F\' '{print $2}')
> conn=$(nmcli -t -f UUID,NAME con list | grep wireless | grep -e "$ap$" | awk -F\: '{print $1}')

versus:

> active_connection=$(nmcli -f SSID,ACTIVE dev wifi list | grep yes)
> ap=$(echo $active_connection | awk -F\' '{print $2}')
> conn=$(nmcli -t -f UUID,NAME con list | grep -e "$ap$" | awk -F\: '{print $1}')

If it's ok to change the 'wiberg.nu' connection name to something like 'wibergvpn' then this will let the test run. In the meanwhile please check the modified code and let me know if it works.

Revision history for this message
Daniel Wiberg (dannew) wrote :

I'll test this as soon as I get home from work.

Revision history for this message
Daniel Wiberg (dannew) wrote :

After a little modification your solution seams to work, type must also be included:
conn=$(nmcli -t -f UUID,TYPE,NAME con list | grep wireless | grep -e "$ap$" | awk -F\: '{print $1}')

I'll see if the result shows up on friendly.ubuntu.com soon.

I think this would be a good fix as it's not too uncommon that your company wireless and VPN have similar names.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch to only look for wireless connection." of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Daniel Wiberg (dannew) wrote : Re: wireless_before_suspend failed

Results are up on friendly.ubuntu.com now, I think it works,

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Hi Daniel,

Yes, thanks for catching the missing TYPE. We'll schedule this fix for an SRU and it will also be included in Precise.

Changed in checkbox (Ubuntu):
status: New → Confirmed
assignee: nobody → Brendan Donegan (brendan-donegan)
milestone: none → oneiric-updates
summary: - wireless_before_suspend failed
+ connect_wireless can unintentionally choose a non-wireless connection to
+ connect to
Changed in checkbox (Ubuntu):
status: Confirmed → In Progress
Changed in checkbox:
status: New → In Progress
assignee: nobody → Brendan Donegan (brendan-donegan)
Changed in checkbox (Ubuntu):
assignee: Brendan Donegan (brendan-donegan) → nobody
Changed in checkbox:
importance: Undecided → Medium
milestone: none → 0.12.9
Changed in checkbox (Ubuntu):
importance: High → Medium
Changed in checkbox:
status: In Progress → Fix Committed
Changed in checkbox (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package checkbox - 0.13

---------------
checkbox (0.13) precise; urgency=low

  New upstream release (LP: #892268):

  [Marc Tardif]
  * Generate a submission.xml file that contains all device and attachment
  * Write the report before reporting the validation error.
  * Changed device.product to dmi.product for the formfactor (LP: #875312)

  [Daniel Manrique]
  * Use gettext for string (LP: #869267)
  * Move progress indicator to main checkbox dialog instead of a
    transient window (LP: #868995)
  * Ignore malformed dpkg entries in package_resource (LP: #794747)
  * Reset window title after finishing a manual test (LP: #874690)
  * Handle "@" in locale names (as in ca@valencia).

  [Jeff Lane]
  * Went through all the job files and:
    * Updated descriptions to match Unity UI structure
    * Added descriptions where necessary
    * Added further details to some descriptions
    * Moved some jobs to more appropriate files
    * Fixed job names in older job files to match new naming scheme
      (suite/testname)
    * Added jobs to local.txt to ensure all job files are now parsed
      (this allows easier addition of existing tests to whitelists)
    * Changed remaining manual job descriptions to match the new format
  * Updated CD and DVD write tests to be more clear about when to skip
    them (LP: #772794)

  [Ara Pulido]
  * Rewrote all job descriptions to match OEM QA syntax

  [Brendan Donegan]
  * Fix the code that assigns keys in checkbox-cli so that it never assigns
    keys which have other uses. (LP: #877467)
  * Show details of unmet job requirements (LP: #855852)
  * Ensure that connect_wireless chooses a wireless connection from the list
    of available connections (LP: #877752)
  * Have the bluetooth/detect tests require a device with the category
    BLUETOOTH to run, thus preventing the test from failing on systems with
    no Bluetooth device (LP: #862322)
  * Rename attachment jobs to not have a forward slash in their name
    (LP: #887964)
  * Guard against trying to write files to logical partitions on USB sticks
    (which will obviously fail) in usb_test (LP: #887049)
  * Make the OpenGL test ignore the return value of glxgears and improve
    the test description (LP: #890725)
  * Allow input/mouse test to run if a TOUCH device is present
    (LP: #886129)

  [ Javier Collado ]
  * Broken job dependencies fixed (LP: #888447)
  * Regex support when specifying blacklists and whitelists on the
    commandline (LP: #588647)
 -- Daniel Manrique <email address hidden> Thu, 18 Nov 2011 12:46:21 -0500

Changed in checkbox (Ubuntu):
status: Fix Committed → Fix Released
Daniel Manrique (roadmr)
Changed in checkbox:
status: Fix Committed → Fix Released
Daniel Manrique (roadmr)
description: updated
Daniel Manrique (roadmr)
description: updated
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Daniel, or anyone else affected,

Accepted checkbox into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in checkbox (Ubuntu Oneiric):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Daniel Manrique (roadmr) wrote :

Hi, I'm Daniel, but not the original reporter :)

Anyway. I took a Dell Inspiron 1545 and connected to a wireless network named Ubuntu. I then renamed the "Wired Connection 1" default ethernet to "Ubuntu". nmcli con list shows two Ubuntu networks. The first one that appears on the list is the Ethernet one.

As per the reproduction case I unplug the Ethernet cable. I'm able to ping some hosts on the wireless network as I'm still connected on that one.

I then run /usr/share/checkbox/scripts/connect_wireless from Checkbox 0.12.8 and I get:

Error: Device 'eth0' (/org/freedesktop/NetworkManager/Devices/1) disconnecting failed: This device is not active
Device state: 30 (disconnected)
Error: Unknown connection: 343b92b1-1049-406c-bfd9-a636b93cacdf 8ddcecca-5513-495f-9525-b611bf620868.

The wireless connection remains disconnected and I can't ping anything.

I then installed Checkbox 0.12.9 from -proposed. I brought up the wireless connection. I then ran the same script and got the same result :( (notice the slight difference in the last line, here it can't even find a connection name)

Error: device 'eth0 (/org/freedesktop/NetworkManager/Devices/1) disconnecting failed: this device is not active
Device state: 30 (disconnected)
Error: Unknown connection: .

I went looking into the code and the problem is that, even though it's now filtering only the wireless connections (line 11 of connect_wireless), it had to add the TYPE field to nmcli output to be able to do so. However, later in the same line, it looks for the network name at the *end* of the line (grep -e '$ap$' where $ap contains the network name). Since the TYPE field was added at the end of the line, the script fails in a slightly different way.

The fix for the fix is to swap TYPE and NAME in line 11 so the field list looks like UUID,TYPE,NAME.

As the SRUed fix is not working as intended, I'll mark verification-failed. Also, the faulty code is also present in checkbox trunk, it will have to be fixed there as well.

Please let me know how to proceed with this bug report.

Thanks!

tags: added: verification-failed
removed: verification-needed
Martin Pitt (pitti)
Changed in checkbox (Ubuntu Oneiric):
status: Fix Committed → Triaged
tags: removed: verification-failed
Revision history for this message
Rolf Leggewie (r0lf) wrote :

oneiric has seen the end of its life and is no longer receiving any updates. Marking the oneiric task for this ticket as "Won't Fix".

Changed in checkbox (Ubuntu Oneiric):
status: Triaged → Won't Fix
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.