mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-12-01 11:48:23 -05:00
Replace hostapd_notif_new_sta() with new driver event, EVENT_NEW_STA
This commit is contained in:
parent
b38ddb0c50
commit
a70a5d6d06
@ -31,7 +31,7 @@
|
|||||||
#include "ap_config.h"
|
#include "ap_config.h"
|
||||||
|
|
||||||
|
|
||||||
int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr)
|
static int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr)
|
||||||
{
|
{
|
||||||
struct sta_info *sta = ap_get_sta(hapd, addr);
|
struct sta_info *sta = ap_get_sta(hapd, addr);
|
||||||
if (sta)
|
if (sta)
|
||||||
@ -395,6 +395,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
|||||||
data->rx_probe_req.ie,
|
data->rx_probe_req.ie,
|
||||||
data->rx_probe_req.ie_len);
|
data->rx_probe_req.ie_len);
|
||||||
break;
|
break;
|
||||||
|
case EVENT_NEW_STA:
|
||||||
|
hostapd_notif_new_sta(hapd, data->new_sta.addr);
|
||||||
default:
|
default:
|
||||||
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
|
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
|
||||||
break;
|
break;
|
||||||
|
@ -1871,7 +1871,18 @@ enum wpa_event_type {
|
|||||||
* in station mode. In AP mode, Probe Request frames should always be
|
* in station mode. In AP mode, Probe Request frames should always be
|
||||||
* reported.
|
* reported.
|
||||||
*/
|
*/
|
||||||
EVENT_RX_PROBE_REQ
|
EVENT_RX_PROBE_REQ,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EVENT_NEW_STA - New wired device noticed
|
||||||
|
*
|
||||||
|
* This event is used to indicate that a new device has been detected
|
||||||
|
* in a network that does not use association-like functionality (i.e.,
|
||||||
|
* mainly wired Ethernet). This can be used to start EAPOL
|
||||||
|
* authenticator when receiving a frame from a device. The address of
|
||||||
|
* the device is included in union wpa_event_data::new_sta.
|
||||||
|
*/
|
||||||
|
EVENT_NEW_STA
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -2192,6 +2203,13 @@ union wpa_event_data {
|
|||||||
*/
|
*/
|
||||||
size_t ie_len;
|
size_t ie_len;
|
||||||
} rx_probe_req;
|
} rx_probe_req;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct new_sta - Data for EVENT_NEW_STA events
|
||||||
|
*/
|
||||||
|
struct new_sta {
|
||||||
|
const u8 *addr;
|
||||||
|
} new_sta;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2235,7 +2253,6 @@ void wpa_scan_sort_results(struct wpa_scan_results *res);
|
|||||||
|
|
||||||
/* hostapd functions for driver wrappers */
|
/* hostapd functions for driver wrappers */
|
||||||
|
|
||||||
int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr);
|
|
||||||
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
||||||
const u8 *ie, size_t ielen);
|
const u8 *ie, size_t ielen);
|
||||||
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
||||||
|
@ -118,6 +118,7 @@ static void handle_data(void *ctx, unsigned char *buf, size_t len)
|
|||||||
struct ieee8023_hdr *hdr;
|
struct ieee8023_hdr *hdr;
|
||||||
u8 *pos, *sa;
|
u8 *pos, *sa;
|
||||||
size_t left;
|
size_t left;
|
||||||
|
union wpa_event_data event;
|
||||||
|
|
||||||
/* must contain at least ieee8023_hdr 6 byte source, 6 byte dest,
|
/* must contain at least ieee8023_hdr 6 byte source, 6 byte dest,
|
||||||
* 2 byte ethertype */
|
* 2 byte ethertype */
|
||||||
@ -133,7 +134,9 @@ static void handle_data(void *ctx, unsigned char *buf, size_t len)
|
|||||||
case ETH_P_PAE:
|
case ETH_P_PAE:
|
||||||
wpa_printf(MSG_MSGDUMP, "Received EAPOL packet");
|
wpa_printf(MSG_MSGDUMP, "Received EAPOL packet");
|
||||||
sa = hdr->src;
|
sa = hdr->src;
|
||||||
hostapd_notif_new_sta(ctx, sa);
|
os_memset(&event, 0, sizeof(event));
|
||||||
|
event.new_sta.addr = sa;
|
||||||
|
wpa_supplicant_event(ctx, EVENT_NEW_STA, &event);
|
||||||
|
|
||||||
pos = (u8 *) (hdr + 1);
|
pos = (u8 *) (hdr + 1);
|
||||||
left = len - sizeof(*hdr);
|
left = len - sizeof(*hdr);
|
||||||
@ -167,11 +170,11 @@ static void handle_read(int sock, void *eloop_ctx, void *sock_ctx)
|
|||||||
|
|
||||||
static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
|
static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
|
||||||
{
|
{
|
||||||
#ifdef HOSTAPD
|
|
||||||
int len;
|
int len;
|
||||||
unsigned char buf[3000];
|
unsigned char buf[3000];
|
||||||
struct dhcp_message *msg;
|
struct dhcp_message *msg;
|
||||||
u8 *mac_address;
|
u8 *mac_address;
|
||||||
|
union wpa_event_data event;
|
||||||
|
|
||||||
len = recv(sock, buf, sizeof(buf), 0);
|
len = recv(sock, buf, sizeof(buf), 0);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
@ -191,8 +194,9 @@ static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
|
|||||||
wpa_printf(MSG_MSGDUMP, "Got DHCP broadcast packet from " MACSTR,
|
wpa_printf(MSG_MSGDUMP, "Got DHCP broadcast packet from " MACSTR,
|
||||||
MAC2STR(mac_address));
|
MAC2STR(mac_address));
|
||||||
|
|
||||||
hostapd_notif_new_sta(eloop_ctx, mac_address);
|
os_memset(&event, 0, sizeof(event));
|
||||||
#endif /* HOSTAPD */
|
event.new_sta.addr = mac_address;
|
||||||
|
wpa_supplicant_event(eloop_ctx, EVENT_NEW_STA, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user