Can't connect to ad-hoc wifi networks

Bug #1077704 reported by Steve Payne on 2012-11-11
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
ubuntu-nexus7
Medium
Unassigned

Bug Description

[ Currently only verified against an ad-hoc network with WEP 128 security, sourced from my phone ]

Observed behaviour:
  1. Click on the wifi applet icon to attempt to find $MYNETWORK
  2. Don't see it so choose "Connect to hidden wifi network"
  3. Enter credentials etc,wait
  4. Wifi icon pauses for a bit, then the password prompt re-appears
  5. Goto 3

Expected behaviour:
  1. Ad-hoc network should appear in the wifi networks list
  2. Entering the correct credentials should allow you to connect

I verified the expected behaviour on a Dell Latitude E6400 running:
  Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-32-generic x86_64)

I also observed these errors in the .xsession-errors file:

==
(nm-applet:7586): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** (nm-applet:7586): WARNING **: (nm-access-point.c:354):nm_access_point_connection_valid: runtime check failed: (ap_freq > 0)
** Message: No keyring secrets found for [$MYNETWORK] 2/802-11-wireless-security; asking user.
(nm-applet:7586): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
[Repeats]
==

FWIW I know that Android _explicitly_ doesn't support connecting to ad-hoc networks so it's possible that this is a deeper limitation related to the Nexus 7 device.

Chris Wayne (cwayne18) wrote :

Assigning to me to try once I can setup an ad-hoc network.

Thanks for helping out!

Changed in ubuntu-nexus7:
assignee: nobody → Chris Wayne (cwayne18)
Chris Wayne (cwayne18) wrote :

I can confirm this bug.

Changed in ubuntu-nexus7:
assignee: Chris Wayne (cwayne18) → nobody
status: New → Confirmed
Chris Wayne (cwayne18) on 2012-11-13
Changed in ubuntu-nexus7:
importance: Undecided → Medium
Matt Fischer (mfisch) on 2012-11-13
tags: added: mobile needs-upstream nexus7
Chris Wayne (cwayne18) on 2012-11-13
tags: removed: mobile nexus7
Sean Feole (sfeole) wrote :

Tried to reproduce this bug on stock Quantal and Precise for X86, Both versions were able to connect to my ad-hoc network and browse the web.

I also tried connecting another android (CM9) device to the ad-hoc network and was able to successfully browse the web.

So it appears that this many not be an issue with network manager, network manager is in fact behaving as expected. Most likely this is a bug with the nexus 7 itself.

Removing the upstream tag

tags: added: mobile nexus7
removed: needs-upstream

Well, I think this will be why:

==
ubuntu@dexter:~$ sudo iwconfig wlan0 mode Ad-Hoc
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Operation not supported.
ubuntu@dexter:~$ sudo strace iwconfig wlan0 mode Ad-Hoc 2>&1 | tail
mprotect(0x40023000, 4096, PROT_READ) = 0
munmap(0x400a8000, 92786) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCSIWMODE, 0xbec98bc4) = -1 EOPNOTSUPP (Operation not supported)
write(2, "Error for wireless request \"Set "..., 47Error for wireless request "Set Mode" (8B06) :
) = 47
write(2, " SET failed on device wlan0 ;"..., 58 SET failed on device wlan0 ; Operation not supported.
) = 58
close(3) = 0
exit_group(-6) = ?
ubuntu@dexter:~$
==

Now just have to figure out where that error is coming from. It's likely somewhere in /drivers/net/wireless/bcmdhd I guess, since we're using the stock kernel.

Just a quick update on this. First, I did a bit of digging and as far as I can tell the hardware should support connecting to ad-hoc networks (this was gleaned from peering at the chips in an hardware teardown of the devices and then reading up on the chip-set specs).

I then spent an evening trying to walk through the kernel source; attempting to follow the call tree to uncover where the EOPNOTSUPP was coming from. I, alas, ended up going around in circles so I might need to revisit this. (I did try putting in some debugging messages but didn't see anything when I flashed the new kernel to the device; so I either failed to add them as I thought or failed to correctly flash in the hacked kernel.)

Bottom line: I think that it should be possible to fix the kernel source to handle this but I haven't yet figured out quite how. I suck. Oh well...

Marco Pratesi (marco-pratesi) wrote :

Does Ubuntu for Nexus 7 use the same kernel used by Android for Nexus 7?
If the answer is yes, the problem could be solved through the same kernel
patches applied for the SPAN project:
https://github.com/monk-dot/SPAN/blob/master/kernels/ASUS%20Nexus%207/myupdate-nexus7.zip
The zip just provides a different kernel, and does not patches anything else
(in particular, if leaves wpa_supplicant unchanged).
Tested on Android, and it works; this also means that the problem is not due
to the wireless card chipset: it is capable of working in adhoc mode.
Sources are not provided on the same repository, but a student of mine
contacted the author of the abovementioned myupdate-nexus7.zip
and he replied providing needed informations for downloading sources
and making (few) needed changes, now we are studying his reply.

> Does Ubuntu for Nexus 7 use the same kernel used by Android for Nexus 7?
>
The answer is yes. Thanks for tracking these changes down.

srp

Marco Pratesi (marco-pratesi) wrote :

The author of myupdate-nexus7.zip has described changes here:
https://groups.google.com/forum/#!searchin/spandev/DPKT_FILTER_SUPPORT/spandev/q_K7ELMTnjg/eR87HluhSpYJ
Now I've issued the command
apt-get source linux-image-3.1.10-8-nexus7
and I am manually changing the code.
I'm used to Linux on PCs and laptops/netbooks... I do not know
how to handle kernel replacement on Linux for a tablet such as
the nexus 7, hence I am a bit afraid, I fear to mess everything...
... I would greatly appreciate whatever suggestion/help.

Marco Pratesi (marco-pratesi) wrote :

I applied changes described in the abovementioned post
(https://groups.google.com/forum/#!searchin/spandev/DPKT_FILTER_SUPPORT/spandev/q_K7ELMTnjg/eR87HluhSpYJ)
and now it works for me: I successfully established an adhoc network
between the Nexus 7 running Ubuntu 13.04 (with all updates applied)
and an x86 netbook running Ubuntu 12.04 (with all updates applied).
I'm attaching the patch providing changes to the kernel sources.
I'm going to perform other tests now.

@ Marco Pratesi: thank you a lot for the patch you provided.

I successfully applied it (following these instructions: https://wiki.ubuntu.com/Nexus7/Kernel#Building_the_kernel) and now Ubuntu smoothly connects to ad-hoc networks.

Is this patch going to be included in the mainstream kernel in the foreseeable future?

Andréas Gustafsson (gurgalof) wrote :

I have tried this patch, and it seems to work well.
I have even tried it in a batman-adv mesh network without problems.

tags: added: nexus7-kernel
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers