KapaA
KapaA

Reputation: 307

WPA_supplicant authentication implementation

I need help from someone that have some experience in playing with wpa_supplicant code.

What i understand is that wpa_supplicant dose everything in order for a supplicant to connect to an AP (if that what you what). Hence the steps are as:

  1. Scan
  2. Get scan results
  3. AUTH
  4. ASSOC
  5. 4-hand shake
  6. data exchange

As i understand this then the first 4 steps are only managed by wpa_supplicant. That is, wpa_supplicant simply calls the under laying driver to perform these steps and after the main event loop receives the EVENT_ASSOC msg. it starts the 4-handshake.

For my part, it is fine with the first two steps are carried out at the driver, ie., wpa_supplicant send a scan req, the driver perform the scan and feed the scan results.

My question is, is it correct that wpa_supplicant cannot generate the necessary packet and use, e.g., layer 2 (rawsocket) to send authentication request to the AP ? and followed by an associate request ?... shall one simply provides these as a handle from the driver layer ?

as i can see from the code in wpa_supplicant.c (void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, struct wpa_ssid *ssid))

that this function calls a function pointer to the selected driver eg. ".associate = wpa_driver_nl80211_associate" and here the driver then send this down to the udnerlaying nl80211 driver code ? .... so wpa_supplicant can not generate these packet by it self ?

I hope that this make any sens, if not please ask :)

Upvotes: 0

Views: 1357

Answers (1)

Awk Jiang
Awk Jiang

Reputation: 11

Yes, your understanding is correct. To send auth/assoc req, the wpa_supplicant should construct the corresponding NL80211 commands in following different scenarios: a) in case the SME is maintained in wpa_supplicant

  • NL80211_CMD_AUTHENTICATE
  • NL80211_CMD_ASSOCIATE

b) in case the SME is maintained by driver

  • NL80211_CMD_CONNECT

And these commands will trigger the corresponding cfg80211_ops hooks (.auth, .assoc, .connect) registered by the wifi driver to be called to construct the frames and then send out the frames.

Upvotes: 1

Related Questions