Android IBSS mode

974 views
Skip to first unread message

Bruno Randolf

unread,
Mar 13, 2013, 1:32:05 PM3/13/13
to serval-proje...@googlegroups.com, ????
Hello!

As you are working with Ad-Hoc (IBSS) mode as well, we believe you might be interested in our attempt to properly bring Ad-Hoc mode to Android. We have extended the latest Android version to include Ad-Hoc mode, from the public API to the user interface.

We currently provide only a few CyanogenMod based system images, put have uplodaed our changes to AOSP and CyanogenMod gerrit for review and inclusion and hope to build for more devices soon. We hope that this way we can get IBSS properly included in Android in future releases.

You can find more information here:
http://www.thinktube.com/android-tech/46-android-wifi-ibss

If you have any thoughts or feedback, we would be happy to hear from you...

bruno
(Thinktube)

Paul Gardner-Stephen

unread,
Mar 13, 2013, 3:32:28 PM3/13/13
to serval-proje...@googlegroups.com, ????
Hello,

This is great news. Have you also told the guys over at OTI/Commotion
and FreedomBox?
I think that they would both be interested to hear about this if they
don't yet know.

Now we just need to get one of those devices, so that we can try it
out, and integrate support for it into Serval Mesh. In the meantime,
you would be most welcome to push us some patches to add support for
your API changes into Serval Mesh.

On a related note, how hard would it be for you to build an image for
the Samsung Galaxy S2?

Again, this is a fantastic development, and we look forward to seeing
how things progress.

Paul.
> --
> You received this message because you are subscribed to the Google Groups
> "Serval Project Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to serval-project-dev...@googlegroups.com.
> To post to this group, send email to
> serval-proje...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/serval-project-developers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Will Hawkins

unread,
Mar 13, 2013, 4:20:30 PM3/13/13
to serval-proje...@googlegroups.com, ????
Hello Bruno!

This is pretty awesome. We (OTI/Commotion) are very interested in this. I am going to forward this to some of the other developers that we work with. Given the level of detail in this article, it seems like this might be a good thing to show to the Android (AOSP) people who are currently "investigating" official IBSS support.

We will look more deeply into this over the next few days and may post more questions as we find them!

Thanks for the great work!
Will
> email to serval-project-developers+unsub...@googlegroups.com.

Bruno Randolf

unread,
Mar 14, 2013, 6:38:21 AM3/14/13
to serval-proje...@googlegroups.com, ????
Hello Paul!

Nice to hear from you and your thoughts. We actually did not know about Commotion and FreedomBox before but are very interested. I hope we can all join efforts to promote Ad-Hoc mode in Android and finally push it into AOSP.

As for the S2, I believe it has a BCM4330 chip as well (can you confirm?) so it should be easy to support it. It's just a matter of applying our patches to CyanogenMod and applying the one kernel patch to the kernel for S2. Unfortunately I don't have this hardware here so I can not do this work (need to get some proprietary binaries from the device and test the build).

Let's cooperate!

Bruno

Paul Gardner-Stephen

unread,
Mar 14, 2013, 3:13:51 PM3/14/13
to serval-proje...@googlegroups.com
Hello,

On Thu, Mar 14, 2013 at 9:08 PM, Bruno Randolf <randol...@gmail.com> wrote:
> Hello Paul!
>
> Nice to hear from you and your thoughts. We actually did not know about
> Commotion and FreedomBox before but are very interested. I hope we can all
> join efforts to promote Ad-Hoc mode in Android and finally push it into
> AOSP.
>
> As for the S2, I believe it has a BCM4330 chip as well (can you confirm?) so
> it should be easy to support it. It's just a matter of applying our patches
> to CyanogenMod and applying the one kernel patch to the kernel for S2.
> Unfortunately I don't have this hardware here so I can not do this work
> (need to get some proprietary binaries from the device and test the build).
>
> Let's cooperate!

Absolutely!

You are right about the chipset in the S2:
http://forum.xda-developers.com/showthread.php?t=1895265
See also http://bcmon.blogspot.com.au/2013/01/new-firmware-for-bcm4330.html

As for the hardware, where are you based, and we can see if there is
someone nearby who is able to help on that front. Otherwise, we can
look into buying Galaxy S2 phones 2nd hand in good condition for
between AU$200 - AU$250 from a local supplier here.

Paul.

