控制操作收包
hostapd_ctrl_iface_init函数中注册eloop回调:
if (eloop_register_read_sock(hapd->ctrl_sock,
hostapd_ctrl_iface_receive, hapd, NULL) <
0) {
hostapd_ctrl_iface_deinit(hapd);
return -1;
}
hostapd_ctrl_iface_receive函数是hostapd接收报文的入口:
wpa_hexdump_ascii(level, "RX ctrl_iface", pos, res);
reply_len = hostapd_ctrl_iface_receive_process(hapd, pos,
reply, reply_size,
&from, fromlen);
接收来自应用层对于hostapd或sta的操作。
在我们的日志文件中频繁打印的如下信息:
1709692298.179574: RX ctrl_iface - hexdump_ascii(len=9):
53 54 41 2d 46 49 52 53 54 STA-FIRST
1709692298.193187: RX ctrl_iface - hexdump_ascii(len=26):
53 54 41 2d 4e 45 58 54 20 31 38 3a 34 37 3a 33 STA-NEXT 18:47:3
64 3a 66 37 3a 65 33 3a 63 35 d:f7:e3:c5
是由hostapd_cli触发的操作:
WNM帧处理
ieee802_11_rx_wnm_action_ap:接收到WNM帧的处理函数
src/ap/ieee802_11.c文件中,在handle_action函数中调用:
当接收到WNM_BSS_TRANS_MGMT_QUERY时,调用ieee802_11_send_bss_trans_mgmt_request函数发送WNM_BSS_TRANS_MGMT_REQ报文: