Handling multiple connections

Andreas Kostyrka andreas at kostyrka.org
Sat Apr 28 20:48:26 CEST 2007


Hi!

Just wondering, how do we currently plan to handle multiple data
connections. I've got the impression that this hasn't been given much
of a thought.

These are clearly needed, usecases:

a) multiple APNs: Internet, MMS, other apps (guess we won't get a
   blackberry client that fast, but still it might happen)

b) VPNs.

c) CSD dialup connections.

The important property here is, that openmoko needs to understand
first of all that there are different destinations: e.g. Internet, MMS
service, private networks (via CSD, via VPN).

The second thing here is, the framework needs to offer at least an
opportunity for the user to decide how to handle every connection
manually, or potentially allow it to remember policy (and that one
should probably be save-able/restore-able and/or linked to a given SIM).

The point is, I've got basically flatfees for Internet access in
Austria/Germany. Ok. Other people pay fabulous amounts per MB.
I don't much care what apps on the Neo access the Internet, and how
much. For the poor soul paying $20 or more per MB, every byte transported
counts. So one policy (e.g. everything goes over GPRS by default)
doesn't fit all users.

Furthermore we have a need also to allow situations like:
*) my chat app goes over GPRS to keep a long running TCP connections
going.
*) my web browser prefers strongly BT/Wifi.

Now the hard part, the implementation:

We should intercept connect() and show a dialog, probably defaulting
to "Internet" destinations.

We should provide an openmoke_connect_tcp_socket(...) function in the
API, where the app can finetune which connection properties it needs.
(It might even go so far: "I need a long running connection", "I need
a connection with maximum bandwidth", ...)

This can be implemented by patching the upstream libc, or by making
all apps override connect and using the ELF functions to find the
connect in the libc. Alternativly, one could provide that
functionality in a LD_PRELOAD library.

The technical implementation can be easy/hard:

a) assume all connections have different IP addresses. Than the
openmoko_connect_tcp_socket/connect functions can just bind the TCP
socket to the correct IP address.

b) allow connections to share the same IP address. Harder but doable.
Basically one implementation would be using iptables to mark specific
ports belong to a given connection, and after that you could use
source based routing on these marks.

Ok, so what do you think? Did I miss something, or is it already
handled somehow in Openmoko?

Andreas



More information about the openmoko-devel mailing list