OS 11.3, ifup, madwifi, wpa_supplicant & dhcp on lenovo t61p

I now have a work around that allows me to run my wireless setup using Opensuse 11.3, ifup, madwifi (r4133_k2.6.34.0_12-1.1), wpa_supplicant (0.7.1-4.1) and dhcpcd (3.2.3-60.1) on my Lenovo T61P laptop. I made a minor change to the /etc/sysconfig/network/config file in order to turn on debug support in all if* scripts:

binarystar:/etc/sysconfig/network # diff config config.orig
38c38
< DEBUG=“yes”

> DEBUG=“no”

The next change was to /etc/sysconfig/network/scripts/ifup-wireless that was intended to, while in debug mode, force the use of a non-ifup generated wpa_supplicant configuration file. (In addition, there is a minor change to the pipeline invoking wpa_supplicant in debug mode that causes wpa_supplicant debug output to appear in the /var/log/messages file without needing to do an ‘rcnetwork stop’ commmand to force a flush.)

binarystar:/etc/sysconfig/network/scripts # diff ifup-wireless ifup-wireless.orig
669,670c669
< SUPPARGS="$SUPPARGS ${WIRELESS_WPA_DEBUG_OPTION:–dddt} |& logger -s -t wpa_supplicant &"
< WPA_SUPP_CONF="/var/run/wpa_supplicant-$INTERFACE.NONIFUP.conf"

> SUPPARGS="$SUPPARGS ${WIRELESS_WPA_DEBUG_OPTION:–dddt} 2>&1 | logger &"

This last change forces the ifup-wireless script to use a wpa_supplicant-ath0.NONIFUP.conf file in place of the ifup-wireless generated wpa_supplicant-ath0.conf file:

binarystar:/var/run # cat wpa_supplicant-ath0.NONIFUP.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid=“4leos_hn”
psk=“FirstTest”
key_mgmt=WPA-PSK
priority=5
proto=WPA
pairwise=TKIP
group=TKIP
scan_ssid=1
}
binarystar:/var/run # cat wpa_supplicant-ath0.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=0
network={
scan_ssid=1
ssid=“4leos_hn”
key_mgmt=WPA-PSK
psk=“FirstTime”
}

The results of making these changes is that, after rebooting, I have a broken wireless interface. I then issue a ‘rcnetwork stop’ command. Next, I put the change into the /etc/sysconfig/network/scripts/ifup-wireless then copy the content of the above /etc/run/wpa_supplicant-ath0.NONIFUP.conf file into place. I then issue ‘rcnetwork start’. At that point, I have a working wireless interface.

When I look at my /var/log/messages, I see the wpa_supplicant that ran as a part of the reboot produced debug information that first appears after I issue the ‘rcnetwork stop’ command. That debug information shows that this wpa_supplicant wasn’t able to do much of anything.

When I issue the ‘rcnetwork start’ command, with the above changes in place, I then see the wpa_supplicant debug information appear in the /var/log/messages file ‘at the right time’ immediately before and around the spawning of the dhcpcd command. In addition, I see the full handshaking process laid out and succeed in the /var/log/messages file.

Details

binarystar:/var/run # uname -a
Linux binarystar 2.6.34.7-0.3-desktop #1 SMP PREEMPT 2010-09-20 15:27:38 +0200 x86_64 x86_64 x86_64 GNU/Linux
binarystar:/var/log # egrep “Ather|ath_” boot.msg
<6> 10.146013] ath_pci 0000:03:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
<7> 10.146026] ath_pci 0000:03:00.0: setting latency timer to 64
<6> 10.719548] MadWifi: ath_attach: Switching rfkill capability off.
<6> 10.759394] wifi0: Atheros AR5424 chip found (MAC 10.3, PHY SChip 6.1, Radio 10.2)
<6> 10.794530] ath_pci: wifi0: Atheros 5212: mem=0xd7df0000, irq=17
binarystar:/var/log # lspci | grep “Ather”
03:00.0 Ethernet controller: Atheros Communications Inc. AR5212 802.11abg NIC (rev 01)
binarystar:/var/log # lspci -nv
.
.
.
03:00.0 0200: 168c:1014 (rev 01)
Subsystem: 1014:058a
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at d7df0000 (64-bit, non-prefetchable) [size=64]
Capabilities: [40] Power Management version 2
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [60] Express Legacy Endpoint, MSI 00
Capabilities: [90] MSI-X: Enable- Count=1 Masked-
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Kernel driver in use: ath_pci
.
.
.

