|
@@ -1562,6 +1562,76 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+static int hostapd_ctrl_iface_mgmt_rx_process(struct hostapd_data *hapd,
|
|
|
|
+ char *cmd)
|
|
|
|
+{
|
|
|
|
+ char *pos, *param;
|
|
|
|
+ size_t len;
|
|
|
|
+ u8 *buf;
|
|
|
|
+ int freq = 0, datarate = 0, ssi_signal = 0;
|
|
|
|
+ union wpa_event_data event;
|
|
|
|
+
|
|
|
|
+ if (!hapd->ext_mgmt_frame_handling)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ /* freq=<MHz> datarate=<val> ssi_signal=<val> frame=<frame hexdump> */
|
|
|
|
+
|
|
|
|
+ wpa_printf(MSG_DEBUG, "External MGMT RX process: %s", cmd);
|
|
|
|
+
|
|
|
|
+ pos = cmd;
|
|
|
|
+ param = os_strstr(pos, "freq=");
|
|
|
|
+ if (param) {
|
|
|
|
+ param += 5;
|
|
|
|
+ freq = atoi(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ param = os_strstr(pos, " datarate=");
|
|
|
|
+ if (param) {
|
|
|
|
+ param += 10;
|
|
|
|
+ datarate = atoi(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ param = os_strstr(pos, " ssi_signal=");
|
|
|
|
+ if (param) {
|
|
|
|
+ param += 12;
|
|
|
|
+ ssi_signal = atoi(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ param = os_strstr(pos, " frame=");
|
|
|
|
+ if (param == NULL)
|
|
|
|
+ return -1;
|
|
|
|
+ param += 7;
|
|
|
|
+
|
|
|
|
+ len = os_strlen(param);
|
|
|
|
+ if (len & 1)
|
|
|
|
+ return -1;
|
|
|
|
+ len /= 2;
|
|
|
|
+
|
|
|
|
+ buf = os_malloc(len);
|
|
|
|
+ if (buf == NULL)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ if (hexstr2bin(param, buf, len) < 0) {
|
|
|
|
+ os_free(buf);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ os_memset(&event, 0, sizeof(event));
|
|
|
|
+ event.rx_mgmt.freq = freq;
|
|
|
|
+ event.rx_mgmt.frame = buf;
|
|
|
|
+ event.rx_mgmt.frame_len = len;
|
|
|
|
+ event.rx_mgmt.ssi_signal = ssi_signal;
|
|
|
|
+ event.rx_mgmt.datarate = datarate;
|
|
|
|
+ hapd->ext_mgmt_frame_handling = 0;
|
|
|
|
+ wpa_supplicant_event(hapd, EVENT_RX_MGMT, &event);
|
|
|
|
+ hapd->ext_mgmt_frame_handling = 1;
|
|
|
|
+
|
|
|
|
+ os_free(buf);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
static int hostapd_ctrl_iface_eapol_rx(struct hostapd_data *hapd, char *cmd)
|
|
static int hostapd_ctrl_iface_eapol_rx(struct hostapd_data *hapd, char *cmd)
|
|
{
|
|
{
|
|
char *pos;
|
|
char *pos;
|
|
@@ -2517,6 +2587,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
|
|
} else if (os_strncmp(buf, "MGMT_TX ", 8) == 0) {
|
|
} else if (os_strncmp(buf, "MGMT_TX ", 8) == 0) {
|
|
if (hostapd_ctrl_iface_mgmt_tx(hapd, buf + 8))
|
|
if (hostapd_ctrl_iface_mgmt_tx(hapd, buf + 8))
|
|
reply_len = -1;
|
|
reply_len = -1;
|
|
|
|
+ } else if (os_strncmp(buf, "MGMT_RX_PROCESS ", 16) == 0) {
|
|
|
|
+ if (hostapd_ctrl_iface_mgmt_rx_process(hapd, buf + 16) < 0)
|
|
|
|
+ reply_len = -1;
|
|
} else if (os_strncmp(buf, "EAPOL_RX ", 9) == 0) {
|
|
} else if (os_strncmp(buf, "EAPOL_RX ", 9) == 0) {
|
|
if (hostapd_ctrl_iface_eapol_rx(hapd, buf + 9) < 0)
|
|
if (hostapd_ctrl_iface_eapol_rx(hapd, buf + 9) < 0)
|
|
reply_len = -1;
|
|
reply_len = -1;
|