QNX / libpcap / wpa_supplicant -- packet loss

Patrik Lahti plahti
Mon Oct 18 11:43:15 PDT 2010


Hi Andreas,

Indeed, you're right, the supplicant should loop calling pcap_next() and 
process all packets until NULL is returned. The packets don't get lost, 
but get severely delayed, but it isn't a QNX-specific problem. It may be 
specific to using l2_packet_freebsd.c or only cause a problem if using 
BPF to implement libpcap, but I haven't investigated.

If multiple packets are received and read() out of BPF at the same time, 
the supplicant will only get the first packet through pcap_next(). The 
other packets aren't lost, they're still in the pcap_t's buffer and will 
be read next time pcap_next() is called. I.e. next time select() 
indicates the fd is readable, the supplicant will go and call 
pcap_next() again and get an old packet already queued in the pcap_t's 
buffer but not read() more. Since nothing is read, select() will again 
say the fd is readable and again the supplicant calls pcap_next(), and 
so on until there are no more old packets and pcap_next() returns NULL, 
and then on nest invocation pcap_next() finally read()s the BPF fd 
(clearing the fd's readable condition) and getting another packet(s) 
into the pcap_t's buffer and pcap_next() then returns the first of them 
to the supplicant. If there were several packets, then the situation 
(i.e. delay) repeats.

Cheers and thanks for investigating!
/P

On 10-10-01 09:04 AM, Andreas Fenkart wrote:
> Hi
>
> I observed a problem, when bpf queues 3 packages for
> wpa_supplicant. Only the first package is received, then
> wpa_supplicant blocks in select without reading the other 2
> packages.
>
> The is what I debugged so far:
>
> wpa_supplicant io-pkt
> ------------------------------------------------------
> select:
> - - - - | -> bpf_poll
> <- - - - | - <data available
> -> pcap_next " |
> -> pcap_dispatch |
> -> pcap_read_bpf |
> - - - | -> bpf_read
> <- - - | - <pass all queued data>
>
> --> libpcap extracts 1 packet queues remaining data <--
>
> <- 1 packet
> <- 1 packet
> ..
> process packet
> ..
> do select:
> - - - - | -> bpf_poll
> <- - - - | - <no data available
> repeat
>
>
> The problem is that the data is queued in pcap, but the
> supplicant not checking this before calling 'select' again. Select
> will fail, since it checks for available data in io-pkt which in
> my case receives no more data.
>
> Any suggestions, hints and existing patches very welcome.
>
> kind regards
>
> Andreas
>
>
> ---- configuration --------------------------------------------
>
> QNX 6.4.1 / wpa_supplicant 0.6.4 / libpcap 0.9.8
>
> network={
> ssid="MotorolaWPA-EAP"
> scan_ssid=1
> # IEEE 802.1X (i.e., no WPA) with dynamic WEP keys
> key_mgmt=IEEE8021X
> eap=TTLS
> identity="xxxx"
> password="xxxx"
> priority=1
> }
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>



More information about the Hostap mailing list