The bottom line seems to be that ifup should be able to manage this configuration well enough so long as the /etc/sysconfig/network/wpa_supplicant-$INTERFACE.conf file that it creates is well suited to the specific security configuration AND the specific version of wpa_supplicant that you’ve got.

In my case, I couldn’t figure out how to get ifup to generate such a configuration so I ended up replacing that configuration file with one that I created by hand.

Cheers,
Frank[/size]

I have modified the workaround so that it now works during both boot time and any subsequent rcnetwork interactions that you might need to do. First off, I reverted the /etc/sysconfig/network/config file to it’s original copy which turned off the if* script debugging output that was hitting /var/log/messages. I then made the following changes to the original /etc/sysconfig/network/scripts/ifup-wireless script:

**binarystar:/etc/sysconfig/network/scripts # diff ifup-wireless.debug ifup-wireless.orig
667,678d666
< #
< # BEGIN - WORKAROUND TO FORCE USE OF A NON-IFUP GENERATED WPA_SUPPLICANT CONFIG FILE
< #
< if -f /etc/wpa_supplicant/wpa_supplicant-$INTERFACE.NONIFUP.conf ]; then
< # Save IFUP’s version of the configuration file then replace it with your NON-IFUP version and note it to logger
< cp -p /var/run/wpa_supplicant-$INTERFACE.conf /var/run/wpa_supplicant-$INTERFACE.IFUP.conf
< cp -p /etc/wpa_supplicant/wpa_supplicant-$INTERFACE.NONIFUP.conf /var/run/wpa_supplicant-$INTERFACE.conf
< message “printf " %-9s warning: WORKAROUND for non-ifup config file to wpa_supplicant is ACTIVE on this interface" $INTERFACE
< fi
< #
< # END - WORKAROUND TO FORCE USE OF A NON-IFUP GENERATED WPA_SUPPLICANT CONFIG FILE
< #
681c669
< SUPPARGS="$SUPPARGS ${WIRELESS_WPA_DEBUG_OPTION:–dddt} |& logger -t wpa_supplicant &"

> SUPPARGS="$SUPPARGS ${WIRELESS_WPA_DEBUG_OPTION:–dddt} 2>&1 | logger &"
**

This change will switch the wpa_supplicant configuration file used by ifup-wireless to a known ‘good’ config file if it finds an appropriately named file in /etc/wpa_supplicant. I kept the minor tweek to the original debug block that seems to force logger to output the wpa_supplicant debug info to the syslog in a more timely fashion.

Now, I end up with a working wireless interface as a result of either booting and/or if I have to issue any ‘rcnetwork stop/start’ commands.

I’m going to do a bit more testing with my version of wpa_supplicant but when I was testing before this patch and ifup was creating the config file, wpa_supplicant was quitely doing nothing and so dhcpcd would re-install any past ip address and routes but the interface wasn’t associated or authenticated when ap_scan was set to 0. I tried setting ap_scan to 1 but I started to get system lockup’s - the screen would go blank and only a power cycle would fix the issue. The version of wpa_supplicant, 0.7.1-4.1, is a couple of minor releases old but I didn’t notice anything in it’s change notes that indicated a known issue with either ap_scan or a dependence on any of the minor differences that you see in the two versions of configuration file above.

BTW, I found the information at the following locations to be extremely helpful in my effort to replace the original ath5k driver with an opensuse packaged version of madwifi followed by getting basic security re-enabled on my wireless network:
**SDB:Atheros madwifi - openSUSE
SDB:Tracking down wireless problems - openSUSE
http://en.opensuse.org/HCL:Network_(Wireless)
Madwifi or Ndiswrapper Wireless Network Drivers - Suse/openSUSE 10, 11.0
(many posters on this board, likewise, had similar issues, really good observations and recommendations but they are too numerous to list)
**

Next up, I’d like to see if I can leverage what I learned by debugging and patching the ifup layer to help me get the KNetworkMangager layer back into the picture. If I can get there then I may turn toward seeing if updated ath5k, madwifi, wpa_supplicant packages might exist that remove the need for this sort of workaround all together.

Cheers,
Frank