#include "priv_netlink.h"
#include "ieee802_11_defs.h"
#include "../../hostapd/hostapd.h"
-#include "../../hostapd/config.h"
#include "../../hostapd/hw_features.h"
#include "../../hostapd/sta_flags.h"
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)
}
-static int hostap_send_mgmt_frame(void *priv, const void *msg, size_t len)
+static int hostap_send_mlme(void *priv, const u8 *msg, size_t len)
{
struct hostap_driver_data *drv = priv;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) msg;
pos += 2;
memcpy(pos, data, data_len);
- res = hostap_send_mgmt_frame(drv, (u8 *) hdr, len);
- free(hdr);
-
+ res = hostap_send_mlme(drv, (u8 *) hdr, len);
if (res < 0) {
- perror("hostapd_send_eapol: send");
- printf("hostapd_send_eapol - packet len: %lu - failed\n",
- (unsigned long) len);
+ wpa_printf(MSG_ERROR, "hostap_send_eapol - packet len: %lu - "
+ "failed: %d (%s)",
+ (unsigned long) len, errno, strerror(errno));
}
+ free(hdr);
return res;
}
}
-static void * hostap_init(struct hostapd_data *hapd)
+static void * hostap_init(struct hostapd_data *hapd,
+ struct wpa_init_params *params)
{
struct hostap_driver_data *drv;
drv->hapd = hapd;
drv->ioctl_sock = drv->sock = -1;
- memcpy(drv->iface, hapd->conf->iface, sizeof(drv->iface));
+ memcpy(drv->iface, params->ifname, sizeof(drv->iface));
drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
if (drv->ioctl_sock < 0) {
}
-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;
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_mgmt_frame(drv, &mgmt, IEEE80211_HDRLEN +
- sizeof(mgmt.u.deauth));
+ 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;
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_mgmt_frame(drv, &mgmt, IEEE80211_HDRLEN +
- sizeof(mgmt.u.disassoc));
+ return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
+ sizeof(mgmt.u.disassoc));
}
.sta_disassoc = hostap_sta_disassoc,
.sta_remove = hostap_sta_remove,
.hapd_set_ssid = hostap_set_ssid,
- .send_mgmt_frame = hostap_send_mgmt_frame,
+ .send_mlme = hostap_send_mlme,
.sta_add = hostap_sta_add,
.get_inact_sec = hostap_get_inact_sec,
.sta_clear_stats = hostap_sta_clear_stats,