> Bruno
>
>
> On Wednesday, March 13, 2013 7:32:28 PM UTC, Paul Gardner-Stephen wrote:
>>
>> Hello,
>>
>> This is great news. Have you also told the guys over at OTI/Commotion
>> and FreedomBox?
>> I think that they would both be interested to hear about this if they
>> don't yet know.
>>
>> Now we just need to get one of those devices, so that we can try it
>> out, and integrate support for it into Serval Mesh. In the meantime,
>> you would be most welcome to push us some patches to add support for
>> your API changes into Serval Mesh.
>>
>> On a related note, how hard would it be for you to build an image for
>> the Samsung Galaxy S2?
>>
>> Again, this is a fantastic development, and we look forward to seeing
>> how things progress.
>>
>> Paul.
>

®om

unread,
Mar 21, 2013, 9:19:14 AM3/21/13
to serval-proje...@googlegroups.com, ????
Your work is very interesting. I just installed the Galaxy Nexus (maguro) image you provide.

I would like to connect my laptop and my Galaxy Nexus together (for a simple netcat test).

I created an ad-hoc network on the phone, with static ip:
ssid=test
host=192.168.1.1 (gateway=192.168.1.1)
netmask-length=24

$ adb shell netcfg | grep ^wlan0 | cut -c-58
wlan0    UP                                 192.168.1.1/24


On my laptop (debian wheezy):
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid test
iwconfig wlan0 channel x  # tested with all x in {1..11}
ifconfig wlan0 192.168.1.2 netmask 255.255.255.0
ifconfig wlan0 up


# iwconfig wlan0
wlan0     IEEE 802.11abgn  ESSID:"test" 
          Mode:Ad-Hoc  Frequency:2.437 GHz  Cell: 72:F4:7E:81:68:2C  
          Tx-Power=15 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
# ifconfig wlan0 | grep 'inet adr'
          inet adr:192.168.1.2  Bcast:192.168.1.255  Masque:255.255.255.0


On the phone, I can't see the details, iwconfig does not work on Galaxy Nexus. If you know another command (for example /system/bin/ndc parameter) to get these info, I am interested.

After these steps, instead of 1 network with essid "test", I have 2 different networks on the phone:
http://dl.rom1v.com/images/nexus-adhoc

Moreover, the second is "secured by WEP", while I did not enable any encryption on the laptop.

Thus, if I try to contact the phone from the laptop, I have a "no route to host" error:
# nc 192.168.1.1 1234
(UNKNOWN) [192.168.1.1] 1234 (?) : No route to host


Did I do something wrong?

I did the same steps with a Motorola Milestone (which works perfectly with Batphone), except I configured the phone using iwconfig, and I managed to contact it from my laptop.

Thank you for your help.

Bruno Randolf

unread,
Mar 21, 2013, 1:54:19 PM3/21/13
to serval-proje...@googlegroups.com, ®om, ????
Hello �om!

It seems your IBSS fails to merge, that's a common problem with Ad-Hoc
mode and very much dependent on Wifi cards and drivers. In short, IBSS
which have the same name and are on the same channel should agree on the
same BSSID after some (short) time. It seems that this is not the case
for you.

One thing I failed to document well is that Android will create the
Ad-Hoc network on channel 1 (2412 MHz), so you should configure your
laptop on this channel (your iwconfig shows 2437 MHz which is channel
6). After a short time (few seconds) the two devices should see each
other, but that also depends on the driver you use on your laptop.

Then, in order to debug this, the order you configure and bring up the
interfaces might make a difference. Try to create the network on the
Galaxy Nexus first, and then on the Laptop, and the other way round.

Finally, there is no iwconfig on Android, and it's generally considered
deprecated, but "iw" can be used instead. Unfortunately the driver on
Android does not fully implement it, so some functions are missing. You
can download and compile from here:
https://github.com/br101/android_external_iw
I will also include iw in the next version of the images.

Hope that helps and let us know if you manage to get it working...

