Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 266395 - net-wireless/wpa_supplicant-0.6.10: interface goes down when executing wpa_cli reassociate
Summary: net-wireless/wpa_supplicant-0.6.10: interface goes down when executing wpa_cl...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Bjarke Istrup Pedersen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 295613
  Show dependency tree
 
Reported: 2009-04-16 16:36 UTC by Benoit Izac
Modified: 2010-12-15 00:58 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benoit Izac 2009-04-16 16:36:31 UTC
Use of wpa_cli, for example reassociate or select_network n, cause the network interface to go gown.

After search, I've found that /etc/wpa_supplicant/wpa_cli.sh execute /etc/init.d/net.interface stop when wpa_cli receives DISCONNECT and that's what is happen when you do a new association.

Reproducible: Always

Steps to Reproduce:
1. Install and configure wpa_supplicant
2. ping a machine
3. do a wpa_cli reassociate
4. try to ping a machine
Comment 1 Slava Gorbunov 2010-03-11 10:07:34 UTC
I confirm this. And what is more, wpa_supplicant is stopped when client is deassociated from AP due to any reason (for example, due to temporary signal loss). Because wpa_supplicant is stopped on the interface, no more associations with any AP will occur, and interface will stay "down" untill it is brought up manually.

The root of this problem is in script /lib/rc/net/wpa_supplicant.sh from sys-apps/openrc, not in wpa_supplicant (somebody, please change summary and assignee)

Perhaps more correct behavior is not to stop wpa_supplicant and wpa_cli on the interface if "stop" operation is caused by wpa_supplicant (i. e., when IN_BACKGROUND is set). In this case, "wpa_cli reassociate" (and signal loss, i believe) won't cause stopping wpa_supplicant, and interface will be automatically brought up when wpa_supplicant will be able to associate with AP again.

Here is the patch which realizes this idea:

--- wpa_supplicant.sh.orig	2009-12-21 18:30:17.000000000 +0300
+++ wpa_supplicant.sh	2010-03-11 12:44:54.000000000 +0300
@@ -183,9 +183,11 @@
 	fi
 
 	if yesno "${IN_BACKGROUND}"; then
-		# Only stop wpa_supplicant if it's not the controlling daemon
-		! service_started_daemon "${RC_SVCNAME}" "${wpas}" 1
+		# Don't stop wpa_supplicant & wpa_cli if in background
+		return 0
 	fi
+	# Only stop wpa_supplicant if it's not the controlling daemon
+	! service_started_daemon "${RC_SVCNAME}" "${wpas}" 1
 	[ $? != 0 ] && return 0
 
 	local pidfile="/var/run/wpa_cli-${IFACE}.pid"

Comment 2 Jory A. Pratt gentoo-dev 2010-07-14 03:22:59 UTC
If you can still duplicate this with openrc-0.6.1-r1 feel free to reopen. I am reassigning then resolving test request.
Comment 3 Jory A. Pratt gentoo-dev 2010-07-14 03:23:22 UTC
Please post back with your results.
Comment 4 Slava Gorbunov 2010-08-13 20:53:37 UTC
openrc-0.6.1-r1, nothing has changed. If I do 'wpa_cli reassociate', interface goes down and doesn't go up. Temporary deassociation from AP (initiated by AP) has the same effect - interface goes down without further attempts to associate.

(please, reopen the bug - I don't have sufficient permissions for it)
Comment 5 Anthony Basile gentoo-dev 2010-08-13 22:13:56 UTC
As per comment #2, reopening.
Comment 6 William Hubbs gentoo-dev 2010-08-18 20:08:04 UTC
(In reply to comment #1)
> I confirm this. And what is more, wpa_supplicant is stopped when client is
> deassociated from AP due to any reason (for example, due to temporary signal
> loss). Because wpa_supplicant is stopped on the interface, no more associations
> with any AP will occur, and interface will stay "down" untill it is brought up
> manually.
> The root of this problem is in script /lib/rc/net/wpa_supplicant.sh from
> sys-apps/openrc, not in wpa_supplicant (somebody, please change summary and
> assignee)
> Perhaps more correct behavior is not to stop wpa_supplicant and wpa_cli on the
> interface if "stop" operation is caused by wpa_supplicant (i. e., when
> IN_BACKGROUND is set). In this case, "wpa_cli reassociate" (and signal loss, i
> believe) won't cause stopping wpa_supplicant, and interface will be
> automatically brought up when wpa_supplicant will be able to associate with AP
> again.
> Here is the patch which realizes this idea:

This patch has been applied to the git overlay and will be included in the next release.

Thanks much.

William
Comment 7 William Hubbs gentoo-dev 2010-09-02 14:49:36 UTC
I am re-opening this bug.

The fix we used caused bug #334663, so I am reverting it.
Comment 8 William Hubbs gentoo-dev 2010-09-02 17:35:41 UTC
I checked this without using the net.* scripts, and it appears to be an issue within wpa_supplicant itself.  Here is my procedure.

1) make sure that no net.* scripts for wireless interfaces are in the runlevels.
2) make sure that the networks are configured in /etc/wpa_supplicant/wpa_supplicant.conf
3) stop  all wireless interfaces that you have started with net.* scripts.
4) start the wpa_supplicant  daemon directly:

