cozybit/authsae — pull request #11 by MichelStam (2013-12-20 08:27:28+00:00)
Title: Fixed beacon race condition

Fixed a race condition where meshd-nl80211 would complete the SAE exchange, but no keys would be installed in the kernel.

The error message that is show is (in full debug mode):
>estab with 48:5d:60:c0:27:20
>set auth flag (seq num=1386330674)
>mesh plink with 48:5d:60:c0:27:20 established
>nlerror, cmd 18, seq 1386330673: No such file or directory
>nlerror, cmd 18, seq 1386330674: No such file or directory
>nlerror, cmd 11, seq 1386330675: No such file or directory
>nlerror, cmd 11, seq 1386330676: No such file or directory
>nlerror, cmd 11, seq 1386330677: No such file or directory
>nlerror, cmd 18, seq 1386330678: No such file or directory
>NL80211_CMD_NEW_PEER_CANDIDATE(1386330666.49663)
>new unauthed sta (seq num=1386330679)
>NL80211_CMD_NEW_STATION (1386330666.50351)
>Mesh plink timer for 48:5d:60:c0:27:20 fired on state ESTAB
>Timeout for peer 48:5d:60:c0:27:20 in state 4
>tx_frame(0x8060b40, 0xbfaa7f70, 128)
>tx frame (seq num=1386330680)

The reason is that meshd-nl80211 only calls NL80211_CMD_NEW_STATION
when a beacon is received. If the exchange occurs before the first
beacon (could happen during startup), the kernel has no knowledge
of the peer and the exchange succeeds, but the link fails.

This patch ensures that a station is created as soon as meshd-nl80211
starts an exchange with a candidate.