<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">My research group has been having trouble getting hostapd to recognize the 802.11 acknowledgement frames in response to the authentication and association responses that it is generating.
 In fact, we've become so frustrated that we've created a test agent using libtins solely for testing the ACKing authentication and association frames. Our setup is this:<br>
<br>
All tests:<br>
Linux 12.04<br>
hostapd 1.1 (although 0.6.8 and 2.4 produce the same results)<br>
wireshark 1.6.7<br>
<br>
test 1:<br>
wpa_supplicant 0.7.3<br>
<br>
tests 2 and 3:<br>
libtins 3.1<br>
<br>
<br>
<u>Procedure for test 1:</u><br>
<br>
1) run a basic, open hostapd instance with the following config file<br>
<br>
<b>interface=wlan0<br>
driver=nl80211<br>
<br>
hw_mode=g<br>
channel=1<br>
ssid=mac80211 test</b><br>
<b>ignore_broadcast_ssid=0<br>
preamble=1<br>
supported_rates=60 90 120 180 240 360 480 540<br>
basic_rates=60 120 240</b><br>
<br>
This is started <font color="black" face="Tahoma" size="2"><span style="font-size:10pt;" dir="ltr">as a process by a python module in our system, and is in fact the standard config file for our system.<br>
<b><br>
</b>2) Run the wpa_supplicant counterpart to this network with the following config file<br>
<br>
<b>ctrl_interface=/var/run/wpa_supplicant<br>
<br>
network={<br>
&nbsp;&nbsp;&nbsp; ssid=&quot;mac80211 test&quot;<br>
&nbsp;&nbsp;&nbsp; key_mgmt=NONE<br>
}<br>
<br>
</b>This is started with the terminal command </span></font><br>
<b><font color="black" face="Tahoma" size="2"><span style="font-size:10pt;" dir="ltr">sudo wpa_supplicant -d -Dnl80211 -iwlan1 -c wpa_supplicant.conf -dd</span></font></b><br>
<br>
3) Observe the outcome on hwsim0.<br>
<br>
Here, we see that the time difference between the Auth reply from hostapd and the ACK for this frame from wpa_supplicant is
<b>4 us</b> (as observed on hwsim0, as it seems that this frame never arrives at mon.wlan0). The contents of the frame, including radiotap header, are (radiotap header contents in square brackets):<br>
<b><br>
[00 00 0e 00 0a 00 00 00 00 00 71 09 80 00] d4 00 00 00 &lt;BSSID&gt;<br>
<br>
</b>The printout in the terminal in which hostapd is running shows that the ACK was received and processed just fine and that the association request, response and their corresponding ACKs are received and processed without error as well. Everything functions
 normally after this.<br>
<br>
----------------------------------------------------------------------<br>
<b><br>
</b><u>Procedure for test 2:<br>
<br>
</u>1) Run the exact same configuration as above via the exact same method as above (i.e. as a process started by a python module in our system).<br>
<br>
2) Using the packet sniffing/crafting software libtins, create an 802.11 Auth frame and send it to mon.wlan0.<br>
<br>
3) Sniff on hwsim0 for the Auth reply from hostapd.<br>
<br>
4) Send an ACK to mon.wlan0.<br>
<br>
5) Observe outcome on hwsim0.<br>
<br>
Here, we see that the delay between the Auth reply and the ACK for this frame is <b>
105 us</b> (i.e. ~25 times longer than wpa_supplicant's response time). The frame itself contains (radiotap header in square brackets:<br>
<br>
<b>[00 00 0e 00 0a 00 00 00 00 00 71 09 80 00] d4 00 00 00 &lt;BSSID&gt;</b>,<br>
<br>
that is to say that it is -- down to the bit -- the exact same ACK frame as that generated by wpa_supplicant.
<br>
<br>
The result here is that hostapd prints out that the station <u>did not</u> ACK the Auth response. We were thinking that maybe hostapd is really finicky about the time difference between the Auth response and its corresponding ACK, so on to test 3.<br>
<br>
----------------------------------------------------------<br>
<br>
<u>Procedure for test 3:<br>
<br>
</u>1-2) Same as above.<br>
<br>
3) <u>IMMEDIATELY</u> send an ACK to mon.wlan0 after sending the Auth frame to hostapd. Do not wait for a response, just send the ACK for the Auth response that we expect will be produced.<br>
<br>
4) Observe outcome on hwsim0.<br>
<br>
Testing showed that even if we send the ACK immediately after sending the Auth frame, this ACK will arrive after the Auth response from hostapd, likely due to processing delays in libtins. This is fine, in fact it is the best possible outcome because this time
 we see that our ACK frame was seen on hwsim0 <b>5 us</b> after the Auth response was sent out by hostapd. That's only
<b>1 us</b> longer than the ACK response time of wpa_supplicant.<br>
<br>
Again though, hostapd fails to see this ACK frame, as it prints out a message saying that the station did not acknowledge the Auth response.<br>
<br>
We repeated this test by sending the ACK to <br>
a) hwsim0 followed by mon.wlan0<br>
b) mon.wlan0 followed by hwsim0<br>
c) solely mon.wlan0<br>
d) solely hwsim0<br>
<br>
In each of the above cases, the longest time difference between hostapd's Auth response and the ACK we inject to the interface is
<b>8 us</b>. Not milliseconds, mind you, but 8 <u>microseconds</u>. Still, hostapd refuses to notice this frame.<br>
<br>
<br>
----------------------------------------------------------<br>
<br>
<u>Further observations:</u><br>
<br>
If we add the line <br>
<br>
<b>ap_max_inactivity=2</b><br>
<br>
to the hostapd config file to try and see the Null function frame generated by hostapd for inactivity, our setup with libtins does not show this frame on hwsim0, nor mon.wlan0. We assume this is likely because even though the Auth was not ACKed, the station
 succeeded in associating anyways.<br>
<br>
<br>
<u>Questions: </u><br>
<br>
1) What on earth is going on? It seems illogical for hostapd to expect an 802.11 station to ACK in 4 us or less, especially considering that in all the forms of 802.11 running today, none of these have a short interfrace spacing (SIFS) less than 10 microseconds.<br>
<br>
2) If hostapd is indeed this finicky about the time difference, is there anywhere in its code that we can modify it to force it to wait longer for an ACK?<br>
<br>
3) Why is the Null data frame not sent out after this quasi-erroneous authentication/association procedure?&nbsp; Is there something in hostapd's code that is waiting on the ACK in order to execute this functionality?<br>
<br>
4) Why do we see the ACK from wpa_supplicant on hwsim0 rather than mon.wlan0? The documentation (on various sites) seems to imply that mon.wlan0 is the interface that hostapd is listening on, while hwsim0 is the interface for its output.<br>
<br>
Regards,<br>
Al<br>
</div>
</body>
</html>