New network script
Moritz Heiber
moe at lunar-linux.org
Mon Mar 26 02:34:16 CEST 2007
After cursing for hours over the mess that our network script
represents right now I took the liberty of rewriting it completely.
The new script, located in crater/net/net-tools (also attached), fully
supports ifplugd and wpa_supplicant through the newer lnet .. actually,
dhcp for ifplugd/wpa_supplicant managed devices is only possible
through ifplugd right now (I will explain the details later).
Static routes still work. Even for ifplugd/wpa_supplicant devices.
Static IP setups are untested. I'm going to get to those tomorrow.
NOTICE: The network script starts at runlevel 3, 4 and 5 with priority
_15_ (!). This is a MUST since we need to start it AFTER dbus is
initialized (we need to bump the dbus UPDATED field once we update the
network script in order to push out ITS new init script).
Also, I removed all the profiling code from the script. Seriously, who
ever used that "feature"?
Now for what has to be done:
1) lnet has to be altered in a way that it creates action files for
ifplugd on the fly if the user chooses to use ifplugd/wpa_supplicant
as the manager for his devices. That file simply contains the commands
executed when the device is connected to a wired/wireless network and
when its seperated. Usually these should be starting the dhcp client
and bringing it down again.
Example file ifplugd-eth1.action (ipw2915 wireless device; $1 is the
device; $2 is either up or down; $1/$2 get passed along by ifplugd):
---
#!/bin/bash
if [ "$2" == "up" ] ; then
dhcpcd -N $1;
elif [ "$2" == "down" ] ; then
dhcpcd -k $1;
elif [ -z $1 ] || [ -z $2 ] ; then
return 0;
fi;
exit 0;
---
Of course, dhcpcd should be replaced by $DHCP_CLIENT .. and custom
options need to be passed along. But you get the idea.
This way you can fully utilize wpa_supplicant's roaming functionality.
Of course, static IP setups and even route changes are possible .. lnet
just doesn't not support creating ifplugd action files yet
Notice: The network script is going to work if you have a global ifplugd
running. Its testing whether a daemon is running for a certain
interface already .. and if that is the case its begging down from
starting yet another (failing) daemon.
2) Right now the network script relies on the user to define a
interface node for the wpa_supplicant dbus interface. If you want that
to work out you're going to have to set it up inside
wpa_supplicant.conf. Maybe we should check for that somewhere and tell
the user to do it. Right now, we don't use it anyway.
3) "manual" mode works with WEP networks, static IPs, static routes and
even dhcp clients. Everything you need for wired devices. If you want
"dynamic" configuration you can still choose to use ifplugd alone
(like, say .. for wired devices on laptops) and have ifplugd take care
of the dhcp services or static IP assigning .. once action file
generation is implented with lnet.
Issues to be resolved:
1) Currently, lnet displays default choices for all configuration
items. Unfortunately, those defaults are not automatically preserved if
the user chooses to use them. They are displayed .. but if the user
doesn't at least choose them once the fields are left blank. Very
irritating.
2) More possible combinations should be unlocked.
ifplugd/wpa_supplicant and static IPs springs to my mind. All of that
requires lnet to support ifplugd action script generation.
3) I would really like to move the network script into the lunar-tools
repository to be able to sync it up with changes that are done to lnet.
These two are just too closely connected to reside in two seperate
modules IMHO. Opinions?
Now, tell me what you think. I tested the script against my IPW2915 ..
it works like a charm .. tomorrow its testing ifplugd alone and then my
workstation. Also, it has yet to be tested under boot conditions.
Enjoy!
Moritz
---
GPG public key B189E8C8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: network
Type: application/octet-stream
Size: 7986 bytes
Desc: not available
Url : http://foo-projects.org/pipermail/lunar-dev/attachments/20070326/f45234bb/network.obj
More information about the Lunar-dev
mailing list