BSD: Driver does not need to know about both wpa and hostap contexts

It will either be one or the other.
Fold hapd into ctx to match other drivers.

Signed-off-by: Roy Marples <roy@marples.name>
This commit is contained in:
Roy Marples 2020-01-28 16:58:26 +00:00 committed by Jouni Malinen
parent aad414e956
commit d20b34b439

View file

@ -59,14 +59,13 @@ struct bsd_driver_global {
struct bsd_driver_data { struct bsd_driver_data {
struct dl_list list; struct dl_list list;
struct bsd_driver_global *global; struct bsd_driver_global *global;
struct hostapd_data *hapd; /* back pointer */ void *ctx;
struct l2_packet_data *sock_xmit;/* raw packet xmit socket */ struct l2_packet_data *sock_xmit;/* raw packet xmit socket */
char ifname[IFNAMSIZ+1]; /* interface name */ char ifname[IFNAMSIZ+1]; /* interface name */
int flags; int flags;
unsigned int ifindex; /* interface index */ unsigned int ifindex; /* interface index */
int if_removed; /* has the interface been removed? */ int if_removed; /* has the interface been removed? */
void *ctx;
struct wpa_driver_capa capa; /* driver capability */ struct wpa_driver_capa capa; /* driver capability */
int is_ap; /* Access point mode */ int is_ap; /* Access point mode */
int prev_roaming; /* roaming state to restore on deinit */ int prev_roaming; /* roaming state to restore on deinit */
@ -816,14 +815,14 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
break; break;
case RTM_IEEE80211_LEAVE: case RTM_IEEE80211_LEAVE:
leave = (struct ieee80211_leave_event *) &ifan[1]; leave = (struct ieee80211_leave_event *) &ifan[1];
drv_event_disassoc(drv->hapd, leave->iev_addr); drv_event_disassoc(drv->ctx, leave->iev_addr);
break; break;
case RTM_IEEE80211_JOIN: case RTM_IEEE80211_JOIN:
#ifdef RTM_IEEE80211_REJOIN #ifdef RTM_IEEE80211_REJOIN
case RTM_IEEE80211_REJOIN: case RTM_IEEE80211_REJOIN:
#endif #endif
join = (struct ieee80211_join_event *) &ifan[1]; join = (struct ieee80211_join_event *) &ifan[1];
bsd_new_sta(drv, drv->hapd, join->iev_addr); bsd_new_sta(drv, drv->ctx, join->iev_addr);
break; break;
case RTM_IEEE80211_REPLAY: case RTM_IEEE80211_REPLAY:
/* ignore */ /* ignore */
@ -837,7 +836,7 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
os_memset(&data, 0, sizeof(data)); os_memset(&data, 0, sizeof(data));
data.michael_mic_failure.unicast = 1; data.michael_mic_failure.unicast = 1;
data.michael_mic_failure.src = mic->iev_src; data.michael_mic_failure.src = mic->iev_src;
wpa_supplicant_event(drv->hapd, wpa_supplicant_event(drv->ctx,
EVENT_MICHAEL_MIC_FAILURE, &data); EVENT_MICHAEL_MIC_FAILURE, &data);
break; break;
} }
@ -849,7 +848,7 @@ static void
handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len) handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
{ {
struct bsd_driver_data *drv = ctx; struct bsd_driver_data *drv = ctx;
drv_event_eapol_rx(drv->hapd, src_addr, buf, len); drv_event_eapol_rx(drv->ctx, src_addr, buf, len);
} }
static void * static void *
@ -870,7 +869,7 @@ bsd_init(struct hostapd_data *hapd, struct wpa_init_params *params)
goto bad; goto bad;
} }
drv->hapd = hapd; drv->ctx = hapd;
drv->global = params->global_priv; drv->global = params->global_priv;
os_strlcpy(drv->ifname, params->ifname, sizeof(drv->ifname)); os_strlcpy(drv->ifname, params->ifname, sizeof(drv->ifname));