#include <netlink/genl/ctrl.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
-#include <linux/nl80211.h>
+#include "nl80211_copy.h"
#include <net/if.h>
-#include <linux/if_packet.h>
-#include <linux/if_ether.h> /* The L2 protocols */
+#include <netpacket/packet.h>
#include "wireless_copy.h"
#include <net/if_arp.h>
#include "hostapd.h"
#include "driver.h"
-#include "ieee802_1x.h"
#include "eloop.h"
-#include "ieee802_11.h"
-#include "sta_info.h"
#include "hw_features.h"
#include "mlme.h"
#include "radiotap.h"
#include "radiotap_iter.h"
+#include "ieee802_11_defs.h"
+
+#ifdef CONFIG_LIBNL20
+/* libnl 2.0 compatibility code */
+#define nl_handle_alloc_cb nl_socket_alloc_cb
+#define nl_handle_destroy nl_socket_free
+#endif /* CONFIG_LIBNL20 */
+
+static const u8 rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
enum ieee80211_msg_type {
ieee80211_msg_normal = 0,
int dtim_period, beacon_int;
unsigned int beacon_set:1;
unsigned int ieee802_1x_active:1;
+
+ int last_freq;
+ int last_freq_ht;
};
+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 void add_ifidx(struct i802_driver_data *drv, int ifidx)
{
int i;
0, NL80211_CMD_SET_KEY, 0);
NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, idx);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
-#ifdef NL80211_MFP_PENDING
if (strcmp(alg, "IGTK") == 0)
NLA_PUT_FLAG(msg, NL80211_ATTR_KEY_DEFAULT_MGMT);
else
NLA_PUT_FLAG(msg, NL80211_ATTR_KEY_DEFAULT);
-#else /* NL80211_MFP_PENDING */
- NLA_PUT_FLAG(msg, NL80211_ATTR_KEY_DEFAULT);
-#endif /* NL80211_MFP_PENDING */
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret == -ENOENT)
if (ret < 0)
return ret;
- if (strcmp(alg, "IGTK") == 0) {
- ret = nl_set_encr(drv->monitor_ifidx, drv, alg, addr, idx, key,
- key_len, txkey);
- }
-
return ret;
}
static int i802_set_rate_sets(void *priv, int *supp_rates, int *basic_rates,
int mode)
{
-#ifdef NL80211_ATTR_BSS_BASIC_RATES
struct i802_driver_data *drv = priv;
struct nl_msg *msg;
u8 rates[NL80211_MAX_SUPP_RATES];
return send_and_recv_msgs(drv, msg, NULL, NULL);
nla_put_failure:
return -ENOBUFS;
-#else /* NL80211_ATTR_BSS_BASIC_RATES */
- return -1;
-#endif /* NL80211_ATTR_BSS_BASIC_RATES */
-}
-
-
-static int i802_set_ssid(const char *ifname, void *priv, const u8 *buf,
- int len)
-{
- struct i802_driver_data *drv = priv;
- struct iwreq iwr;
-
- memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, ifname, IFNAMSIZ);
- iwr.u.essid.flags = 1; /* SSID active */
- iwr.u.essid.pointer = (caddr_t) buf;
- iwr.u.essid.length = len;
-
- if (ioctl(drv->ioctl_sock, SIOCSIWESSID, &iwr) < 0) {
- perror("ioctl[SIOCSIWESSID]");
- printf("len=%d\n", len);
- return -1;
- }
-
- return 0;
}
static int i802_send_mgmt_frame(void *priv, const void *data, size_t len,
int flags)
{
- return i802_send_frame(priv, data, len, 1, flags);
+ struct ieee80211_mgmt *mgmt;
+ int do_not_encrypt = 0;
+ u16 fc;
+
+ mgmt = (struct ieee80211_mgmt *) data;
+ fc = le_to_host16(mgmt->frame_control);
+
+ if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
+ WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_AUTH) {
+ /*
+ * Only one of the authentication frame types is encrypted.
+ * In order for static WEP encryption to work properly (i.e.,
+ * to not encrypt the frame), we need to tell mac80211 about
+ * the frames that must not be encrypted.
+ */
+ u16 auth_alg = le_to_host16(mgmt->u.auth.auth_alg);
+ u16 auth_trans = le_to_host16(mgmt->u.auth.auth_transaction);
+ if (auth_alg == WLAN_AUTH_OPEN ||
+ (auth_alg == WLAN_AUTH_SHARED_KEY && auth_trans != 3))
+ do_not_encrypt = 1;
+ }
+
+ return i802_send_frame(priv, data, len, !do_not_encrypt, flags);
}
/* Set kernel driver on given frequency (MHz) */
-static int i802_set_freq(void *priv, int mode, int freq)
+static int i802_set_freq2(void *priv, struct hostapd_freq_params *freq)
{
struct i802_driver_data *drv = priv;
- struct iwreq iwr;
-
- memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
- iwr.u.freq.m = freq;
- iwr.u.freq.e = 6;
+ struct nl_msg *msg;
- if (ioctl(drv->ioctl_sock, SIOCSIWFREQ, &iwr) < 0) {
- perror("ioctl[SIOCSIWFREQ]");
+ msg = nlmsg_alloc();
+ if (!msg)
return -1;
+
+ drv->last_freq = freq->freq;
+ drv->last_freq_ht = freq->ht_enabled;
+
+ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+ NL80211_CMD_SET_WIPHY, 0);
+
+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->iface));
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq);
+ if (freq->ht_enabled) {
+ switch (freq->sec_channel_offset) {
+ case -1:
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+ NL80211_CHAN_HT40MINUS);
+ break;
+ case 1:
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+ NL80211_CHAN_HT40PLUS);
+ break;
+ default:
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+ NL80211_CHAN_HT20);
+ break;
+ }
}
- return 0;
+ if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)
+ return 0;
+ nla_put_failure:
+ return -1;
}
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
iwr.u.rts.value = rts;
iwr.u.rts.fixed = 1;
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
if (ioctl(drv->ioctl_sock, SIOCGIWRTS, &iwr) < 0) {
perror("ioctl[SIOCGIWRTS]");
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
iwr.u.frag.value = frag;
iwr.u.frag.fixed = 1;
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
if (ioctl(drv->ioctl_sock, SIOCGIWFRAG, &iwr) < 0) {
perror("ioctl[SIOCGIWFRAG]");
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
iwr.u.retry.value = short_retry;
iwr.u.retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
- if (ioctl(drv->ioctl_sock, SIOCSIWFRAG, &iwr) < 0) {
+ if (ioctl(drv->ioctl_sock, SIOCSIWRETRY, &iwr) < 0) {
perror("ioctl[SIOCSIWRETRY(short)]");
return -1;
}
iwr.u.retry.value = long_retry;
iwr.u.retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
- if (ioctl(drv->ioctl_sock, SIOCSIWFRAG, &iwr) < 0) {
+ if (ioctl(drv->ioctl_sock, SIOCSIWRETRY, &iwr) < 0) {
perror("ioctl[SIOCSIWRETRY(long)]");
return -1;
}
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->hapd->conf->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
iwr.u.retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
if (ioctl(drv->ioctl_sock, SIOCGIWRETRY, &iwr) < 0) {
params->listen_interval);
#ifdef CONFIG_IEEE80211N
-#ifdef NL80211_ATTR_HT_CAPABILITY
if (params->ht_capabilities) {
NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY,
params->ht_capabilities->length,
¶ms->ht_capabilities->data);
}
-#endif /* NL80211_ATTR_HT_CAPABILITY */
#endif /* CONFIG_IEEE80211N */
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (total_flags & WLAN_STA_SHORT_PREAMBLE)
NLA_PUT_FLAG(flags, NL80211_STA_FLAG_SHORT_PREAMBLE);
-#ifdef NL80211_MFP_PENDING
if (total_flags & WLAN_STA_MFP)
NLA_PUT_FLAG(flags, NL80211_STA_FLAG_MFP);
-#endif /* NL80211_MFP_PENDING */
if (nla_put_nested(msg, NL80211_ATTR_STA_FLAGS, flags))
goto nla_put_failure;
}
-static int i802_set_channel_flag(void *priv, int mode, int chan, int flag,
- unsigned char power_level,
- unsigned char antenna_max)
-{
- return -1;
-}
-
-
-static int i802_set_regulatory_domain(void *priv, unsigned int rd)
-{
- return -1;
-}
-
-
static int i802_set_tx_queue_params(void *priv, int queue, int aifs,
int cw_min, int cw_max, int burst_time)
{
-#ifdef NL80211_ATTR_WIPHY_TXQ_PARAMS
struct i802_driver_data *drv = priv;
struct nl_msg *msg;
struct nlattr *txq, *params;
return 0;
nla_put_failure:
return -1;
-#else /* NL80211_ATTR_WIPHY_TXQ_PARAMS */
- return -1;
-#endif /* NL80211_ATTR_WIPHY_TXQ_PARAMS */
}
genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0,
0, NL80211_CMD_NEW_INTERFACE, 0);
- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX,
- if_nametoindex(drv->hapd->conf->iface));
+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->iface));
NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, ifname);
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, iftype);
static int i802_set_bss(void *priv, int cts, int preamble, int slot)
{
-#ifdef NL80211_CMD_SET_BSS
struct i802_driver_data *drv = priv;
struct nl_msg *msg;
return send_and_recv_msgs(drv, msg, NULL, NULL);
nla_put_failure:
return -ENOBUFS;
-#else /* NL80211_CMD_SET_BSS */
- return -1;
-#endif /* NL80211_CMD_SET_BSS */
}
[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
[NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
[NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
+ [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
};
struct nlattr *tb_rate[NL80211_BITRATE_ATTR_MAX + 1];
continue;
mode->channels[idx].freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
- mode->channels[idx].flag |= HOSTAPD_CHAN_W_SCAN |
- HOSTAPD_CHAN_W_ACTIVE_SCAN |
- HOSTAPD_CHAN_W_IBSS;
+ mode->channels[idx].flag = 0;
if (!mode_is_set) {
/* crude heuristic */
mode->channels[idx].chan = mode->channels[idx].freq/5 - 1000;
if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
- mode->channels[idx].flag &= ~HOSTAPD_CHAN_W_SCAN;
+ mode->channels[idx].flag |=
+ HOSTAPD_CHAN_DISABLED;
if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN])
- mode->channels[idx].flag &= ~HOSTAPD_CHAN_W_ACTIVE_SCAN;
+ mode->channels[idx].flag |=
+ HOSTAPD_CHAN_PASSIVE_SCAN;
if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS])
- mode->channels[idx].flag &= ~HOSTAPD_CHAN_W_IBSS;
+ mode->channels[idx].flag |=
+ HOSTAPD_CHAN_NO_IBSS;
+ if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR])
+ mode->channels[idx].flag |=
+ HOSTAPD_CHAN_RADAR;
+
+ if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] &&
+ !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
+ mode->channels[idx].max_tx_power =
+ nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]) / 100;
+
idx++;
}
return NL_SKIP;
}
+static struct hostapd_hw_modes *i802_add_11b(struct hostapd_hw_modes *modes,
+ u16 *num_modes)
+{
+ u16 m;
+ struct hostapd_hw_modes *mode11g = NULL, *nmodes, *mode;
+ int i, mode11g_idx = -1;
+
+ /* If only 802.11g mode is included, use it to construct matching
+ * 802.11b mode data. */
+
+ for (m = 0; m < *num_modes; m++) {
+ if (modes[m].mode == HOSTAPD_MODE_IEEE80211B)
+ return modes; /* 802.11b already included */
+ if (modes[m].mode == HOSTAPD_MODE_IEEE80211G)
+ mode11g_idx = m;
+ }
+
+ if (mode11g_idx < 0)
+ return modes; /* 2.4 GHz band not supported at all */
+
+ nmodes = os_realloc(modes, (*num_modes + 1) * sizeof(*nmodes));
+ if (nmodes == NULL)
+ return modes; /* Could not add 802.11b mode */
+
+ mode = &nmodes[*num_modes];
+ os_memset(mode, 0, sizeof(*mode));
+ (*num_modes)++;
+ modes = nmodes;
+
+ mode->mode = HOSTAPD_MODE_IEEE80211B;
+
+ mode11g = &modes[mode11g_idx];
+ mode->num_channels = mode11g->num_channels;
+ mode->channels = os_malloc(mode11g->num_channels *
+ sizeof(struct hostapd_channel_data));
+ if (mode->channels == NULL) {
+ (*num_modes)--;
+ return modes; /* Could not add 802.11b mode */
+ }
+ os_memcpy(mode->channels, mode11g->channels,
+ mode11g->num_channels * sizeof(struct hostapd_channel_data));
+
+ mode->num_rates = 0;
+ mode->rates = os_malloc(4 * sizeof(struct hostapd_rate_data));
+ if (mode->rates == NULL) {
+ os_free(mode->channels);
+ (*num_modes)--;
+ return modes; /* Could not add 802.11b mode */
+ }
+
+ for (i = 0; i < mode11g->num_rates; i++) {
+ if (mode11g->rates[i].rate > 110 ||
+ mode11g->rates[i].flags &
+ (HOSTAPD_RATE_ERP | HOSTAPD_RATE_OFDM))
+ continue;
+ mode->rates[mode->num_rates] = mode11g->rates[i];
+ mode->num_rates++;
+ if (mode->num_rates == 4)
+ break;
+ }
+
+ if (mode->num_rates == 0) {
+ os_free(mode->channels);
+ os_free(mode->rates);
+ (*num_modes)--;
+ return modes; /* No 802.11b rates */
+ }
+
+ wpa_printf(MSG_DEBUG, "nl80211: Added 802.11b mode based on 802.11g "
+ "information");
+
+ return modes;
+}
+
static struct hostapd_hw_modes *i802_get_hw_feature_data(void *priv,
u16 *num_modes,
u16 *flags)
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->iface));
if (send_and_recv_msgs(drv, msg, phy_info_handler, &result) == 0)
- return result.modes;
+ return i802_add_11b(result.modes, num_modes);
nla_put_failure:
return NULL;
}
}
-static void handle_unknown_sta(struct hostapd_data *hapd, u8 *ta)
+static int i802_set_country(void *priv, const char *country)
{
- struct sta_info *sta;
+ struct i802_driver_data *drv = priv;
+ struct nl_msg *msg;
+ char alpha2[3];
- sta = ap_get_sta(hapd, ta);
- if (!sta || !(sta->flags & WLAN_STA_ASSOC)) {
- printf("Data/PS-poll frame from not associated STA "
- MACSTR "\n", MAC2STR(ta));
- if (sta && (sta->flags & WLAN_STA_AUTH))
- hostapd_sta_disassoc(
- hapd, ta,
- WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
- else
- hostapd_sta_deauth(
- hapd, ta,
- WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
- }
+ msg = nlmsg_alloc();
+ if (!msg)
+ return -ENOMEM;
+
+ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0,
+ 0, NL80211_CMD_REQ_SET_REG, 0);
+
+ alpha2[0] = country[0];
+ alpha2[1] = country[1];
+ alpha2[2] = '\0';
+ NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, alpha2);
+
+ return send_and_recv_msgs(drv, msg, NULL, NULL);
+ nla_put_failure:
+ return -ENOBUFS;
}
{
struct ieee80211_hdr *hdr;
u16 fc, type, stype;
- struct sta_info *sta;
hdr = (struct ieee80211_hdr *) buf;
fc = le_to_host16(hdr->frame_control);
case WLAN_FC_TYPE_MGMT:
wpa_printf(MSG_DEBUG, "MGMT (TX callback) %s",
ok ? "ACK" : "fail");
- ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
+ hostapd_mgmt_tx_cb(hapd, buf, len, stype, ok);
break;
case WLAN_FC_TYPE_CTRL:
wpa_printf(MSG_DEBUG, "CTRL (TX callback) %s",
case WLAN_FC_TYPE_DATA:
wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
ok ? "ACK" : "fail");
- sta = ap_get_sta(hapd, hdr->addr1);
- if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
- wpa_printf(MSG_DEBUG, "STA " MACSTR " %s pending "
- "activity poll", MAC2STR(sta->addr),
- ok ? "ACKed" : "did not ACK");
- if (ok)
- sta->flags &= ~WLAN_STA_PENDING_POLL;
- }
- if (sta)
- ieee802_1x_tx_status(hapd, sta, buf, len, ok);
+ hostapd_tx_status(hapd, hdr->addr1, buf, len, ok);
break;
default:
printf("unknown TX callback frame type %d\n", type);
}
-static void handle_frame(struct hostapd_iface *iface, u8 *buf, size_t len,
+static void handle_frame(struct i802_driver_data *drv,
+ struct hostapd_iface *iface, u8 *buf, size_t len,
struct hostapd_frame_info *hfi,
enum ieee80211_msg_type msg_type)
{
wpa_printf(MSG_MSGDUMP, "MGMT");
if (broadcast_bssid) {
for (i = 0; i < iface->num_bss; i++)
- ieee802_11_mgmt(iface->bss[i], buf, data_len,
+ hostapd_mgmt_rx(iface->bss[i], buf, data_len,
stype, hfi);
} else
- ieee802_11_mgmt(hapd, buf, data_len, stype, hfi);
+ hostapd_mgmt_rx(hapd, buf, data_len, stype, hfi);
break;
case WLAN_FC_TYPE_CTRL:
/* can only get here with PS-Poll frames */
wpa_printf(MSG_DEBUG, "CTRL");
- handle_unknown_sta(hapd, hdr->addr2);
+ hostapd_rx_from_unknown_sta(drv->hapd, hdr->addr2);
break;
case WLAN_FC_TYPE_DATA:
- wpa_printf(MSG_DEBUG, "DATA");
- handle_unknown_sta(hapd, hdr->addr2);
+ hostapd_rx_from_unknown_sta(drv->hapd, hdr->addr2);
break;
}
}
}
if (have_ifidx(drv, lladdr.sll_ifindex))
- ieee802_1x_receive(hapd, lladdr.sll_addr, buf, len);
+ hostapd_eapol_receive(hapd, lladdr.sll_addr, buf, len);
}
else
msg_type = ieee80211_msg_tx_callback_ack;
- handle_frame(hapd->iface, buf + iter.max_length,
+ handle_frame(drv, hapd->iface, buf + iter.max_length,
len - iter.max_length, &hfi, msg_type);
}
struct ifreq ifr;
struct sockaddr_ll addr;
- drv->ioctl_sock = -1;
-
drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
if (drv->ioctl_sock < 0) {
perror("socket[PF_INET,SOCK_DGRAM]");
return -1;
}
+#ifdef CONFIG_LIBNL20
+ if (genl_ctrl_alloc_cache(drv->nl_handle, &drv->nl_cache) < 0) {
+ printf("Failed to allocate generic netlink cache.\n");
+ return -1;
+ }
+#else /* CONFIG_LIBNL20 */
drv->nl_cache = genl_ctrl_alloc_cache(drv->nl_handle);
if (!drv->nl_cache) {
printf("Failed to allocate generic netlink cache.\n");
return -1;
}
+#endif /* CONFIG_LIBNL20 */
drv->nl80211 = genl_ctrl_search_by_name(drv->nl_cache, "nl80211");
if (!drv->nl80211) {
return -1;
if (nl80211_set_master_mode(drv, drv->iface))
- return -1;
+ goto fail1;
if (hostapd_set_iface_flags(drv, drv->iface, 1))
- return -1;
+ goto fail1;
memset(&addr, 0, sizeof(addr));
addr.sll_family = AF_PACKET;
drv->eapol_sock = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_PAE));
if (drv->eapol_sock < 0) {
perror("socket(PF_PACKET, SOCK_DGRAM, ETH_P_PAE)");
- return -1;
+ goto fail1;
}
if (eloop_register_read_sock(drv->eapol_sock, handle_eapol, drv, NULL))
os_strlcpy(ifr.ifr_name, drv->iface, sizeof(ifr.ifr_name));
if (ioctl(drv->ioctl_sock, SIOCGIFHWADDR, &ifr) != 0) {
perror("ioctl(SIOCGIFHWADDR)");
- return -1;
+ goto fail1;
}
if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) {
printf("Invalid HW-addr family 0x%04x\n",
ifr.ifr_hwaddr.sa_family);
- return -1;
+ goto fail1;
}
memcpy(drv->hapd->own_addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
return 0;
+
+fail1:
+ nl80211_remove_iface(drv, drv->monitor_ifidx);
+ return -1;
}
}
pos += 5;
if (hwaddr_aton(pos, addr) == 0) {
- ieee80211_michael_mic_failure(drv->hapd, addr, 1);
+ hostapd_michael_mic_failure(drv->hapd, addr);
} else {
wpa_printf(MSG_DEBUG,
"MLME-MICHAELMICFAILURE.indication "
{
struct i802_driver_data *drv = priv;
+ if (drv->last_freq_ht) {
+ /* Clear HT flags from the driver */
+ struct hostapd_freq_params freq;
+ os_memset(&freq, 0, sizeof(freq));
+ freq.freq = drv->last_freq;
+ i802_set_freq2(priv, &freq);
+ }
+
i802_del_beacon(drv);
/* remove monitor interface */
.sta_deauth = i802_sta_deauth,
.sta_disassoc = i802_sta_disassoc,
.sta_remove = i802_sta_remove,
- .set_ssid = i802_set_ssid,
.send_mgmt_frame = i802_send_mgmt_frame,
.sta_add2 = i802_sta_add2,
.get_inact_sec = i802_get_inact_sec,
.sta_clear_stats = i802_sta_clear_stats,
- .set_freq = i802_set_freq,
+ .set_freq2 = i802_set_freq2,
.set_rts = i802_set_rts,
.get_rts = i802_get_rts,
.set_frag = i802_set_frag,
.set_retry = i802_set_retry,
.get_retry = i802_get_retry,
.set_rate_sets = i802_set_rate_sets,
- .set_channel_flag = i802_set_channel_flag,
- .set_regulatory_domain = i802_set_regulatory_domain,
.set_beacon = i802_set_beacon,
.set_internal_bridge = i802_set_internal_bridge,
.set_beacon_int = i802_set_beacon_int,
.if_remove = i802_if_remove,
.get_hw_feature_data = i802_get_hw_feature_data,
.set_sta_vlan = i802_set_sta_vlan,
+ .set_country = i802_set_country,
};