Jump to content

Wifi Hotplugging Problem


Guest farry
 Share

Recommended Posts

Guest farry

My laptop has a keyboard hotkey that switches the wifi card on and off. In the MCC, I enabled "Network hotplugging" but it isn't working well.

 

If I boot up with the wifi on, it's OK. If I boot up with the wifi off, then switch it on later, it's OK.

 

But... if I switch the wifi off, then on again, the connection doesn't return until I reboot (or do a "service network restart").

 

So it seems that the network-hotplugging is able to detect the switching-on of the wifi card and enables the connection, but the action of switching off the card causes something to go wrong.

 

Any suggestions about what to look at to investigate this problem?

 

(I've a laptop with Mandriva 2006, an Intel 2200BG wifi card, and also an ethernet interface on which the network hotplugging works fine.)

Link to comment
Share on other sites

The only thing I can think of right now, is using:

 

ifdown wlan0

 

followed by an:

 

ifup wlan0

 

to see if that helps bring the device up without requiring to restart the system.

Link to comment
Share on other sites

Guest farry

After searching various forums, I saw somebody say that the output of /var/log/messages is useful for checking that network hotplugging is working.

 

Wifi switched off:

Jul  3 11:48:38 localhost ifplugd(eth0)[3205]: Link beat lost.
Jul  3 11:48:44 localhost ifplugd(eth0)[3205]: Executing '/etc/ifplugd/ifplugd.action eth0 down'.
Jul  3 11:48:44 localhost ifplugd(eth0)[3205]: Program executed successfully.

Wifi switched on:

Jul  3 11:49:34 localhost kernel: ipw2200: failed to send CARD_DISABLE command
Jul  3 11:49:35 localhost ifplugd(eth0)[3205]: Link beat detected.
Jul  3 11:49:36 localhost ifplugd(eth0)[3205]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
Jul  3 11:49:39 localhost dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Jul  3 11:49:48 localhost last message repeated 2 times
Jul  3 11:50:05 localhost dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5

So it looks like the hotplugging is activated alright, but presumably there's a bug in it. I guess that I need to figure out what the above ifplugd.action command is trying to do.

 

Thanks. modprobe.conf:

alias eth0 ipw2200
alias sound-slot-0 snd-intel8x0
remove snd-intel8x0 /sbin/modprobe -r snd-pcm-oss; /sbin/modprobe --first-time -r --ignore-remove snd-intel8x0
install snd-intel8x0 /sbin/modprobe --first-time --ignore-install snd-intel8x0 && { /sbin/modprobe snd-pcm-oss; /bin/true; }
install usb-interface /sbin/modprobe uhci-hcd; /sbin/modprobe ehci-hcd; /bin/true
alias eth1 via-rhine
options scsi_mod max_luns=1

modprobe.preload:

nvram
hw_random
evdev
intel-agp

Link to comment
Share on other sites

I'd be tempted to add this:

 

ipw2200

 

to the /etc/modprobe.preload just at the bottom of the file. I'm not sure, it might help, as I had problems with my wireless when it wasn't entered here. But that was just for activating when I rebooted. Just a thought I had, otherwise, I'm not sure what else to suggest.

Link to comment
Share on other sites

Guest farry

Thanks. Didn't make any difference.

 

I'm closer to knowing what's gone wrong now. It's something to do with the encryption key.

 

After executing "ifdown eth0", I tried using the wireless configuration command "iwconfig eth0" to probe the wireless card and I noticed that the encryption key had been zeroed. I then executed "ifup eth0", but the encryption key remained zeroed!

 

So I executed "ifdown eth0", then set the key manually with "iwconfig eth0 key <key>", then executed "ifup eth0", and that time it worked. So "ifdown" kills the key, but "ifup" doesn't restore it.

Link to comment
Share on other sites

Guest farry

Just WEP.

 

Thanks for pointing out the ifdown/ifup scripts, because I've now got a working patch.

 

I found this stanza in /sbin/ifdown

# don't leave an outdated key sitting around
if [ -z "$IN_HOTPLUG" -a -n "${WIRELESS_ENC_KEY}" -a -x /sbin/iwconfig ]; then
  /sbin/iwconfig ${DEVICE} enc 0 >/dev/null 2>&1
fi

I commented it out, and now the wifi can be switched on and off with the keyboard hotkey without any problems.

 

Later, I'll try to figure out why /sbin/ifup didn't reverse the process and restore the key.

Link to comment
Share on other sites

Check in /etc/sysconfig/network-scripts and look for ifcfg-eth0 and see if your key is registered correctly in this file.

 

When an ifup is called, it should read this file, and the key mentioned within it.

Link to comment
Share on other sites

Guest farry

It seems that "ifup" does call that script but doesn't do anything with it.

 

At line 214, "ifup" contains:

if [ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ]; then
<wireless config stuff>
elif [ "$WIRELESS_MODE" = "Roaming" ]; then
<alternative wireless config stuff>
fi

The tests in the above evaluate as false because "$daemon" is an empty string, "$MII_NOT_SUPPORTED" is set to "no" by checking the "network hotplugging" in the MCC, and in my case "$WIRELESS_MODE" is set to "Managed". If I replace any one of the three tests with "true", then the wireless does get set up OK.

Link to comment
Share on other sites

Guest farry

At line 214, "/sbin/ifup" contains

if [ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ]; then
... wireless config stuff ...
elif [ "$WIRELESS_MODE" = "Roaming" ]; then
... wireless roaming-mode config stuff ...
fi

I thought at first that the MII test should be inverted like so:

if [ -n "${daemon}" -o ! "$MII_NOT_SUPPORTED" = "yes" ]; then

During bootup, "ifup" is called from ".../init.d/network" with a parameter that is parsed to set the variable "daemon=1", and so the above test [ -n "${{daemon}" ] results in the wireless config code being executed during bootup which seemed correct.

 

However, It seemed to me that the sense of the MII test was inverted. In the Mandrake Control Center, if "network hotplugging" is checked, then it sets "MII_NOT_SUPPORTED=no", (asserting that the wireless chipset supports the MII network heartbeat probe which allows hotplugging). Under those circumstances, when "ifup" is called from the "ifplugd" daemon, then the wireless configuration *should* be run. Thus it seemed that a "!" should be added to invert the above MII test

 

However, I noticed that during boot-up that this change would mean that the wireless config would be run twice. First by "ifup" being called from the network startup, and then again by "ifup" being called by the "ifplugd" daemon. This led me to suspect that the test was originally written like this with the sense of the boot test inverted instead (by replacing "-n" with "-z") like so:

if [ -z "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ]; then ...

i.e. The first test means that if you're NOT booting up, then "ifup" must have been called by the "ifplugd" daemon and so you DO want to configure the wireless. The second test means that if the MII heartbeat probe is NOT supported, then "ifup" must have been called from the network startup and so you DO want to configure the wireless. But it won't run TWICE because if you ARE booting up and the heartbeat probe IS supported, then the wireless is NOT configured during the first pass through "ifup".

 

HOWEVER... Thanks to the bug, if somebody checks "network hotplugging" in the MCC, but the wireless card doesn't actually support the heartbeat probe, then the card will be correctly configured during boot-up, whereas it wouldn't if the above test was written "correctly". Maybe this problem led somebody other than the original author to investigate why some wireless cards didn't configure on boot and noticed that the sense of the [ -n ${daemon ] test appeared to be wrong - so they inverted it - which fixed the apparent boot problem and killed the hotplugging in the process.

 

Anyway, if by some chance somebody has actually read this far through this post and has also encountered the wireless hotplugging problem, then I recommend just changing the test so that the wireless is always configured by "ifup" like so:.

if [ true ]; then ...

I've just checked the Cooker version of "ifup", which I should have done before getting too deeply into this, and the wireless config code has vanished so it looks like the methodology has changed completely. I'll wait until the release of Mandriva-2007 before testing how well that works.

Edited by farry
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...