Broken netlink socket usage

Dan Williams dcbw at
Fri Jun 11 10:31:36 PDT 2004


Hal currently uses netlink sockets in a broken manner in hal/hald/linux/
net_class_device.c.  The problems:

1) Hal tries to open a new netlink socket each time a network device is
added to the list.  This is unnecessary, there only needs to be _one_
netlink socket open ever.  In any case, all additional attempts to open
the socket currently fail anyway, since the "address is already in use"
due to the bind() call on the socket.

2) Even when Hal receives netlink events from the kernel, it doesn't do
the right thing with them.  All device change notifications are sent
through the _one_ netlink socket, and hal even grabs that interface
name, but doesn't do anything with it.  The result is that any link
status change events trigger Hal to set the link status for only the
first device that it saw.  There is no guaruntee that in
link_detection_handle_message() that the ifname grabbed from the netlink
message is the same as the HalDevice that's in the function's user_data.
If you have two ethernet cards, even if an event is received that
notifies of a link status change on eth1, hal will set eth0's link
status instead.

The attached patch should fix both these problems.  Comments on it?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal.netlink.patch
Type: text/x-patch
Size: 3754 bytes
Desc: not available
Url :
-------------- next part --------------
hal mailing list
hal at

More information about the Hal mailing list