net.interface_up and unimplemented net.80203 properties (linux)

Brian J. Tarricone bjt23 at cornell.edu
Sun Mar 11 00:22:41 PST 2007


Hi all,

Lately I've been working on a wireless networking configuration GUI
app, and I've been looking into using HAL for some aspects of it.
Unfortunately, I found that the net.interface_up parameter is always
'false', regardless of the interface state.  Also, I saw that
net.80203.link and net.80203.rate are listed as unimplemented in the HAL
spec.

I decided to implement an 'addon' for HAL to make these three work
(using the Linux rtnetlink socket for notification of state changes),
as well as adding dbus methods to bring an interface up and down.

Is this the correct approach?  You can see what I'm working on here:
http://kelnos.spuriousinterrupt.org/svn/brian/airconfig/trunk/hald-addon-net/
(Unfortunately it's not buildable outside my app at present.)  If this
looks like the way to go, I'll work on a patch to get this into HAL
proper (assuming people think it would be useful).

The method names I came up with are
org.freedesktop.Hal.Device.NetworkInterface.UpInterface
and .DownInterface, though they can of course be changed easily if
there's some convention I should be following.

There are a few potential problems that I haven't yet addressed:

* The Linux SIOCETHTOOL ioctl requires root privileges, so
  hald-addon-net cannot drop privileges like most of the other addons
  do.
* The rtnetlink message when the link state changes is a little weird.
  My code works on my laptop, but I'm not 100% sure it's the Right
  Way[tm] to do it.
* I only check and update the link rate (net.80203.rate) when the link
  state changes.  This is probably correct, but I'm not sure if it's
  possible/normal for the link rate to change without the link state
  changing as well.  If it is, I'm not sure how to detect it (or
  simulate it so I can figure out how to detect it).

Comments?  Suggestions?  Any other methods or properties the
network-related functionality should support that I could add?

Thanks,
Brian


More information about the hal mailing list