blino's website

Free software developer and more

The s2u bus is already used to notify hostname modifications, with /etc/sysconfig/network-scripts/hostname.d/s2u.

It could be extended to handle more network events:

  • link up (link beat for wired, network association for wireless)
  • link down
  • DHCP request start
  • DHCP request failure
  • DHCP request success
  • ZCIP request start
  • ZCIP request success
  • ZCIP request failure

This could be done by adding a minimal number of hooks in the /etc/ifplugd/ifplugd.action and /etc/sysconfig/network-scripts/ifup-eth, by calling a s2u-notify wrapper around dbus-send:

#!/bin/sh
# usage "s2u-notify <com.mandriva.user member> <string argument>
if [ -z "$1" ] || [ -z "$2" ]; then
  exit
fi
dbus-send --system --type=signal /com/mandriva/user com.mandriva.user.$1 string:$2

Events would then ben sent using such a sequence:

[ -x /usr/sbin/s2u-notify] && s2u-notify hostname foo
[ -x /usr/sbin/s2u-notify] && s2u-notify link_up eth0
[ -x /usr/sbin/s2u-notify] && s2u-notify dhcp_start eth0
[ -x /usr/sbin/s2u-notify] && s2u-notify dhcp_failure eth0
[ -x /usr/sbin/s2u-notify] && s2u-notify zcip_start eth0
[ -x /usr/sbin/s2u-notify] && s2u-notify zcip_success eth0

This can be monitored using:

dbus-monitor --system interface=com.mandriva.user

This solution is really easy to implement in system scripts, and it doesn't require much in user applications such as net_applet and drakroam, they just have to listen for events on the com.mandriva.user interface.

Goofs

The "message" member of "com.mandriva.user" is only used for hostname, it could be renamed as "hostname" (and have the new hostname as arg), or maybe use a different object path.



Comments are closed for this story.

Trackbacks are closed for this story.

blosxom Optimised for standards.
Olivier Blin (2005)