driver_wired: Move STA entry processing away from driver wrapper
Get rid of hostapd/sta_info.h dependency by introducing a new driver callback function for hostapd.
This commit is contained in:
parent
7e683ceeb4
commit
0531006644
3 changed files with 25 additions and 24 deletions
|
@ -237,6 +237,27 @@ void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
|
|||
}
|
||||
|
||||
|
||||
int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr)
|
||||
{
|
||||
struct sta_info *sta = ap_get_sta(hapd, addr);
|
||||
if (sta)
|
||||
return 0;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
|
||||
" - adding a new STA", MAC2STR(addr));
|
||||
sta = ap_sta_add(hapd, addr);
|
||||
if (sta) {
|
||||
hostapd_new_assoc_sta(hapd, sta, 0);
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
|
||||
MAC2STR(addr));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
||||
const u8 *ie, size_t ielen)
|
||||
{
|
||||
|
|
|
@ -1918,6 +1918,7 @@ void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
|
|||
const u8 *buf, size_t len, int ack);
|
||||
void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
|
||||
const struct ieee80211_hdr *hdr, size_t len);
|
||||
int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr);
|
||||
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
||||
const u8 *ie, size_t ielen);
|
||||
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* WPA Supplicant - wired Ethernet driver interface
|
||||
* Copyright (c) 2005-2007, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2004, Gunter Burchardt <tira@isx.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -30,7 +30,6 @@
|
|||
|
||||
#ifdef HOSTAPD
|
||||
#include "eloop.h"
|
||||
#include "../../hostapd/sta_info.h"
|
||||
#endif /* HOSTAPD */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -94,26 +93,6 @@ struct dhcp_message {
|
|||
};
|
||||
|
||||
|
||||
static void wired_possible_new_sta(struct hostapd_data *hapd, u8 *addr)
|
||||
{
|
||||
struct sta_info *sta;
|
||||
|
||||
sta = ap_get_sta(hapd, addr);
|
||||
if (sta)
|
||||
return;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
|
||||
" - adding a new STA", MAC2STR(addr));
|
||||
sta = ap_sta_add(hapd, addr);
|
||||
if (sta) {
|
||||
hostapd_new_assoc_sta(hapd, sta, 0);
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
|
||||
MAC2STR(addr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void handle_data(struct hostapd_data *hapd, unsigned char *buf,
|
||||
size_t len)
|
||||
{
|
||||
|
@ -135,7 +114,7 @@ static void handle_data(struct hostapd_data *hapd, unsigned char *buf,
|
|||
case ETH_P_PAE:
|
||||
wpa_printf(MSG_MSGDUMP, "Received EAPOL packet");
|
||||
sa = hdr->src;
|
||||
wired_possible_new_sta(hapd, sa);
|
||||
hostapd_notif_new_sta(hapd, sa);
|
||||
|
||||
pos = (u8 *) (hdr + 1);
|
||||
left = len - sizeof(*hdr);
|
||||
|
@ -193,7 +172,7 @@ static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
|
|||
wpa_printf(MSG_MSGDUMP, "Got DHCP broadcast packet from " MACSTR,
|
||||
MAC2STR(mac_address));
|
||||
|
||||
wired_possible_new_sta(hapd, mac_address);
|
||||
hostapd_notif_new_sta(hapd, mac_address);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue