1 wpa_supplicant发送消息NL80211_CMD_CONNECT给驱动:
以下是函数的调用流程:
wpa_supplicant_fast_associate
wpa_supplicant_associate
wpas_start_assoc_cb
wpa_drv_associate
wpa_driver_nl80211_associate : 在这里判断是要connect还是 associate
/** Driver provides separate commands for authentication and association (SME in
* wpa_supplicant). */
#define WPA_DRIVER_FLAGS_SME 0x00000020
wpa_driver_nl80211_connect
wpa_driver_nl80211_try_connect
send_and_recv_msgs_owner
send_and_recv
最终调用netlink的socket接口发送出去。
其中在方法 wpa_driver_nl80211_try_connect调用nl80211_drv_msg生成一个 NL80211_CMD_CONNECT消息。
2 wpa_supplicant从驱动接受消息:
通过netlink机制从内核收到NL80211_CMD_DISCONNECT事件,
然后发送DEAUTH事件。
NL80211_CMD_DISCONNECT事件的处理函数是mlme_event_disconnect。
wpa_supplicant_event
wpas_event_deauth
wpas_event_disconnect
wpa_supplicant_event_disassoc_finish
notifyDisconnectReason
wpas_notify_disconnect_reason
wpas_hidl_notify_disconnect_reason
HidlManager::notifyDisconnectReason 调用java端注册的回调。
reasonCode=15
nl80211_commands:
定义在这里:external/wpa_supplicant_8/src/drivers/nl80211_copy.h