conjunction with re-writing rc.network, to make it more flexible and
be able to support both different HW (when running off USB drive) and
different locations (for laptops).
The only thing left is to test it...
(Note that you might want to use a special pup_save for it, or at least
backup the files that are overwritten: /etc/rc.d/rc.network,
/usr/sbin/net-setup.sh, /usr/sbin/wag-profiles.sh and
/usr/sbin/ndiswrappergui.sh )
Here's how it now works (you don't need to know this to use the wizard...):
Interface configuration
Interfaces have configuration files named after the HW address of the
network adapter, as seen in the output of ifconfig (eg. 00:10:60:BD:4A:D7).
This way we are not dependent on the interface name, which would most
likely be the same (eth0, wlan0) on different machines. (if the HWaddres
isn't unique enough, I can easily add the module name or something...)
- When every interface is configured, a config file is created:
/etc/network/interfaces/$HWADDRESS.conf
This file might be empty, or include some info, such as the details of
a static ip address (in case it was configured that way).
- In case of a wireless interface, another config file will be created:
/etc/wireless/interfaces/$HWADDRESS.conf
This file might include information like whether to use wlanctl-ng
instead of iwconfig/wpa_supplicant (in case of devices using the prism2
drivers), or which wpa_supplicant driver to use.
Both of these files are used as markers, to let us know that the interface
has actually been "configured" by the user -- so we don't try and use an
interface that the user doesn't want us to.
Network configuration
Unlike previously, the different "profiles" you save when configuring
wireless networks are not saved in the same file.
Now a directory (/etc/wireless/profiles) is used, with each profile having
its own config file, named after the MAC address and the type of encryption
used. For example:
/etc/wireless/profiles/00:1B:9E:6F:61:F6.WPA.conf
In case of WPA/WPA2, an appropriate wpa_supplicant.conf file is created
in /etc/wireless/wpa_profiles. Example:
/etc/wireless/wpa_profiles/00:1B:9E:6F:61:F6.WPA.conf
This way, at bootup, a wireless scan is performed and each detected network
is checked, to see if there is a profile matching it (and its encryption
mode!)
Note: this should mean that you can have profiles for your home router
in different modes, without them interfering with each other.
Now, if none of the detected networks matches an existing profile (or if
some do, but fail to connect), then an attempt will be made to connect
to each of the detected open networks, so theoretically you should be able
to just go somewhere and boot and it will connect you to something...
I have also added the option of giving priority to certain networks (i.e.
your home network) over the rest, but that isn't incorporated into the
guy yet...
What you need to do is add to the wireless config file (the one for the
interface, in /etc/wireless/interfaces!) a line such as:
Code: Select all
PRIORITY_LIST='00:1B:9E:6F:61:F6 00:0E:2E:7B:E5:D8'
others (assuming they were detected by the scan, of course...).
That's about it, at the moment.
There are some things I'm still not completely sure about, including some
other modifications I made to the wizard, which people might help me with:
- Tempestuous mentioned once that running "iwlist $INTERFACE ap" will
return a list of access-points with their signal quality (and listed by
decreasing signal strength).
Is the order the networks are listed "normally" (iwlist $INTERFACE scan)
the same (i.e. listed by decreasing signal strength)?
- I took some code from Wicd, which is used to "clean up" every time before
an interface is configured: dhcpcd killed, wpa_supplicant killed, routing
table flushed etc.
This kills all instances of dhcpcd every time. Is this safe to
do? Could a user run more than one instance of dhcpcd at once, connecting
via more than one interface?
- Do people ever use static ip addresses with wireless??
UPDATE July 21st: fix some bugs and updated the attachment.
UPDATE July 22nd: updated the attachment.
UPDATE july 23rd: a few fixes (see post on page 3)
UPDATE july 25th: modify wireless profiles dialog and add "connect" argument (see post on page 3)
UPDATE july 28th: a bunch of fixes and added a loop for bootup sleep (see page 4)