bruno
> Le mercredi 13 mars 2013 18:32:05 UTC+1, Bruno Randolf a �crit :
>
> Hello!
>
> As you are working with Ad-Hoc (IBSS) mode as well, we believe you
> might be interested in our attempt to properly bring Ad-Hoc mode to
> Android. We have extended the latest Android version to include
> Ad-Hoc mode, from the public API to the user interface.
>
> We currently provide only a few CyanogenMod based system images, put
> have uplodaed our changes to AOSP and CyanogenMod gerrit for review
> and inclusion and hope to build for more devices soon. We hope that
> this way we can get IBSS properly included in Android in future
> releases.
>
> You can find more information here:
> http://www.thinktube.com/android-tech/46-android-wifi-ibss
> <http://www.thinktube.com/android-tech/46-android-wifi-ibss>
>
> If you have any thoughts or feedback, we would be happy to hear from
> you...
>
> bruno
> (Thinktube)
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Serval Project Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/serval-project-developers/JGN00i00nFk/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to

Paul Gardner-Stephen

unread,
Mar 21, 2013, 5:57:43 PM3/21/13
to serval-proje...@googlegroups.com, ®om, ????
Hello,

One trick we have found as well is that many ad-hoc WiFi drivers will
pass broadcast traffic, even if the BSSID don't match, provided the
channel and SSID match. In fact, this is a problem for mesh routing
protocols that think that if broadcast (route announcements) can get
through, then so can data. We intend to write a paper conclusively
showing the behaviour soon.

Paul.
> You received this message because you are subscribed to the Google Groups
> "Serval Project Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Bruno Randolf

unread,
Mar 22, 2013, 4:35:35 AM3/22/13
to serval-proje...@googlegroups.com, Paul Gardner-Stephen, ®om, ????
On 03/21/2013 09:57 PM, Paul Gardner-Stephen wrote:
> One trick we have found as well is that many ad-hoc WiFi drivers will
> pass broadcast traffic, even if the BSSID don't match, provided the
> channel and SSID match.In fact, this is a problem for mesh routing
> protocols that think that if broadcast (route announcements) can get
> through, then so can data. We intend to write a paper conclusively
> showing the behaviour soon.

I would call this a driver bug instead of a trick! Packets from another
BSSID should simply be ignored and discarded. SSID does not get
transmitted with data packets, so it should not play a role here.

Here's the relevant part of the 802.11 standard (2007 pg 78):
"7.2.2 Data frames
...
A STA uses the contents of the Address 1 field to perform address
matching for receive decisions. In cases where the Address 1 field
contains a group address, the BSSID also is validated to ensure that the
broadcast or multicast originated from a STA in the BSS of which the
receiving STA is a member."

Address 1 is the destination address. If it is a broadcast address
("group address") the BSSID should be checked to be the same.

bruno
>>> Le mercredi 13 mars 2013 18:32:05 UTC+1, Bruno Randolf a �crit :

®om

unread,
Mar 25, 2013, 12:13:25 PM3/25/13
to serval-proje...@googlegroups.com, ®om, ????
> It seems your IBSS fails to merge, that's a common problem with Ad-Hoc
> mode and very much dependent on Wifi cards and drivers. In short, IBSS
> which have the same name and are on the same channel should agree on
> the same BSSID after some (short) time. It seems that this is not the
> case for you.

I tested again with channel 1, and it worked ;-)


> Finally, there is no iwconfig on Android, and it's generally
> considered deprecated, but "iw" can be used instead.

Thank you, with "iw", it works!

I downloaded "iw" ARM binary from here:
http://www.onlyxool.net/porting-iw-tools-to-android/

Serval still uses "iwconfig", and "iw" does not work with some devices,
for example my Motorola Milestone:
# iw dev tiwlan0 info
nl80211 not found.

I added the missing glue to Serval for detecting and driving Galaxy
Nexus chipset using "iw":
https://github.com/rom1v/batphone/commits/gnexus

This includes:
 - the "iw" binary;
 - the detection and edify scripts for Galaxy Nexus (using "iw");
 - a new variable in adhoc.conf for the frequency ("iw" expects
   a frequency, not a channel);
 - a new check for detecting the network interface state for chipsets
   with flag "nowirelessextensions" (it tries with "iw" before fallback
   detection).

I also needed to change the target (in project.properties) from
android-8 to android-10, but I kept minSDKVersion and targetSDKVersion
to 8 (in AndroidManifest.xml), so it will still work on phones from
android-8, and calls to elements not available in android-8 need the
@TargetApi annotation. Indeed, I needed *NetworkInterface.isUp()* method
available from android-9 (but android-9 does not exist anymore), because
"iw" gives a network type even if the interface is down, so we must
check (only if Build.VERSION is at least 9) if it is up. If it is a
problem, we can call "ifconfig" and parse the result instead.

