Move struct hostapd_frame_info definition away from driver API
This is internal data structure for hostapd/AP functionality and does not need to be defined in driver.h.
This commit is contained in:
parent
3af1f9cb14
commit
2a8b74163e
7 changed files with 37 additions and 34 deletions
|
@ -270,15 +270,15 @@ static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
|
|||
}
|
||||
|
||||
|
||||
static void hostapd_mgmt_rx(struct hostapd_data *hapd, const u8 *buf,
|
||||
size_t len, struct hostapd_frame_info *fi)
|
||||
static void hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt)
|
||||
{
|
||||
struct hostapd_iface *iface = hapd->iface;
|
||||
const struct ieee80211_hdr *hdr;
|
||||
const u8 *bssid;
|
||||
struct hostapd_frame_info fi;
|
||||
|
||||
hdr = (const struct ieee80211_hdr *) buf;
|
||||
bssid = get_hdr_bssid(hdr, len);
|
||||
hdr = (const struct ieee80211_hdr *) rx_mgmt->frame;
|
||||
bssid = get_hdr_bssid(hdr, rx_mgmt->frame_len);
|
||||
if (bssid == NULL)
|
||||
return;
|
||||
|
||||
|
@ -298,12 +298,17 @@ static void hostapd_mgmt_rx(struct hostapd_data *hapd, const u8 *buf,
|
|||
return;
|
||||
}
|
||||
|
||||
os_memset(&fi, 0, sizeof(fi));
|
||||
fi.datarate = rx_mgmt->datarate;
|
||||
fi.ssi_signal = rx_mgmt->ssi_signal;
|
||||
|
||||
if (hapd == HAPD_BROADCAST) {
|
||||
size_t i;
|
||||
for (i = 0; i < iface->num_bss; i++)
|
||||
ieee802_11_mgmt(iface->bss[i], buf, len, fi);
|
||||
ieee802_11_mgmt(iface->bss[i], rx_mgmt->frame,
|
||||
rx_mgmt->frame_len, &fi);
|
||||
} else
|
||||
ieee802_11_mgmt(hapd, buf, len, fi);
|
||||
ieee802_11_mgmt(hapd, rx_mgmt->frame, rx_mgmt->frame_len, &fi);
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,8 +387,7 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
|
|||
data->rx_from_unknown.len);
|
||||
break;
|
||||
case EVENT_RX_MGMT:
|
||||
hostapd_mgmt_rx(hapd, data->rx_mgmt.frame,
|
||||
data->rx_mgmt.frame_len, data->rx_mgmt.fi);
|
||||
hostapd_mgmt_rx(hapd, &data->rx_mgmt);
|
||||
break;
|
||||
#endif /* NEED_AP_MLME */
|
||||
case EVENT_RX_PROBE_REQ:
|
||||
|
|
|
@ -40,6 +40,12 @@ struct hostapd_rate_data {
|
|||
int flags; /* HOSTAPD_RATE_ flags */
|
||||
};
|
||||
|
||||
struct hostapd_frame_info {
|
||||
u32 channel;
|
||||
u32 datarate;
|
||||
u32 ssi_signal;
|
||||
};
|
||||
|
||||
|
||||
struct hostapd_driver_ops {
|
||||
int (*set_ap_wps_ie)(struct hostapd_data *hapd,
|
||||
|
|
|
@ -1957,7 +1957,8 @@ union wpa_event_data {
|
|||
struct rx_mgmt {
|
||||
const u8 *frame;
|
||||
size_t frame_len;
|
||||
struct hostapd_frame_info *fi;
|
||||
u32 datarate;
|
||||
u32 ssi_signal;
|
||||
} rx_mgmt;
|
||||
|
||||
/**
|
||||
|
@ -2057,12 +2058,6 @@ void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
|||
void hostapd_eapol_receive(struct hostapd_data *hapd, const u8 *sa,
|
||||
const u8 *buf, size_t len);
|
||||
|
||||
struct hostapd_frame_info {
|
||||
u32 channel;
|
||||
u32 datarate;
|
||||
u32 ssi_signal;
|
||||
};
|
||||
|
||||
struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
|
||||
const u8 *addr);
|
||||
|
||||
|
|
|
@ -2726,8 +2726,7 @@ static void from_unknown_sta(struct wpa_driver_nl80211_data *drv,
|
|||
|
||||
|
||||
static void handle_frame(struct wpa_driver_nl80211_data *drv,
|
||||
u8 *buf, size_t len,
|
||||
struct hostapd_frame_info *hfi)
|
||||
u8 *buf, size_t len, int datarate, int ssi_signal)
|
||||
{
|
||||
struct ieee80211_hdr *hdr;
|
||||
u16 fc;
|
||||
|
@ -2741,7 +2740,8 @@ static void handle_frame(struct wpa_driver_nl80211_data *drv,
|
|||
os_memset(&event, 0, sizeof(event));
|
||||
event.rx_mgmt.frame = buf;
|
||||
event.rx_mgmt.frame_len = len;
|
||||
event.rx_mgmt.fi = hfi;
|
||||
event.rx_mgmt.datarate = datarate;
|
||||
event.rx_mgmt.ssi_signal = ssi_signal;
|
||||
wpa_supplicant_event(drv->ctx, EVENT_RX_MGMT, &event);
|
||||
break;
|
||||
case WLAN_FC_TYPE_CTRL:
|
||||
|
@ -2763,7 +2763,7 @@ static void handle_monitor_read(int sock, void *eloop_ctx, void *sock_ctx)
|
|||
unsigned char buf[3000];
|
||||
struct ieee80211_radiotap_iterator iter;
|
||||
int ret;
|
||||
struct hostapd_frame_info hfi;
|
||||
int datarate = 0, ssi_signal = 0;
|
||||
int injected = 0, failed = 0, rxflags = 0;
|
||||
|
||||
len = recv(sock, buf, sizeof(buf), 0);
|
||||
|
@ -2777,8 +2777,6 @@ static void handle_monitor_read(int sock, void *eloop_ctx, void *sock_ctx)
|
|||
return;
|
||||
}
|
||||
|
||||
memset(&hfi, 0, sizeof(hfi));
|
||||
|
||||
while (1) {
|
||||
ret = ieee80211_radiotap_iterator_next(&iter);
|
||||
if (ret == -ENOENT)
|
||||
|
@ -2803,15 +2801,13 @@ static void handle_monitor_read(int sock, void *eloop_ctx, void *sock_ctx)
|
|||
case IEEE80211_RADIOTAP_DATA_RETRIES:
|
||||
break;
|
||||
case IEEE80211_RADIOTAP_CHANNEL:
|
||||
/* TODO convert from freq/flags to channel number
|
||||
hfi.channel = XXX;
|
||||
*/
|
||||
/* TODO: convert from freq/flags to channel number */
|
||||
break;
|
||||
case IEEE80211_RADIOTAP_RATE:
|
||||
hfi.datarate = *iter.this_arg * 5;
|
||||
datarate = *iter.this_arg * 5;
|
||||
break;
|
||||
case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
|
||||
hfi.ssi_signal = *iter.this_arg;
|
||||
ssi_signal = *iter.this_arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2821,7 +2817,7 @@ static void handle_monitor_read(int sock, void *eloop_ctx, void *sock_ctx)
|
|||
|
||||
if (!injected)
|
||||
handle_frame(drv, buf + iter.max_length,
|
||||
len - iter.max_length, &hfi);
|
||||
len - iter.max_length, datarate, ssi_signal);
|
||||
else
|
||||
handle_tx_callback(drv->ctx, buf + iter.max_length,
|
||||
len - iter.max_length, !failed);
|
||||
|
|
|
@ -262,12 +262,16 @@ void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
|
|||
}
|
||||
|
||||
|
||||
void ap_mgmt_rx(void *ctx, const u8 *buf, size_t len,
|
||||
struct hostapd_frame_info *fi)
|
||||
void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt)
|
||||
{
|
||||
#ifdef NEED_AP_MLME
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
ieee802_11_mgmt(wpa_s->ap_iface->bss[0], buf, len, fi);
|
||||
struct hostapd_frame_info fi;
|
||||
os_memset(&fi, 0, sizeof(fi));
|
||||
fi.datarate = rx_mgmt->datarate;
|
||||
fi.ssi_signal = rx_mgmt->ssi_signal;
|
||||
ieee802_11_mgmt(wpa_s->ap_iface->bss[0], rx_mgmt->frame,
|
||||
rx_mgmt->frame_len, &fi);
|
||||
#endif /* NEED_AP_MLME */
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ void ap_tx_status(void *ctx, const u8 *addr,
|
|||
const u8 *buf, size_t len, int ack);
|
||||
void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
|
||||
size_t len);
|
||||
void ap_mgmt_rx(void *ctx, const u8 *buf, size_t len,
|
||||
struct hostapd_frame_info *fi);
|
||||
void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt);
|
||||
void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok);
|
||||
|
||||
#endif /* AP_H */
|
||||
|
|
|
@ -1500,8 +1500,7 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
|
|||
case EVENT_RX_MGMT:
|
||||
if (wpa_s->ap_iface == NULL)
|
||||
break;
|
||||
ap_mgmt_rx(wpa_s, data->rx_mgmt.frame,
|
||||
data->rx_mgmt.frame_len, data->rx_mgmt.fi);
|
||||
ap_mgmt_rx(wpa_s, &data->rx_mgmt);
|
||||
break;
|
||||
#endif /* CONFIG_AP */
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
|
|
Loading…
Reference in a new issue