rc-service wpa_supplicant start

5) start the dhcpcd daemon:

rc-service dhcpcd start

In this setup, wpa_supplicant  and dhcpcd have control of the interfaces themselves, and you should use wpa_cli to control wpa_supplicant.

6) ping a machine to show that you have a network connection.

7) issue the reassociate command:

wpa_cli reassociate wlan0

8) ping a machine to show that the interface is down.  The only way to get the interface back at this point is to restart wpa_supplicant.

On the other hand, if you replace the command in step 7 with the following:

wpa_cli disconnect wlan0
wpa_cli reconnect wlan0

the interface will come back.
Comment 9 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2010-09-02 19:14:27 UTC
Does this work with the latest 0.7.x version in the tree?
Comment 10 William Hubbs gentoo-dev 2010-09-05 20:24:44 UTC
(In reply to comment #9)
> Does this work with the latest 0.7.x version in the tree?

I ran both my test and the original reporter's test using wpa_supplicant-0.7.2-r3 and openrc-0.6.3, and the issue  appears to be resolved.

If everyone is ok with doing so, we can close this bug.

Comment 11 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2010-09-06 08:41:55 UTC
(In reply to comment #10)
> I ran both my test and the original reporter's test using
> wpa_supplicant-0.7.2-r3 and openrc-0.6.3, and the issue  appears to be
> resolved.
> 
> If everyone is ok with doing so, we can close this bug.
> 

Seems like it might be about time to mark 0.7.x of hostapd and wpa_supplicant stable, since there are more and more problems with 0.6 that won't be resolved upstream. (Anyway, the next release in the 0.7 will be called stable by upstream)
Comment 12 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2010-09-08 17:44:27 UTC
I'm closing this bug, since 0.7.3 has hit the tree.

0.7.3 is the first stable version from upstream, so untill it is marked stable (within a month if all goes well), people will have to use the unstable keyword.
Comment 13 Slava Gorbunov 2010-12-14 07:47:42 UTC
This problem is still present even with latest versions of wpa_supplicant-0.7.3-r1 and openrc-0.6.8. Steps to reproduce:

/etc/init.d/net.wlan0 restart

(wlan0 is now up)

wpa_cli -i wlan0 reassociate

(several seconds later interface goes down, wpa_supplicant and wpa_cli are stopped).

It is not so important bug of itself (since you rarely need to reassociate manually), but the same thing happens when you temporary lose wifi signal (or AP forces reassociation for some reason). It is much more important, since in this case wifi connection goes down and will not get up until you perform "net.wlan0 restart" manually.

It is openrc problem, NOT wpa_supplicant one.

Please reopen the bug.
Comment 14 William Hubbs gentoo-dev 2010-12-14 15:08:45 UTC
(In reply to comment #13)
> This problem is still present even with latest versions of
> wpa_supplicant-0.7.3-r1 and openrc-0.6.8. Steps to reproduce:
> /etc/init.d/net.wlan0 restart
> (wlan0 is now up)
> wpa_cli -i wlan0 reassociate
> (several seconds later interface goes down, wpa_supplicant and wpa_cli are
> stopped).

On my system, this does not happen.  If I run this sequence the interface comes back up and everything works.

Mobile herd, do you have any ideas?

Thanks,

William

Comment 15 Slava Gorbunov 2010-12-14 23:39:21 UTC
(In reply to comment #14)
> On my system, this does not happen.  If I run this sequence the interface comes
> back up and everything works.
> 
> Mobile herd, do you have any ideas?

How did you configured network? I have the following lines in /etc/conf.d/net:

modules=("wpa_supplicant")
wpa_supplicant_wlan0="-Dwext"

Perhaps you didn't configure wpa_supplicant in /etc/conf.d/net and run in as separate daemon? In this case, as far as I understand, you won't be affected by this bug, because wpa_supplicant won't be stopped when interface goes down.
Comment 16 William Hubbs gentoo-dev 2010-12-15 00:58:49 UTC
I just ran the test again with the following setup:

/etc/conf.d/net:

modules=("wpa_supplicant")
wpa_supplicant_wlan0="-Dwext"

net.wlan0 is in the default runlevel and wpa_supplicant is not in any
runlevel.

I rebooted then as root did:

rc-service net.wlan0 restart
wpa_cli -i wlan0 reassociate

The interface disconnected and reconnected successfully.

My original /etc/conf.d/net was blank, but with the same setup for
net.wlan0 and wpa_supplicant.

I'm not sure what else to try for this.

Thanks,

William