Add own_addr as a parameter to sta_deauth() and sta_disassoc()
This fixes deauth/disassoc frames in secondary BSSes when using multi-BSSID. In addition, it reduces need to dereference struct hostapd_data inside driver wrappers.
This commit is contained in:
parent
7af376e456
commit
731723a5bd
9 changed files with 54 additions and 37 deletions
|
@ -154,7 +154,8 @@ hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr, int reason)
|
|||
{
|
||||
if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
|
||||
return 0;
|
||||
return hapd->driver->sta_deauth(hapd->drv_priv, addr, reason);
|
||||
return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
|
||||
reason);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -162,7 +163,8 @@ hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr, int reason)
|
|||
{
|
||||
if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
|
||||
return 0;
|
||||
return hapd->driver->sta_disassoc(hapd->drv_priv, addr, reason);
|
||||
return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
|
||||
reason);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
|
|
@ -1246,8 +1246,10 @@ struct wpa_driver_ops {
|
|||
int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
|
||||
size_t data_len, int encrypt,
|
||||
const u8 *own_addr);
|
||||
int (*sta_deauth)(void *priv, const u8 *addr, int reason);
|
||||
int (*sta_disassoc)(void *priv, const u8 *addr, int reason);
|
||||
int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason);
|
||||
int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason);
|
||||
int (*sta_remove)(void *priv, const u8 *addr);
|
||||
int (*hapd_get_ssid)(const char *ifname, void *priv, u8 *buf, int len);
|
||||
int (*hapd_set_ssid)(const char *ifname, void *priv, const u8 *buf,
|
||||
|
|
|
@ -86,7 +86,8 @@ struct madwifi_driver_data {
|
|||
struct l2_packet_data *sock_raw; /* raw 802.11 management frames */
|
||||
};
|
||||
|
||||
static int madwifi_sta_deauth(void *priv, const u8 *addr, int reason_code);
|
||||
static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code);
|
||||
|
||||
static int
|
||||
set80211priv(struct madwifi_driver_data *drv, int op, void *data, int len)
|
||||
|
@ -539,7 +540,8 @@ madwifi_flush(void *priv)
|
|||
{
|
||||
u8 allsta[IEEE80211_ADDR_LEN];
|
||||
memset(allsta, 0xff, IEEE80211_ADDR_LEN);
|
||||
return madwifi_sta_deauth(priv, allsta, IEEE80211_REASON_AUTH_LEAVE);
|
||||
return madwifi_sta_deauth(priv, NULL, allsta,
|
||||
IEEE80211_REASON_AUTH_LEAVE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -611,7 +613,8 @@ madwifi_set_opt_ie(const char *ifname, void *priv, const u8 *ie, size_t ie_len)
|
|||
}
|
||||
|
||||
static int
|
||||
madwifi_sta_deauth(void *priv, const u8 *addr, int reason_code)
|
||||
madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code)
|
||||
{
|
||||
struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
@ -634,7 +637,8 @@ madwifi_sta_deauth(void *priv, const u8 *addr, int reason_code)
|
|||
}
|
||||
|
||||
static int
|
||||
madwifi_sta_disassoc(void *priv, const u8 *addr, int reason_code)
|
||||
madwifi_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code)
|
||||
{
|
||||
struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
|
|
@ -59,7 +59,8 @@ struct bsd_driver_data {
|
|||
int wext_sock; /* socket for wireless events */
|
||||
};
|
||||
|
||||
static int bsd_sta_deauth(void *priv, const u8 *addr, int reason_code);
|
||||
static int bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code);
|
||||
|
||||
static int
|
||||
set80211var(struct bsd_driver_data *drv, int op, const void *arg, int arg_len)
|
||||
|
@ -449,7 +450,7 @@ bsd_flush(void *priv)
|
|||
u8 allsta[IEEE80211_ADDR_LEN];
|
||||
|
||||
memset(allsta, 0xff, IEEE80211_ADDR_LEN);
|
||||
return bsd_sta_deauth(priv, allsta, IEEE80211_REASON_AUTH_LEAVE);
|
||||
return bsd_sta_deauth(priv, NULL, allsta, IEEE80211_REASON_AUTH_LEAVE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -482,7 +483,7 @@ bsd_set_opt_ie(const char *ifname, void *priv, const u8 *ie, size_t ie_len)
|
|||
}
|
||||
|
||||
static int
|
||||
bsd_sta_deauth(void *priv, const u8 *addr, int reason_code)
|
||||
bsd_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, int reason_code)
|
||||
{
|
||||
struct bsd_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
@ -497,7 +498,8 @@ bsd_sta_deauth(void *priv, const u8 *addr, int reason_code)
|
|||
}
|
||||
|
||||
static int
|
||||
bsd_sta_disassoc(void *priv, const u8 *addr, int reason_code)
|
||||
bsd_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code)
|
||||
{
|
||||
struct bsd_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
|
|
@ -57,8 +57,6 @@ struct hostap_driver_data {
|
|||
static int hostapd_ioctl(void *priv, struct prism2_hostapd_param *param,
|
||||
int len);
|
||||
static int hostap_set_iface_flags(void *priv, int dev_up);
|
||||
static int hostap_sta_disassoc(void *priv, const u8 *addr, int reason);
|
||||
static int hostap_sta_deauth(void *priv, const u8 *addr, int reason);
|
||||
|
||||
static void handle_data(struct hostap_driver_data *drv, u8 *buf, size_t len,
|
||||
u16 stype)
|
||||
|
@ -1132,7 +1130,8 @@ static void hostap_driver_deinit(void *priv)
|
|||
}
|
||||
|
||||
|
||||
static int hostap_sta_deauth(void *priv, const u8 *addr, int reason)
|
||||
static int hostap_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason)
|
||||
{
|
||||
struct hostap_driver_data *drv = priv;
|
||||
struct ieee80211_mgmt mgmt;
|
||||
|
@ -1141,15 +1140,16 @@ static int hostap_sta_deauth(void *priv, const u8 *addr, int reason)
|
|||
mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
|
||||
WLAN_FC_STYPE_DEAUTH);
|
||||
memcpy(mgmt.da, addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, own_addr, ETH_ALEN);
|
||||
mgmt.u.deauth.reason_code = host_to_le16(reason);
|
||||
return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
|
||||
sizeof(mgmt.u.deauth));
|
||||
}
|
||||
|
||||
|
||||
static int hostap_sta_disassoc(void *priv, const u8 *addr, int reason)
|
||||
static int hostap_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason)
|
||||
{
|
||||
struct hostap_driver_data *drv = priv;
|
||||
struct ieee80211_mgmt mgmt;
|
||||
|
@ -1158,8 +1158,8 @@ static int hostap_sta_disassoc(void *priv, const u8 *addr, int reason)
|
|||
mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
|
||||
WLAN_FC_STYPE_DISASSOC);
|
||||
memcpy(mgmt.da, addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, own_addr, ETH_ALEN);
|
||||
mgmt.u.disassoc.reason_code = host_to_le16(reason);
|
||||
return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
|
||||
sizeof(mgmt.u.disassoc));
|
||||
|
|
|
@ -91,7 +91,8 @@ struct madwifi_driver_data {
|
|||
struct l2_packet_data *sock_raw; /* raw 802.11 management frames */
|
||||
};
|
||||
|
||||
static int madwifi_sta_deauth(void *priv, const u8 *addr, int reason_code);
|
||||
static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code);
|
||||
|
||||
static int
|
||||
set80211priv(struct madwifi_driver_data *drv, int op, void *data, int len)
|
||||
|
@ -575,7 +576,8 @@ madwifi_flush(void *priv)
|
|||
#ifdef MADWIFI_BSD
|
||||
u8 allsta[IEEE80211_ADDR_LEN];
|
||||
memset(allsta, 0xff, IEEE80211_ADDR_LEN);
|
||||
return madwifi_sta_deauth(priv, allsta, IEEE80211_REASON_AUTH_LEAVE);
|
||||
return madwifi_sta_deauth(priv, NULL, allsta,
|
||||
IEEE80211_REASON_AUTH_LEAVE);
|
||||
#else /* MADWIFI_BSD */
|
||||
return 0; /* XXX */
|
||||
#endif /* MADWIFI_BSD */
|
||||
|
@ -703,7 +705,8 @@ madwifi_set_opt_ie(const char *ifname, void *priv, const u8 *ie, size_t ie_len)
|
|||
}
|
||||
|
||||
static int
|
||||
madwifi_sta_deauth(void *priv, const u8 *addr, int reason_code)
|
||||
madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code)
|
||||
{
|
||||
struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
@ -726,7 +729,8 @@ madwifi_sta_deauth(void *priv, const u8 *addr, int reason_code)
|
|||
}
|
||||
|
||||
static int
|
||||
madwifi_sta_disassoc(void *priv, const u8 *addr, int reason_code)
|
||||
madwifi_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason_code)
|
||||
{
|
||||
struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
|
|
@ -3084,9 +3084,6 @@ static int wpa_driver_nl80211_set_operstate(void *priv, int state)
|
|||
|
||||
static const u8 rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
|
||||
|
||||
static int i802_sta_deauth(void *priv, const u8 *addr, int reason);
|
||||
static int i802_sta_disassoc(void *priv, const u8 *addr, int reason);
|
||||
|
||||
|
||||
static struct i802_bss * get_bss(struct wpa_driver_nl80211_data *drv,
|
||||
int ifindex)
|
||||
|
@ -3898,7 +3895,8 @@ static int i802_sta_clear_stats(void *priv, const u8 *addr)
|
|||
}
|
||||
|
||||
|
||||
static int i802_sta_deauth(void *priv, const u8 *addr, int reason)
|
||||
static int i802_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason)
|
||||
{
|
||||
struct wpa_driver_nl80211_data *drv = priv;
|
||||
struct ieee80211_mgmt mgmt;
|
||||
|
@ -3907,8 +3905,8 @@ static int i802_sta_deauth(void *priv, const u8 *addr, int reason)
|
|||
mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
|
||||
WLAN_FC_STYPE_DEAUTH);
|
||||
memcpy(mgmt.da, addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, own_addr, ETH_ALEN);
|
||||
mgmt.u.deauth.reason_code = host_to_le16(reason);
|
||||
return wpa_driver_nl80211_send_mlme(drv, (u8 *) &mgmt,
|
||||
IEEE80211_HDRLEN +
|
||||
|
@ -3916,7 +3914,8 @@ static int i802_sta_deauth(void *priv, const u8 *addr, int reason)
|
|||
}
|
||||
|
||||
|
||||
static int i802_sta_disassoc(void *priv, const u8 *addr, int reason)
|
||||
static int i802_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason)
|
||||
{
|
||||
struct wpa_driver_nl80211_data *drv = priv;
|
||||
struct ieee80211_mgmt mgmt;
|
||||
|
@ -3925,8 +3924,8 @@ static int i802_sta_disassoc(void *priv, const u8 *addr, int reason)
|
|||
mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
|
||||
WLAN_FC_STYPE_DISASSOC);
|
||||
memcpy(mgmt.da, addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, drv->hapd->own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.sa, own_addr, ETH_ALEN);
|
||||
memcpy(mgmt.bssid, own_addr, ETH_ALEN);
|
||||
mgmt.u.disassoc.reason_code = host_to_le16(reason);
|
||||
return wpa_driver_nl80211_send_mlme(drv, (u8 *) &mgmt,
|
||||
IEEE80211_HDRLEN +
|
||||
|
|
|
@ -461,7 +461,8 @@ static int prism54_flush(void *priv)
|
|||
}
|
||||
|
||||
|
||||
static int prism54_sta_deauth(void *priv, const u8 *addr, int reason)
|
||||
static int prism54_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason)
|
||||
{
|
||||
struct prism54_driver_data *drv = priv;
|
||||
pimdev_hdr *hdr;
|
||||
|
@ -486,7 +487,8 @@ static int prism54_sta_deauth(void *priv, const u8 *addr, int reason)
|
|||
}
|
||||
|
||||
|
||||
static int prism54_sta_disassoc(void *priv, const u8 *addr, int reason)
|
||||
static int prism54_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
int reason)
|
||||
{
|
||||
struct prism54_driver_data *drv = priv;
|
||||
pimdev_hdr *hdr;
|
||||
|
|
|
@ -813,7 +813,8 @@ static int test_driver_set_wps_probe_resp_ie(const char *ifname, void *priv,
|
|||
}
|
||||
|
||||
|
||||
static int test_driver_sta_deauth(void *priv, const u8 *addr, int reason)
|
||||
static int test_driver_sta_deauth(void *priv, const u8 *own_addr,
|
||||
const u8 *addr, int reason)
|
||||
{
|
||||
struct test_driver_data *drv = priv;
|
||||
struct test_client_socket *cli;
|
||||
|
@ -836,7 +837,8 @@ static int test_driver_sta_deauth(void *priv, const u8 *addr, int reason)
|
|||
}
|
||||
|
||||
|
||||
static int test_driver_sta_disassoc(void *priv, const u8 *addr, int reason)
|
||||
static int test_driver_sta_disassoc(void *priv, const u8 *own_addr,
|
||||
const u8 *addr, int reason)
|
||||
{
|
||||
struct test_driver_data *drv = priv;
|
||||
struct test_client_socket *cli;
|
||||
|
|
Loading…
Reference in a new issue