diff options
Diffstat (limited to 'freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c')
-rw-r--r-- | freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c | 121 |
1 files changed, 64 insertions, 57 deletions
diff --git a/freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c b/freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c index c7bcfef1..b9c92d40 100644 --- a/freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c +++ b/freebsd/contrib/wpa/wpa_supplicant/ctrl_iface.c @@ -10,10 +10,10 @@ #include "utils/includes.h" #ifdef CONFIG_TESTING_OPTIONS -#include <net/ethernet.h> #include <netinet/ip.h> #endif /* CONFIG_TESTING_OPTIONS */ +#include <net/ethernet.h> #include "utils/common.h" #include "utils/eloop.h" #include "utils/uuid.h" @@ -3131,6 +3131,49 @@ static int wpa_supplicant_ctrl_iface_mesh_peer_add( return wpas_mesh_peer_add(wpa_s, addr, duration); } + +static int wpa_supplicant_ctrl_iface_mesh_link_probe( + struct wpa_supplicant *wpa_s, char *cmd) +{ + struct ether_header *eth; + u8 addr[ETH_ALEN]; + u8 *buf; + char *pos; + size_t payload_len = 0, len; + int ret = -1; + + if (hwaddr_aton(cmd, addr)) + return -1; + + pos = os_strstr(cmd, " payload="); + if (pos) { + pos = pos + 9; + payload_len = os_strlen(pos); + if (payload_len & 1) + return -1; + + payload_len /= 2; + } + + len = ETH_HLEN + payload_len; + buf = os_malloc(len); + if (!buf) + return -1; + + eth = (struct ether_header *) buf; + os_memcpy(eth->ether_dhost, addr, ETH_ALEN); + os_memcpy(eth->ether_shost, wpa_s->own_addr, ETH_ALEN); + eth->ether_type = htons(ETH_P_802_3); + + if (payload_len && hexstr2bin(pos, buf + ETH_HLEN, payload_len) < 0) + goto fail; + + ret = wpa_drv_mesh_link_probe(wpa_s, addr, buf, len); +fail: + os_free(buf); + return -ret; +} + #endif /* CONFIG_MESH */ @@ -5550,17 +5593,17 @@ static int parse_freq(int chwidth, int freq2) if (freq2 < 0) return -1; if (freq2) - return VHT_CHANWIDTH_80P80MHZ; + return CHANWIDTH_80P80MHZ; switch (chwidth) { case 0: case 20: case 40: - return VHT_CHANWIDTH_USE_HT; + return CHANWIDTH_USE_HT; case 80: - return VHT_CHANWIDTH_80MHZ; + return CHANWIDTH_80MHZ; case 160: - return VHT_CHANWIDTH_160MHZ; + return CHANWIDTH_160MHZ; default: wpa_printf(MSG_DEBUG, "Unknown max oper bandwidth: %d", chwidth); @@ -9585,59 +9628,10 @@ static int wpas_ctrl_iface_mac_rand_scan(struct wpa_supplicant *wpa_s, return -1; } - if (!enable) { - wpas_mac_addr_rand_scan_clear(wpa_s, type); - if (wpa_s->pno) { - if (type & MAC_ADDR_RAND_PNO) { - wpas_stop_pno(wpa_s); - wpas_start_pno(wpa_s); - } - } else if (wpa_s->sched_scanning && - (type & MAC_ADDR_RAND_SCHED_SCAN)) { - wpas_scan_restart_sched_scan(wpa_s); - } - return 0; - } - - if ((addr && !mask) || (!addr && mask)) { - wpa_printf(MSG_INFO, - "CTRL: MAC_RAND_SCAN invalid addr/mask combination"); - return -1; - } - - if (addr && mask && (!(mask[0] & 0x01) || (addr[0] & 0x01))) { - wpa_printf(MSG_INFO, - "CTRL: MAC_RAND_SCAN cannot allow multicast address"); - return -1; - } - - if (type & MAC_ADDR_RAND_SCAN) { - if (wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_SCAN, - addr, mask)) - return -1; - } + if (!enable) + return wpas_disable_mac_addr_randomization(wpa_s, type); - if (type & MAC_ADDR_RAND_SCHED_SCAN) { - if (wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_SCHED_SCAN, - addr, mask)) - return -1; - - if (wpa_s->sched_scanning && !wpa_s->pno) - wpas_scan_restart_sched_scan(wpa_s); - } - - if (type & MAC_ADDR_RAND_PNO) { - if (wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_PNO, - addr, mask)) - return -1; - - if (wpa_s->pno) { - wpas_stop_pno(wpa_s); - wpas_start_pno(wpa_s); - } - } - - return 0; + return wpas_enable_mac_addr_randomization(wpa_s, type, addr, mask); } @@ -10173,6 +10167,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "MESH_PEER_ADD ", 14) == 0) { if (wpa_supplicant_ctrl_iface_mesh_peer_add(wpa_s, buf + 14)) reply_len = -1; + } else if (os_strncmp(buf, "MESH_LINK_PROBE ", 16) == 0) { + if (wpa_supplicant_ctrl_iface_mesh_link_probe(wpa_s, buf + 16)) + reply_len = -1; #endif /* CONFIG_MESH */ #ifdef CONFIG_P2P } else if (os_strncmp(buf, "P2P_FIND ", 9) == 0) { @@ -10747,6 +10744,16 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "DPP_PKEX_REMOVE ", 16) == 0) { if (wpas_dpp_pkex_remove(wpa_s, buf + 16) < 0) reply_len = -1; +#ifdef CONFIG_DPP2 + } else if (os_strncmp(buf, "DPP_CONTROLLER_START ", 21) == 0) { + if (wpas_dpp_controller_start(wpa_s, buf + 20) < 0) + reply_len = -1; + } else if (os_strcmp(buf, "DPP_CONTROLLER_START") == 0) { + if (wpas_dpp_controller_start(wpa_s, NULL) < 0) + reply_len = -1; + } else if (os_strcmp(buf, "DPP_CONTROLLER_STOP") == 0) { + dpp_controller_stop(wpa_s->dpp); +#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP */ } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); |