On Wed, 2007-05-02 at 14:48 +0300, Kalle Valo wrote:
> > It would take modifications to the kernel - ideally some sort of DBUS
> > message when a packet needs to be routed - but this would remove the
> > need to hook into applications, and allow ANY app to generate a request
> > for connection.
> 
> Sounds a bit complicated to do this in kernel. How would the
> application notify that it doesn't need the connection anymore?
> 
You don't do it ALL in the kernel, hence my statement about DBUS. All
the kernel needs to do is provide DBUS messages for:
 Outbound packet detected with interface down
 More than $TIME has elapsed without an outbound packet.

You could probably plug into iptables for this - just have an iptables
plugin for generating a DBUS message on a matching packet. This has the
advantage of being a nice general tool, which can be used for other
things (e.g. notification of the firewall blocking a packet) as well.

You then have an application watching for that event, and bringing up
the connection dialog when needed. Once the connection is established,
the application then:
Signals the kernel to retry the packet
Disables the iptables rule if needed.
Watches the packet count on the interface to determine activity. When
the packet count does not increase for some period of time, re-instate
the iptables rule and down the interface.

Of course, if the user forces the interface up directly, then all that
becomes moot - you leave the interface up until it fails, or until the
user tells you otherwise.

> Sounds a bit complicated to do this in kernel. How would the
> application notify that it doesn't need the connection anymore?

The whole problem here is that the application *cannot* make the
decision about whether the connection is needed, as it simply does not
have the information needed. The application may know it wants to talk
to a server, but the application may not know if that server is local to
the device or remote, and requiring a connection - the browser being a
perfect example of this. The browser would have to evaluate every host's
address to determine routability - but that in and of itself may or may
not require bringing up the interface to do a DNS query, and there is no
way for the browser to know that until it does the query.

And how can the application decide it does not need the connection?
Again, to pick on the poor browser - how does the browser know that it
is done loading the page? What if there is a META refresh on the page?
What if there is AJAX running? All the application can say is that *at
this moment* it doesn't need a connection.



_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to