With these changes, Galaxy Nexus works perfectly with Batphone. Thank
you for your implementation of ad-hoc mode for this device.

Note to serval developers:
If you agree to merge my changes in, you should recompile the "iw"
binary: we have no reason to blindly trust onlyxool (the blog from where
I downloaded "iw"), and you have no reason to trust me (or anyone else)
including such a binary blob into Serval.

®om
> Le mercredi 13 mars 2013 18:32:05 UTC+1, Bruno Randolf a �crit :
>
>     Hello!
>
>     As you are working with Ad-Hoc (IBSS) mode as well, we believe you
>     might be interested in our attempt to properly bring Ad-Hoc mode to
>     Android. We have extended the latest Android version to include
>     Ad-Hoc mode, from the public API to the user interface.
>
>     We currently provide only a few CyanogenMod based system images, put
>     have uplodaed our changes to AOSP and CyanogenMod gerrit for review
>     and inclusion and hope to build for more devices soon. We hope that
>     this way we can get IBSS properly included in Android in future
>     releases.
>
>     You can find more information here:
>     http://www.thinktube.com/android-tech/46-android-wifi-ibss
>     <http://www.thinktube.com/android-tech/46-android-wifi-ibss>
>
>     If you have any thoughts or feedback, we would be happy to hear from
>     you...
>
>     bruno
>     (Thinktube)
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Serval Project Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/serval-project-developers/JGN00i00nFk/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> serval-project-developers+unsub...@googlegroups.com.

Bruno Randolf

unread,
Mar 25, 2013, 1:32:23 PM3/25/13
to serval-proje...@googlegroups.com, ®om, ????
On 03/25/2013 05:13 PM, �om wrote:
> I tested again with channel 1, and it worked ;-)

Good to hear!

I just wanted to let you know that the next version will include
frequency selection from the Settings UI. The patch is nearly finished.
If you use "iw" directly you don't need that, but we are still aiming at
full integration.

And another good news is that my changes got merged into CyanogenMod
yesterday - so all the framework stuff is already part of the nightly
builds. Now you only need to patch and recompile the kernel to get IBSS
mode. One device already got the IBSS patch included: it's the "aries"
series: Samsung Galaxy S, Samsung Captivate, Samsung Vibrant and Samsung
Fascinate. Other devices could easily follow, it's just a matter of the
device kernel maintainers to pick up the patch.

bruno

®om

unread,
Mar 25, 2013, 2:09:56 PM3/25/13
to serval-proje...@googlegroups.com, ®om, ????
Great !

®om

unread,
May 16, 2013, 7:53:46 AM5/16/13
to serval-proje...@googlegroups.com, ????

Wayne Abroue

unread,
May 16, 2013, 8:22:53 AM5/16/13
to serval-proje...@googlegroups.com
This is brilliant news, the only thing stopping us from connecting to our ad-hoc mesh @http://villagetelco.org/mesh-potato/ is the ability to connect to a specific bssid.

Wayne A



--
You received this message because you are subscribed to the Google Groups "Serval Project Developers" group.

To unsubscribe from this group and stop receiving emails from it, send an email to serval-project-dev...@googlegroups.com.

Bruno Randolf

unread,
May 16, 2013, 8:27:01 AM5/16/13
to serval-proje...@googlegroups.com
On 05/16/2013 01:22 PM, Wayne Abroue wrote:
> This is brilliant news, the only thing stopping us from connecting to
> our ad-hoc mesh @http://villagetelco.org/mesh-potato/ is the ability to
> connect to a specific bssid.

I assume that wpa_supplicant supports this, right? Can you confirm?
If this is the case it's easy to add the necessary field to the UI.
Actually there are many config options for IBSS which I have left out...

bruno

> Wayne A
>
>
> On Thu, May 16, 2013 at 1:53 PM, �om <romain...@gmail.com
> <mailto:romain...@gmail.com>> wrote:
>
> I tested on a Nexus 7, it works, after adding a tiny detect script :
> https://github.com/rom1v/batphone/commit/f192ec306f5ad5f291a6049917fe41ec9020ca61
> https://github.com/rom1v/batphone/commits/gnexus
>
> --
> You received this message because you are subscribed to the Google
> Groups "Serval Project Developers" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to
> serval-project-dev...@googlegroups.com
> <mailto:serval-project-developers%2Bunsu...@googlegroups.com>.
> To post to this group, send email to
> serval-proje...@googlegroups.com
> <mailto:serval-proje...@googlegroups.com>.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Serval Project Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/serval-project-developers/JGN00i00nFk/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to

Wayne Abroue

unread,
May 16, 2013, 8:31:06 AM5/16/13
to serval-proje...@googlegroups.com
Hi Bruno

I haven't tested in a while but the last time I did, I could connect to the adhoc only sometimes as has been suggested. 

I couldn't get it to connect to specific bssid's

Wayne A



On Thu, May 16, 2013 at 2:27 PM, Bruno Randolf <randol...@gmail.com> wrote:
On 05/16/2013 01:22 PM, Wayne Abroue wrote:
This is brilliant news, the only thing stopping us from connecting to
our ad-hoc mesh @http://villagetelco.org/mesh-potato/ is the ability to
connect to a specific bssid.

I assume that wpa_supplicant supports this, right? Can you confirm?
If this is the case it's easy to add the necessary field to the UI. Actually there are many config options for IBSS which I have left out...

bruno

Wayne A



On Thu, May 16, 2013 at 1:53 PM, 峨m <romain...@gmail.com
<mailto:romain.vimont@gmail.com>> wrote:

    I tested on a Nexus 7, it works, after adding a tiny detect script :
    https://github.com/rom1v/batphone/commit/f192ec306f5ad5f291a6049917fe41ec9020ca61
    https://github.com/rom1v/batphone/commits/gnexus

    --
    You received this message because you are subscribed to the Google
    Groups "Serval Project Developers" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to

    To post to this group, send email to
--
You received this message because you are subscribed to a topic in the

Google Groups "Serval Project Developers" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/serval-project-developers/JGN00i00nFk/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to

To post to this group, send email to

--
You received this message because you are subscribed to the Google Groups "Serval Project Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to serval-project-developers+unsub...@googlegroups.com.
To post to this group, send email to serval-project-developers@googlegroups.com.

®om

unread,
Jun 4, 2013, 9:54:32 AM6/4/13
to serval-proje...@googlegroups.com
I have a problem with your IBSS ROM on Galaxy Nexus.

First, I connect to an access point so that Android will autoconnect to it each time I enable Wifi. I disable Wifi.

Then, I configure manually the wifi interface as ad-hoc:

ifconfig wlan0 up
ifconfig wlan0 28.1.1.1 netmask 254.0.0.0
iw dev wlan0 set type ibss
iw dev wlan0 ibss join test 2437


Then, "netcfg" gives, as expected:

$ netcfg | grep ^wlan0
wlan0    UP                                    28.1.1.1/7   0x00001043 20:64:32:d3:74:61


Now, I enable Wifi in Android preferences. It autoconnect to my preconfigured AP, it says "connected", but it keeps the (wrong) IP address.

$ netcfg | grep ^wlan0
wlan0    UP                                    28.1.1.1/7   0x00001043 20:64:32:d3:74:61


So I have a problem with Serval when switching from ad-hoc to client mode.

However, if I manually execute:

ifconfig wlan0 down
ifconfig wlan0 up


(or change the AP in Android preferences)

Then it works:

$ netcfg | grep ^wlan0
wlan0    UP                               192.168.43.37/24  0x00001043 20:64:32:d3:74:61


Is it the expected behaviour?

Jeremy Lakeman

unread,
Jun 27, 2013, 1:23:24 AM6/27/13
to serval-proje...@googlegroups.com, ®om
I've got iwconfig, ifconfig & iw compiling as part of our build process, and I've started working on generic support for devices with nl80211 but no wireless extensions in a new branch "iw-detection".

Hopefully the devices you were using should just work. But I don't have any rooted & patched devices suitable for testing ATM.

In principle it should be possible to support any device with IBSS compiled into the kernel without requiring a custom detect script.

If the wifi driver is a loadable module, then things are slightly more complicated. But we have had some success with automatically detecting these cases previously, so what I've thrown together has a reasonable chance of working.

While we're trying to nail down our next release version, this might be able to slip in if we can get enough testing done on different devices.



--
You received this message because you are subscribed to the Google Groups "Serval Project Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to serval-project-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages