Discussion:
Possible fix for wpa_supplicant(8) WPA re-key lossage
(too old to reply)
Steve Woodford
2008-04-18 21:05:50 UTC
Permalink
Hi,

Since the last import back in January, wpa_supplicant(8) in
NetBSD-current has been unable to maintain a WPA session with a
wireless AP due to lossage during re-keying. The work-around thus far
has been to keep a wpa_cli(8) instance running for the duration of the
session.

After some playing around this evening, I believe I have tracked down
the cause of the bug to lossage within bpf(4)'s bpf_poll() function.
The bottom line is that wpa_supplicant(8) does not receive the re-key
packet from the AP because the select(2) call in
dist/wpa/src/utils/eloop.c does not report the event promptly. The
wpa_cli(8) hack works because it sends a PING request over
wpa_supplicant's control socket once per second, resulting in the
select(2) call returning each time. The next call to select(2) returns
a bpf(2) readable status, so re-keying proceeds normally albeit delayed
slightly.

The attached patch to sys/net/bpf.c contains two changes lifted from
FreeBSD's bpf.c:
- A "fix" for bpf_poll() to address the above problem (but see below).
- A fix for catchpacket() which delays calling bpf_wakeup() until
the state has been updated.

I'd like someone with more bpf(4) clue to look over the first fix, as
I'm somewhat perplexed as to why it fixes the problem. (Maybe it's the
beer, maybe I need to spend more time staring at it, or maybe I'm just
getting too old ;-)

In anycase, if you have been experiencing this wpa_supplicant(8)
problem, please try the patch and report back.

Cheers, Steve
j+ (Jukka Salmi)
2008-04-19 07:27:35 UTC
Permalink
Hello,
Post by Steve Woodford
In anycase, if you have been experiencing this wpa_supplicant(8)
problem, please try the patch and report back.
Indeed, this patch seems to fix the problem I experienced! At least
all GTK rekeyings so far were successful - previously they almost
always failed (if wpa_cli was not running).

Thanks a lot!


Regards, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Jared D. McNeill
2008-04-19 18:44:02 UTC
Permalink
Post by Steve Woodford
In anycase, if you have been experiencing this wpa_supplicant(8)
problem, please try the patch and report back.
Running since yesterday without a hiccup. Thanks!

Cheers,
Jared

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Pierre Pronchery
2008-04-22 20:54:46 UTC
Permalink
Hey,
Post by Steve Woodford
Since the last import back in January, wpa_supplicant(8) in
NetBSD-current has been unable to maintain a WPA session with a
wireless AP due to lossage during re-keying. The work-around thus far
has been to keep a wpa_cli(8) instance running for the duration of the
session.
I am now using bpf.c revision 1.138, which I believe contains your patch:
$ gunzip -c /netbsd | ident | grep 'bpf\.c'
$NetBSD: bpf.c,v 1.138 2008/04/20 15:27:10 scw Exp $

And unfortunately it does not seem to be enough to fix the problem here.
Running wpa_cli in the background never worked-around it, by the way.
Here is what the status says when it's working:
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED

Everytime I load a "heavy" web page (most Wikipedia entries are enough),
the link gets lost (and for other users of the network as well). It then
says it times out looking up 00:00:00:00:00 and connects again after a
minute or two.

I am using NetBSD/amd64 from an hour ago, with a wpi card.

Cheers,
--
khorben


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Steve Woodford
2008-04-22 21:43:09 UTC
Permalink
I use a PCI ral(4) based card and works without any problem with WEP.
Yesterday I tried WPA PSK-TKIP again and after visiting some
websites, the connection to the AP was lost.
So I switched back to WEP again... the WPA issue has been there
forever (and probably will be there for long time :-)
Can you try again after applying the attached patch to
sys/dev/ic/rt2661.c?

Cheers, Steve
Juan RP
2008-04-29 14:38:35 UTC
Permalink
On Wed, 23 Apr 2008 00:07:31 +0200
ral0 at pci5 dev 0 function 0: Ralink Technologies RT2561 802.11b/g (rev.
0x00)
ral0: interrupting at ioapic0 pin 20 (irq 10)
ral0: 802.11 address 00:80:5a:4f:ab:e2
ral0: MAC/BBP RT2561C, RF RT2527
ral0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
ral0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps
24Mbps 36Mbps 48Mbps 54Mbps
Hi,

as datapoint I've updated AP's firmware to the latest one and after
changing it to WPA2, both my laptop and workstation are working
without any issue... at least I haven't seen them yet.

The issue that always happened with TKIP (disconnected after accessing
any wikipedia URL) no longer happens now.
status
16:36:25.963: bssid=00:17:9a:11:e0:28
ssid=d00dcooffee
id=0
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.1.2
--
Juan Romero Pardines - xtraeme at gmail|netbsd dot org
The NetBSD Project

Make your own NetBSD/x86 Live CD
http://www.netbsd.org/~xtraeme/mklivecd/

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...