全部博文(1159)
分类: Android平台
2015-11-13 08:16:44
As part of the , there is being developed to make it easy to install and run OLSR mesh networking
on Android devices. You can follow the automated builds here:
Or you can download the successful builds here:
In order to build olsrd and the plugins for Android, you will need to download the free (as in beer, and mostly as in speech) Android NDK (the pud plugin requires NDK r8, everything else you can build with r6 or maybe earlier). Once you have that installed, run this in your terminal:
make OS=android NDK_BASE=/path/to/your/android-ndk-r8 build_all
Then you can find olsrd in the root, and the plugin files in lib/*/*.so*
In order to run OLSR mesh networking, you need to first have IP connectivity between first-hop nodes. Using olsrd, that is done using ad-hoc wifi networking to associate the nodes into a single network, then using a common IP range and netmask between all the nodes. So usually by default, each node will use the same IP range with large netmask like 255.255.0.0 (/16) or 255.255.255.0 (/24). Then once the nodes talk to each other, they can get the specific routes to each node, overriding the large netmask.
That means that the first thing that needs to happen is getting ad-hoc mode setup. Android officially does not support Ad-hoc mode, so we have to resort to command line hacking. This is unfortunately different between different devices and ROMS.
The german page describes quite nicely how to get ad-hoc mode running on the Samsung Galaxy.
For the non-german speakers here is a summary:
The trick is to use the wpa-supplication settings file to force the
driver to go to ad-hoc mode. By the default the tiwlan cmd line utility
does not understand ad-hoc mode.
su -c "/system/bin/wpa_cli -p /data/misc/wifi/" wpa_cli v0.5.10 Copyright (c) 2004-2008, Jouni Malinen and contributors This program is free software. You can distribute it and/or modify it under the terms of the GNU General Public License version 2. Alternatively, this software may be distributed under the terms of the BSD license. See README and COPYING for more details. Selected interface 'eth0' Interactive mode > <2>CTRL-EVENT-SCAN-RESULTS Ready scan_results bssid / frequency / signal level / flags / ssid 00:16:38:e6:38:31 2412 -49 [WPA2-PSK-TKIP+CCMP] Sven-Ola 00:16:38:e6:38:31 2412 -50 [WPA2-PSK-TKIP+CCMP] Sven-Ola 02:ca:ff:ee:ba:be 2457 -40 [IBSS] olsr.freifunk.net > <2>CTRL-EVENT-SCAN-RESULTS Ready add_network 2 > <2>CTRL-EVENT-SCAN-RESULTS Ready set_network 2 mode 1 OK > set_network 2 ssid "olsr.freifunk.net" OK > set_network 2 bssid 02:ca:ff:ee:ba:be OK > set_network 2 frequency 2457 OK > set_network 2 key_mgmt NONE OK > enable_network 2 OK > ap_scan 2 <2>CTRL-EVENT-SCAN-RESULTS Ready OK > select_network 2 OK <2>CTRL-EVENT-STATE-CHANGE id=1 state=0 > <2>CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys <2>CTRL-EVENT-STATE-CHANGE id=-1 state=0 <2>CTRL-EVENT-STATE-CHANGE id=-1 state=2 <2>Trying to associate with SSID 'olsr.freifunk.net' <2>CTRL-EVENT-STATE-CHANGE id=-1 state=3 <2>CTRL-EVENT-STATE-CHANGE id=2 state=4 <2>Associated with 02:ca:ff:ee:ba:be <2>CTRL-EVENT-STATE-CHANGE id=2 state=7 <2>CTRL-EVENT-CONNECTED - Connection to 02:ca:ff:ee:ba:be completed (reauth) [id=2 id_str=] <2>CTRL-EVENT-SCAN-RESULTS Ready <2>CTRL-EVENT-STATE-CHANGE id=2 state=8 <2>CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys <2>CTRL-EVENT-STATE-CHANGE id=-1 state=8 <2>CTRL-EVENT-STATE-CHANGE id=-1 state=2 <2>CTRL-EVENT-SCAN-RESULTS Ready <2>CTRL-EVENT-SCAN-RESULTS Ready
For the Samsung Galaxy you can use the following file: version of olsrd.
You might have to edit the data/local/etc/olsrd.conf file to suite your needs.
From the Terminal or adb shell: olsrd -f /data/local/etc/olsrd.conf -d 1. You should see some routes in your kernel routing table if you are connected to an ad-hoc network which has other olsr nodes.
Credits: thanks to Sven-Ola Tücke for finding all this out!