-
Notifications
You must be signed in to change notification settings - Fork 80
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
Circumvent WiFi broadcast filters #24
Comments
There may be a much better way: acquire a multicast lock from Android. This should allow either multicast, and possibly also broadcast packet reception. See, for example: http://answers.unity3d.com/questions/250732/android-build-is-not-receiving-udp-broadcasts.html |
Apparently it might only work for Android 2.3.7+ devices: Looking into it more. If this proves a possible fix, then the solution goes into batphone, not serval-dna. |
More useful information here: http://code.google.com/p/boxeeremote/wiki/AndroidUDP It seems that a multicast lock may not work on some devices, but it does work on many, and allows broadcast reception in the process. On those devices where the multicast lock doesn't work, it won't facilitate multicast or broadcast. |
No. We're not going to do that. We certainly don't want to send n^2 unicast packets every second, for neighbours who can hear broadcast packets. Setting up a unicast link should be the last resort, when we have eliminated other options. Instead we're going to extend the set of routing states. The current set of routing states are; We need an explicit state between NONE and UNICAST anyway when we deal with 2-way NAT traversal. We need to acknowledge receipt of a unicast packet before we attempt to route other payloads across that link. And BROADCAST needs to revert to NONE if it doesn't end up working. I'm going to replace BROADCAST with BROADCAST_DISCOVERY and UNICAST_DISCOVERY. When you receive a packet, and the current state of the sender is NONE;
In UNICAST_DISCOVERY mode, set an alarm that queues an outgoing probe payload that should only be sent via unicast. No other payload types should be sent via unicast though we may send payloads via a directory service node. When we receive a probe payload, respond with an acknowledgement. When we receive the acknowledgement, transition to UNICAST. When we send a packet to a node in either DISCOVERY state, decrement a counter. After sending 3- 5 packets, or after a timeout, transition to the next state; BROADCAST_DISCOVERY -> UNICAST_DISCOVERY -> NONE. If we do transition back to NONE, we should reuse the timeout to prevent entering DISCOVERY again. In future we may setup an index from IPv4 address to subscriber, so we can read the ARP table and start trying to discover peers that we didn't know about. But we need to be very careful not to spam the network. |
Official Android multicast lock doco: http://developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock.html |
Many phones set their WiFi drivers to deliberately drop incoming broadcast packets (eg, while the screen is off due to inactivity, the phone does not want broadcast traffic to keep waking it up), so we can't do peer discovery, or announce rhizome advertisements.
One solution is to periodically poke the addresses in our ARP table so that they can add us to their peer list. They will do the same for us, and so it should all work.
The text was updated successfully, but these errors were encountered: