Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manet Manager can get into a funky state where it will refuse to setup the manet #17

Open
duhmojo opened this issue Oct 22, 2013 · 3 comments

Comments

@duhmojo
Copy link

duhmojo commented Oct 22, 2013

I've mentioned this before, but ManetManager can get in a funky state sometimes. It's hard to pin down what exactly the reproducible use case is, but it typically happens when you play with the Wifi or power state (the device goes into sleep mode). The symptom is Manet Manager (when you switch back to it) will either have a double Enabled and Disabled icon (both at once on the screen), or just the disabled icon. In either case, when you try to start the manet, it will fail to do so. I'm in that state right now, so I thought I would open this issue to capture my notes.

Here's my logcat output:

10-21 12:10:40.507: D/CoreTask(2748): Root command ==> /data/data/org.span/bin/adhoc start 1
10-21 12:10:40.570: E/su(3331): sudb - Opening database
10-21 12:10:40.578: E/su(3331): sudb - Database opened
10-21 12:10:40.585: E/su(3331): sudb - Database closed
10-21 12:10:40.585: D/su(3331): 10050 org.span.service.core.ManetService executing 0 "/data/data/org.span/tmp/command.sh" using shell /system/bin/sh : sh
10-21 12:10:40.726: D/WifiHW(3334): >>> wifi_load_driver
10-21 12:10:40.726: I/WifiHW(3334): >>> init_rfkill
10-21 12:10:40.726: I/WifiHW(3334):   wlan
10-21 12:10:40.726: I/WifiHW(3334): , rfkill_id: 0
10-21 12:10:40.726: I/WifiHW(3334):   rfkill_state_path_wifi: /sys/class/rfkill/rfkill0/state
10-21 12:10:40.726: I/WifiHW(3334): <<< init_rfkill
10-21 12:10:40.726: D/WifiHW(3334): <<< wifi_load_driver loaded already, wifi power is ON
10-21 12:10:47.078: D/ManetManagerApp(3162): onAdhocStateUpdated()
10-21 12:10:47.078: D/MainActivity(3162): onAdhocStateUpdated()
10-21 12:10:47.078: D/MainActivity(3162): removeDialog()
10-21 12:10:47.093: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:10:47.093: D/ManetManagerApp(2748): onAdhocStateUpdated()
10-21 12:10:47.093: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:10:47.093: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:10:47.101: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:10:59.999: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:10:59.999: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:10:59.999: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:11:00.007: D/ManetServiceHelper(2748): Alarm activated!
10-21 12:11:00.515: I/ManetStarter.PrepareNetwork(3134): Failed to start adhoc mode!

Here's the output from shell where adhoc is run to manually start the manet:

# ./adhoc start 1
./adhoc start 1
about to run: [/data/data/org.span/bin/iptables -t filter -F]
about to run: [/data/data/org.span/bin/iptables -t nat -F]
about to run: [echo 1 > /proc/sys/net/ipv4/ip_forward]
about to run: [/data/data/org.span/bin/iptables -A FORWARD -j ACCEPT]
about to run: [/data/data/org.span/bin/ifconfig eth0 192.168.1.100 netmask 255.255.255.0]
error: SIOCSIFADDR (No such device)
about to run: [/data/data/org.span/bin/iwconfig eth0 mode ad-hoc]
Error for wireless request "Set Mode" (8B06) :
    SET failed on device eth0 ; No such device.
about to run: [/data/data/org.span/bin/iwconfig eth0 essid AndroidAdhoc]
Error for wireless request "Set ESSID" (8B1A) :
    SET failed on device eth0 ; No such device.
about to run: [/data/data/org.span/bin/iwconfig eth0 channel 1]
Error for wireless request "Set Frequency" (8B04) :
    SET failed on device eth0 ; No such device.
about to run: [/data/data/org.span/bin/iwconfig eth0 commit]

Error for wireless request "Commit changes" (8B00) :
    SET failed on device eth0 ; No such device.
script result was []

If I can come up with steps to reproduce this, I'll update this issue.

@duhmojo
Copy link
Author

duhmojo commented Oct 22, 2013

Oh, and jrobble, I noticed that Manet Manager no longer seems to have issue with Wifi being enabled before starting the manet? I'm both scanning for wifi access point and connected to the manet at the same time. If this is true then it solves my issue with starting/stopping ManetManager, which I also have working pretty well now.

@duhmojo
Copy link
Author

duhmojo commented Oct 22, 2013

Actually scratch that last comment. Manet Manager now seems to be ok with flipping wifi in the OS on and off. However if you have a manet established and turn wifi on, that node in the manet will disappear. If you disable/enable the manet again, it will rejoin without any headaches. This is still good information, as I know that if Manet Manager and wifi get in a conflicting state, I can easily recover from it be restarting the manet.

@jrobble
Copy link
Member

jrobble commented Oct 24, 2013

Turning the Wi-Fi on though the Settings app while the device is in ad-hoc mode will mess up the Manet Manager. Doing so will reload the Wi-Fi drivers and cause the Android framework to run wpa_supplicant, which will put the Wi-Fi chip in managed mode (causing it to drop out of ad-hoc mode). Under the hood the olsrd routing protocol will still be running. Thus, the Manet Manager will be in a bad state and show both the enabled and disabled icons.

"SET failed on device eth0 ; No such device." is most likely caused by a problem with loading the Wi-Fi driver.

I tried to implement the Manet Manager so that it will gracefully turn off the Wi-Fi if it's active before starting ad-hoc mode. To be more accurate, Wi-Fi is still active under the hood, but the Android framework doesn't know about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants