Wireless after suspend

I have a Thinkpad R40 (I repeat this in every related article to help Google out :) running Ubuntu Linux. I've found that it can do everything I need better and faster if I run Linux. It has only been recently that I figured out some of the niceties, like suspending to RAM or bootsplashing GRUB. To be fair, these were things that I could live without up until I started using them; now they're priceless.

I have an internal Atheros 802.11a/b wireless card, which uses the MADWIFI project's driver. This is all bundled with Ubuntu so I didn't need to checkout the source from CVS and manually compile against my kernel headers like I did with Debian. I like that.

Anyways... One of the problems that remained until a few minutes ago was that everytime I suspended and resumed the computer it would not accept a DHCP IP. I could see the access points with iwconfig, and Kismet would work fine. This was a problem, because it meant that coming from the office to home and back again would require a reboot if I wanted to use the wireless networks. This in turn made suspending to RAM pointless, which took me back to square one.

I thought it might be a good idea to force the reloading of the associated modules when I resume from suspend, so I added that to my /etc/network/interfaces configuration file. Now it kinda looks like this:

iface home inet dhcp
    name Wireless (Home)
    pre-up modprobe ath_pci wlan_wep || true
    post-down rmmod ath_pci ath_hal wlan wlan_wep || true
    wireless-essid lambie.org
    wireless-key 784364F2BB5FEB6F860E289D63
    wireless-mode Managed
    wireless-nick "lambie.org"
    # Note: this is powermanagemnt off, not power off
    wireless-power off
    wireless-txpower auto

As you can see, I've added some power management to the bottom also. Hopefully this might help someone out, other than Fitzy, who always benefits from my exploration of our IBM toys :)