Ha!
This morning - at 2AM - i got it working. At least to a level that will make me use the machine for real work
I've written a very small - and dumb - script, setting up WPA-PSK encryption for my atheros-wlan-nic.
It is to be executed before bringing up the interface ath0.
Now, investigating the ifupdown thing i stumbled upon the file /etc/network/interfaces. Doing 'man interfaces' got me wondering if it was possible to make the boot-scripts (executes 'ifup -a' to bring up interfaces present) also run my little script.
It was possible.
/etc/network/interfaces file now reads
------
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
name Ethernet kort (lan)
# my wlan...
iface ath0 inet dhcp
pre-up /root/wlan_up & #> /dev/null
name Wireless kort (wlan)
wireless_essid <name>
auto ath0
------
Now, at boot-time the wlan-nic first gets setup by my wee script, and then brought up using DHCP from my router - automatically.
The script? Well, setting up WPA-PSK turned out to be real easy. I feared this, as WPA requires yet another package to be installed and used: wpa_supplicant. Usually this means more complexity, but here it merely meant exchanging one complexity for another. You'll have to do your own bit of reading to get acquainted with wpa_supplicant, but having done that you might want to see how i've done my bit. The script file goes like this:
/root/wlan_up
------
#!/bin/sh
iwconfig ath0 essid <my-essid>
wpa_supplicant -i ath0 -D madwifi -d
------
wpa_supplicant takes a settings-file-thing which goes like this:
/etc/wpa_supplicant.conf
-----
network={
ssid="<my_ssid"
scan_ssid=1
psk="my_preshared_key"
}
-----
So, what happens is that the bootscripts execute ifup -a, which executes /root/wlan_up, which again assigns a essid to ath0 and runs wpa_supplicant - which uses the conffile to setup encryption. Finally ifup brings up ath0 and assigns a dhcp-address to it (dhclient?). All systems go!
Not perfect yet though... There's no automatics in this, as ifup appears to not know whether the wlan-nic is present before executing my script. If it isn't there (because i've physically removed the nic), the script fails, generating garbage onscreen. And it's oh-so-hardwired all of it
But it works.
doing iwconfig now gets me
----
# iwconfig
lo no wireless extensions.
ath0 IEEE 802.11g ESSID:"my_essid"
Mode:Managed Frequency:2.417 GHz Access Point: 00:01:02:04:08:0A
Bit Rate:54 Mb/s Tx-Power:50 dBm Sensitivity=0/3
Retry
ff RTS thr
ff Fragment thr
ff
Encryption key:you-d-like-to-know-wouldnt-you Security mode:restricted
Power Management
ff
Link Quality=33/94 Signal level=-62 dBm Noise level=-95 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
sit0 no wireless extensions.
----
and doing ifconfig gets me
----
# ifconfig
ath0 Link encap:Ethernet HWaddr 00:10:20:40:80:A0
inet addr:10.63.24.100 Bcast:10.63.24.255 Mask:255.255.255.0
inet6 addr: yuck Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3186 errors:9379 dropped:0 overruns:0 frame:9379
TX packets:1393 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:199
RX bytes:629934 (615.1 KiB) TX bytes:181365 (177.1 KiB)
Interrupt:11 Memory:e093a000-e094a000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:132 errors:0 dropped:0 overruns:0 frame:0
TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8340 (8.1 KiB) TX bytes:8340 (8.1 KiB)
----
Just my 0.002 euros
//mA