hostapd: update to 20120326

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31080 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Felix Fietkau 2012-03-27 10:42:47 +00:00
parent 1ef62d9b86
commit 3ad1877dd2
33 changed files with 367 additions and 1864 deletions

View File

@ -8,9 +8,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_VERSION:=20111103
PKG_RELEASE:=3
PKG_REV:=6caaae1e48da247b21b54ea6001646597e35d9b1
PKG_VERSION:=20120326
PKG_RELEASE:=1
PKG_REV:=f4329aa2d08192640532b712936f5221580e9f8c
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git

View File

@ -1,6 +1,6 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1471,13 +1471,6 @@ static void handle_assoc_cb(struct hosta
@@ -1488,13 +1488,6 @@ static void handle_assoc_cb(struct hosta
int new_assoc = 1;
struct ieee80211_ht_capabilities ht_cap;
@ -14,7 +14,7 @@
if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_resp) :
sizeof(mgmt->u.assoc_resp))) {
printf("handle_assoc_cb(reassoc=%d) - too short payload "
@@ -1485,11 +1478,6 @@ static void handle_assoc_cb(struct hosta
@@ -1502,11 +1495,6 @@ static void handle_assoc_cb(struct hosta
return;
}
@ -26,7 +26,7 @@
sta = ap_get_sta(hapd, mgmt->da);
if (!sta) {
printf("handle_assoc_cb: STA " MACSTR " not found\n",
@@ -1497,6 +1485,19 @@ static void handle_assoc_cb(struct hosta
@@ -1514,6 +1502,19 @@ static void handle_assoc_cb(struct hosta
return;
}
@ -46,34 +46,33 @@
if (status != WLAN_STATUS_SUCCESS)
goto fail;
@@ -1812,6 +1813,9 @@ void ieee802_11_rx_from_unknown(struct h
sta = ap_get_sta(hapd, src);
if (sta && (sta->flags & WLAN_STA_ASSOC)) {
+ if (!hapd->conf->wds_sta)
+ return;
+
if (wds && !(sta->flags & WLAN_STA_WDS)) {
wpa_printf(MSG_DEBUG, "Enable 4-address WDS mode for "
"STA " MACSTR " (aid %u)",
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -181,6 +181,7 @@ struct i802_bss {
struct wpa_driver_nl80211_data *drv;
struct i802_bss *next;
int ifindex;
+ u8 addr[ETH_ALEN];
char ifname[IFNAMSIZ + 1];
char brname[IFNAMSIZ];
unsigned int beacon_set:1;
@@ -191,7 +192,6 @@ struct i802_bss {
struct wpa_driver_nl80211_data {
struct nl80211_global *global;
struct dl_list list;
- u8 addr[ETH_ALEN];
char phyname[32];
void *ctx;
int ifindex;
@@ -2482,7 +2482,7 @@ wpa_driver_nl80211_finish_drv_init(struc
return -1;
@@ -2588,10 +2588,10 @@ static int wpa_driver_nl80211_capa(struc
drv->data_tx_status = info.data_tx_status;
if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
- drv->addr))
+ bss->addr))
return -1;
/*
- * If poll command is supported mac80211 is new enough to
- * have everything we need to not need monitor interfaces.
+ * If poll command and tx status are supported, mac80211 is new enough
+ * to have everything we need to not need monitor interfaces.
*/
- drv->use_monitor = !info.poll_command_supported;
+ drv->use_monitor = !info.poll_command_supported || !info.data_tx_status;
if (nl80211_register_action_frames(drv) < 0) {
@@ -5176,8 +5176,8 @@ static int wpa_driver_nl80211_hapd_send_
if (drv->device_ap_sme && drv->use_monitor) {
/*
@@ -6267,8 +6267,8 @@ static int wpa_driver_nl80211_hapd_send_
pos = (u8 *) (hdr + 1);
if (qos) {
@ -84,16 +83,7 @@
pos[1] = 0;
pos += 2;
}
@@ -6407,7 +6407,7 @@ static int i802_set_wds_sta(void *priv,
if (!if_nametoindex(name)) {
if (nl80211_create_iface(drv, name,
NL80211_IFTYPE_AP_VLAN,
- NULL, 1) < 0)
+ bss->addr, 1) < 0)
return -1;
if (bridge_ifname &&
linux_br_add_if(drv->global->ioctl_sock,
@@ -6417,6 +6417,10 @@ static int i802_set_wds_sta(void *priv,
@@ -7533,6 +7533,10 @@ static int i802_set_wds_sta(void *priv,
linux_set_iface_flags(drv->global->ioctl_sock, name, 1);
return i802_set_sta_vlan(priv, addr, name, 0);
} else {
@ -104,36 +94,7 @@
i802_set_sta_vlan(priv, addr, bss->ifname, 0);
return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN,
name);
@@ -6625,7 +6629,7 @@ static int nl80211_addr_in_use(struct nl
struct wpa_driver_nl80211_data *drv;
dl_list_for_each(drv, &global->interfaces,
struct wpa_driver_nl80211_data, list) {
- if (os_memcmp(addr, drv->addr, ETH_ALEN) == 0)
+ if (os_memcmp(addr, drv->first_bss.addr, ETH_ALEN) == 0)
return 1;
}
return 0;
@@ -6640,9 +6644,9 @@ static int nl80211_p2p_interface_addr(st
if (!drv->global)
return -1;
- os_memcpy(new_addr, drv->addr, ETH_ALEN);
+ os_memcpy(new_addr, drv->first_bss.addr, ETH_ALEN);
for (idx = 0; idx < 64; idx++) {
- new_addr[0] = drv->addr[0] | 0x02;
+ new_addr[0] = drv->first_bss.addr[0] | 0x02;
new_addr[0] ^= idx << 2;
if (!nl80211_addr_in_use(drv->global, new_addr))
break;
@@ -6745,6 +6749,7 @@ static int wpa_driver_nl80211_if_add(voi
os_free(new_bss);
return -1;
}
+ memcpy(new_bss->addr, addr ? addr : if_addr, ETH_ALEN);
os_strlcpy(new_bss->ifname, ifname, IFNAMSIZ);
new_bss->ifindex = ifidx;
new_bss->drv = drv;
@@ -6775,7 +6780,12 @@ static int wpa_driver_nl80211_if_remove(
@@ -7900,7 +7904,12 @@ static int wpa_driver_nl80211_if_remove(
if (ifindex <= 0)
return -1;
@ -146,7 +107,7 @@
if (bss->added_if_into_bridge) {
if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
bss->ifname) < 0)
@@ -6789,13 +6799,6 @@ static int wpa_driver_nl80211_if_remove(
@@ -7914,13 +7923,6 @@ static int wpa_driver_nl80211_if_remove(
"bridge %s: %s",
bss->brname, strerror(errno));
}
@ -160,21 +121,3 @@
if (bss != &drv->first_bss) {
struct i802_bss *tbss;
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -776,7 +776,14 @@ void wpa_receive(struct wpa_authenticato
}
if (sm->wpa == WPA_VERSION_WPA2) {
- if (key->type != EAPOL_KEY_TYPE_RSN) {
+ if (key->type == EAPOL_KEY_TYPE_WPA) {
+ /*
+ * Some deployed station implementations seem to send
+ * msg 4/4 with incorrect type value in WPA2 mode.
+ */
+ wpa_printf(MSG_DEBUG, "Workaround: Allow EAPOL-Key "
+ "with unexpected WPA type in RSN mode");
+ } else if (key->type != EAPOL_KEY_TYPE_RSN) {
wpa_printf(MSG_DEBUG, "Ignore EAPOL-Key with "
"unexpected type %d in RSN mode",
key->type);

View File

@ -0,0 +1,60 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2918,6 +2918,7 @@ static void * wpa_driver_nl80211_init(vo
drv->monitor_sock = -1;
drv->eapol_tx_sock = -1;
drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
+ drv->nlmode = NL80211_IFTYPE_STATION;
if (wpa_driver_nl80211_init_nl(drv)) {
os_free(drv);
@@ -3232,17 +3233,12 @@ static void wpa_driver_nl80211_send_rfki
wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
}
-
static int
-wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
+wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv,
+ int *send_rfkill_event)
{
struct i802_bss *bss = &drv->first_bss;
- int send_rfkill_event = 0;
- drv->ifindex = if_nametoindex(bss->ifname);
- drv->first_bss.ifindex = drv->ifindex;
-
-#ifndef HOSTAPD
/*
* Make sure the interface starts up in station mode unless this is a
* dynamically added interface (e.g., P2P) that was already configured
@@ -3261,7 +3257,7 @@ wpa_driver_nl80211_finish_drv_init(struc
"interface '%s' due to rfkill",
bss->ifname);
drv->if_disabled = 1;
- send_rfkill_event = 1;
+ *send_rfkill_event = 1;
} else {
wpa_printf(MSG_ERROR, "nl80211: Could not set "
"interface '%s' UP", bss->ifname);
@@ -3271,7 +3267,19 @@ wpa_driver_nl80211_finish_drv_init(struc
netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
1, IF_OPER_DORMANT);
-#endif /* HOSTAPD */
+}
+
+static int
+wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
+{
+ struct i802_bss *bss = &drv->first_bss;
+ int send_rfkill_event = 0;
+
+ drv->ifindex = if_nametoindex(bss->ifname);
+ drv->first_bss.ifindex = drv->ifindex;
+
+ if (drv->nlmode == NL80211_IFTYPE_STATION)
+ wpa_driver_nl80211_finish_drv_init_sta(drv, &send_rfkill_event);
if (wpa_driver_nl80211_capa(drv))
return -1;

View File

@ -1,37 +0,0 @@
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -423,6 +423,7 @@ static void wpa_supplicant_scan(void *el
int scan_req = 0, ret;
struct wpabuf *extra_ie;
struct wpa_driver_scan_params params;
+ int scan_ssid_all = 1;
size_t max_ssids;
enum wpa_states prev_state;
@@ -502,6 +503,16 @@ static void wpa_supplicant_scan(void *el
}
}
+ /* check if all configured ssids should be scanned directly */
+ ssid = wpa_s->conf->ssid;
+ while (ssid) {
+ if (!ssid->scan_ssid) {
+ scan_ssid_all = 0;
+ break;
+ }
+ ssid = ssid->next;
+ }
+
/* Find the starting point from which to continue scanning */
ssid = wpa_s->conf->ssid;
if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
@@ -564,6 +575,9 @@ static void wpa_supplicant_scan(void *el
int_array_sort_unique(params.freqs);
}
+ if (scan_ssid_all && !ssid)
+ ssid = wpa_s->conf->ssid;
+
if (ssid) {
wpa_s->prev_scan_ssid = ssid;
if (max_ssids > 1) {

View File

@ -1,791 +0,0 @@
--- a/src/drivers/driver_madwifi.c
+++ b/src/drivers/driver_madwifi.c
@@ -71,7 +71,6 @@
#define WPA_KEY_RSC_LEN 8
-#ifdef HOSTAPD
#include "priv_netlink.h"
#include "netlink.h"
@@ -82,17 +81,22 @@
struct madwifi_driver_data {
struct hostapd_data *hapd; /* back pointer */
- char iface[IFNAMSIZ + 1];
+ void *wext; /* private data for driver_wext */
+ void *ctx;
+ char ifname[IFNAMSIZ + 1];
+ int ioctl_sock; /* socket for ioctl() use */
+
+#ifdef HOSTAPD
int ifindex;
struct l2_packet_data *sock_xmit; /* raw packet xmit socket */
struct l2_packet_data *sock_recv; /* raw packet recv socket */
- int ioctl_sock; /* socket for ioctl() use */
struct netlink_data *netlink;
int we_version;
u8 acct_mac[ETH_ALEN];
struct hostap_sta_driver_data acct_data;
struct l2_packet_data *sock_raw; /* raw 802.11 management frames */
+#endif
};
static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
@@ -105,7 +109,7 @@ set80211priv(struct madwifi_driver_data
int do_inline = len < IFNAMSIZ;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
#ifdef IEEE80211_IOCTL_FILTERFRAME
/* FILTERFRAME must be NOT inline, regardless of size. */
if (op == IEEE80211_IOCTL_FILTERFRAME)
@@ -206,7 +210,7 @@ set80211param(struct madwifi_driver_data
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.mode = op;
memcpy(iwr.u.name+sizeof(__u32), &arg, sizeof(arg));
@@ -233,6 +237,7 @@ ether_sprintf(const u8 *addr)
}
#endif /* CONFIG_NO_STDOUT_DEBUG */
+#ifdef HOSTAPD
/*
* Configure WPA parameters.
*/
@@ -395,7 +400,7 @@ madwifi_sta_set_flags(void *priv, const
return madwifi_set_sta_authorized(priv, addr, 0);
return 0;
}
-
+#endif /* HOSTAPD */
static int
madwifi_del_key(void *priv, const u8 *addr, int key_idx)
{
@@ -407,28 +412,20 @@ madwifi_del_key(void *priv, const u8 *ad
__func__, ether_sprintf(addr), key_idx);
memset(&wk, 0, sizeof(wk));
+ wk.idk_keyix = key_idx;
if (addr != NULL) {
memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN);
- wk.idk_keyix = (u8) IEEE80211_KEYIX_NONE;
- } else {
- wk.idk_keyix = key_idx;
- }
-
- ret = set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk));
- if (ret < 0) {
- wpa_printf(MSG_DEBUG, "%s: Failed to delete key (addr %s"
- " key_idx %d)", __func__, ether_sprintf(addr),
- key_idx);
}
- return ret;
+ set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk));
+ return 0;
}
static int
-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
- const u8 *addr, int key_idx, int set_tx,
- const u8 *seq, size_t seq_len,
- const u8 *key, size_t key_len)
+madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
+ const u8 *addr, int key_idx, int set_tx,
+ const u8 *seq, size_t seq_len,
+ const u8 *key, size_t key_len)
{
struct madwifi_driver_data *drv = priv;
struct ieee80211req_key wk;
@@ -466,6 +463,9 @@ wpa_driver_madwifi_set_key(const char *i
memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
wk.ik_keyix = key_idx;
wk.ik_flags |= IEEE80211_KEY_DEFAULT;
+ } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) {
+ wk.ik_flags |= IEEE80211_KEY_GROUP;
+ memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
} else {
memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
wk.ik_keyix = IEEE80211_KEYIX_NONE;
@@ -485,6 +485,7 @@ wpa_driver_madwifi_set_key(const char *i
}
+#ifdef HOSTAPD
static int
madwifi_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
u8 *seq)
@@ -591,7 +592,7 @@ madwifi_read_sta_driver_data(void *priv,
memset(data, 0, sizeof(*data));
snprintf(buf, sizeof(buf), "/proc/net/madwifi/%s/" MACSTR,
- drv->iface, MAC2STR(addr));
+ drv->ifname, MAC2STR(addr));
f = fopen(buf, "r");
if (!f) {
@@ -759,7 +760,7 @@ static int madwifi_receive_probe_req(str
if (ret)
return ret;
- drv->sock_raw = l2_packet_init(drv->iface, NULL, ETH_P_80211_RAW,
+ drv->sock_raw = l2_packet_init(drv->ifname, NULL, ETH_P_80211_RAW,
madwifi_raw_receive, drv, 1);
if (drv->sock_raw == NULL)
return -1;
@@ -812,7 +813,7 @@ static int madwifi_set_freq(void *priv,
struct iwreq iwr;
os_memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.freq.m = freq->channel;
iwr.u.freq.e = 0;
@@ -1037,7 +1038,7 @@ madwifi_get_we_version(struct madwifi_dr
return -1;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.data.pointer = (caddr_t) range;
iwr.u.data.length = buflen;
@@ -1154,17 +1155,17 @@ madwifi_init(struct hostapd_data *hapd,
perror("socket[PF_INET,SOCK_DGRAM]");
goto bad;
}
- memcpy(drv->iface, params->ifname, sizeof(drv->iface));
+ memcpy(drv->ifname, params->ifname, sizeof(drv->ifname));
memset(&ifr, 0, sizeof(ifr));
- os_strlcpy(ifr.ifr_name, drv->iface, sizeof(ifr.ifr_name));
+ os_strlcpy(ifr.ifr_name, drv->ifname, sizeof(ifr.ifr_name));
if (ioctl(drv->ioctl_sock, SIOCGIFINDEX, &ifr) != 0) {
perror("ioctl(SIOCGIFINDEX)");
goto bad;
}
drv->ifindex = ifr.ifr_ifindex;
- drv->sock_xmit = l2_packet_init(drv->iface, NULL, ETH_P_EAPOL,
+ drv->sock_xmit = l2_packet_init(drv->ifname, NULL, ETH_P_EAPOL,
handle_read, drv, 1);
if (drv->sock_xmit == NULL)
goto bad;
@@ -1178,7 +1179,7 @@ madwifi_init(struct hostapd_data *hapd,
1);
if (drv->sock_recv == NULL)
goto bad;
- } else if (linux_br_get(brname, drv->iface) == 0) {
+ } else if (linux_br_get(brname, drv->ifname) == 0) {
wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for "
"EAPOL receive", brname);
drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL,
@@ -1189,7 +1190,7 @@ madwifi_init(struct hostapd_data *hapd,
drv->sock_recv = drv->sock_xmit;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.mode = IW_MODE_MASTER;
@@ -1200,7 +1201,7 @@ madwifi_init(struct hostapd_data *hapd,
}
/* mark down during setup */
- linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0);
+ linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0);
madwifi_set_privacy(drv, 0); /* default to no privacy */
madwifi_receive_probe_req(drv);
@@ -1226,7 +1227,7 @@ madwifi_deinit(void *priv)
struct madwifi_driver_data *drv = priv;
netlink_deinit(drv->netlink);
- (void) linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0);
+ (void) linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0);
if (drv->ioctl_sock >= 0)
close(drv->ioctl_sock);
if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit)
@@ -1245,7 +1246,7 @@ madwifi_set_ssid(void *priv, const u8 *b
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.essid.flags = 1; /* SSID active */
iwr.u.essid.pointer = (caddr_t) buf;
iwr.u.essid.length = len + 1;
@@ -1266,7 +1267,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in
int ret = 0;
memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.essid.pointer = (caddr_t) buf;
iwr.u.essid.length = len;
@@ -1291,140 +1292,19 @@ static int
madwifi_commit(void *priv)
{
struct madwifi_driver_data *drv = priv;
- return linux_set_iface_flags(drv->ioctl_sock, drv->iface, 1);
+ return linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1);
}
-#else /* HOSTAPD */
+#endif /* HOSTAPD */
-struct wpa_driver_madwifi_data {
- void *wext; /* private data for driver_wext */
- void *ctx;
- char ifname[IFNAMSIZ + 1];
- int sock;
-};
+#if !defined(NO_SUPPLICANT)
static int wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg);
static int wpa_driver_madwifi_set_probe_req_ie(void *priv, const u8 *ies,
size_t ies_len);
-
-static int
-set80211priv(struct wpa_driver_madwifi_data *drv, int op, void *data, int len,
- int show_err)
-{
- struct iwreq iwr;
-
- os_memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
- if (len < IFNAMSIZ &&
- op != IEEE80211_IOCTL_SET_APPIEBUF) {
- /*
- * Argument data fits inline; put it there.
- */
- os_memcpy(iwr.u.name, data, len);
- } else {
- /*
- * Argument data too big for inline transfer; setup a
- * parameter block instead; the kernel will transfer
- * the data for the driver.
- */
- iwr.u.data.pointer = data;
- iwr.u.data.length = len;
- }
-
- if (ioctl(drv->sock, op, &iwr) < 0) {
- if (show_err) {
-#ifdef MADWIFI_NG
- int first = IEEE80211_IOCTL_SETPARAM;
- int last = IEEE80211_IOCTL_KICKMAC;
- static const char *opnames[] = {
- "ioctl[IEEE80211_IOCTL_SETPARAM]",
- "ioctl[IEEE80211_IOCTL_GETPARAM]",
- "ioctl[IEEE80211_IOCTL_SETMODE]",
- "ioctl[IEEE80211_IOCTL_GETMODE]",
- "ioctl[IEEE80211_IOCTL_SETWMMPARAMS]",
- "ioctl[IEEE80211_IOCTL_GETWMMPARAMS]",
- "ioctl[IEEE80211_IOCTL_SETCHANLIST]",
- "ioctl[IEEE80211_IOCTL_GETCHANLIST]",
- "ioctl[IEEE80211_IOCTL_CHANSWITCH]",
- NULL,
- "ioctl[IEEE80211_IOCTL_SET_APPIEBUF]",
- "ioctl[IEEE80211_IOCTL_GETSCANRESULTS]",
- NULL,
- "ioctl[IEEE80211_IOCTL_GETCHANINFO]",
- "ioctl[IEEE80211_IOCTL_SETOPTIE]",
- "ioctl[IEEE80211_IOCTL_GETOPTIE]",
- "ioctl[IEEE80211_IOCTL_SETMLME]",
- NULL,
- "ioctl[IEEE80211_IOCTL_SETKEY]",
- NULL,
- "ioctl[IEEE80211_IOCTL_DELKEY]",
- NULL,
- "ioctl[IEEE80211_IOCTL_ADDMAC]",
- NULL,
- "ioctl[IEEE80211_IOCTL_DELMAC]",
- NULL,
- "ioctl[IEEE80211_IOCTL_WDSMAC]",
- NULL,
- "ioctl[IEEE80211_IOCTL_WDSDELMAC]",
- NULL,
- "ioctl[IEEE80211_IOCTL_KICKMAC]",
- };
-#else /* MADWIFI_NG */
- int first = IEEE80211_IOCTL_SETPARAM;
- int last = IEEE80211_IOCTL_CHANLIST;
- static const char *opnames[] = {
- "ioctl[IEEE80211_IOCTL_SETPARAM]",
- "ioctl[IEEE80211_IOCTL_GETPARAM]",
- "ioctl[IEEE80211_IOCTL_SETKEY]",
- "ioctl[IEEE80211_IOCTL_GETKEY]",
- "ioctl[IEEE80211_IOCTL_DELKEY]",
- NULL,
- "ioctl[IEEE80211_IOCTL_SETMLME]",
- NULL,
- "ioctl[IEEE80211_IOCTL_SETOPTIE]",
- "ioctl[IEEE80211_IOCTL_GETOPTIE]",
- "ioctl[IEEE80211_IOCTL_ADDMAC]",
- NULL,
- "ioctl[IEEE80211_IOCTL_DELMAC]",
- NULL,
- "ioctl[IEEE80211_IOCTL_CHANLIST]",
- };
-#endif /* MADWIFI_NG */
- int idx = op - first;
- if (first <= op && op <= last &&
- idx < (int) (sizeof(opnames) / sizeof(opnames[0]))
- && opnames[idx])
- perror(opnames[idx]);
- else
- perror("ioctl[unknown???]");
- }
- return -1;
- }
- return 0;
-}
-
static int
-set80211param(struct wpa_driver_madwifi_data *drv, int op, int arg,
- int show_err)
-{
- struct iwreq iwr;
-
- os_memset(&iwr, 0, sizeof(iwr));
- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
- iwr.u.mode = op;
- os_memcpy(iwr.u.name+sizeof(u32), &arg, sizeof(arg));
-
- if (ioctl(drv->sock, IEEE80211_IOCTL_SETPARAM, &iwr) < 0) {
- if (show_err)
- perror("ioctl[IEEE80211_IOCTL_SETPARAM]");
- return -1;
- }
- return 0;
-}
-
-static int
-wpa_driver_madwifi_set_wpa_ie(struct wpa_driver_madwifi_data *drv,
+wpa_driver_madwifi_set_wpa_ie(struct madwifi_driver_data *drv,
const u8 *wpa_ie, size_t wpa_ie_len)
{
struct iwreq iwr;
@@ -1435,7 +1315,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
iwr.u.data.pointer = (void *) wpa_ie;
iwr.u.data.length = wpa_ie_len;
- if (ioctl(drv->sock, IEEE80211_IOCTL_SETOPTIE, &iwr) < 0) {
+ if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_SETOPTIE, &iwr) < 0) {
perror("ioctl[IEEE80211_IOCTL_SETOPTIE]");
return -1;
}
@@ -1443,157 +1323,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
}
static int
-wpa_driver_madwifi_del_key(struct wpa_driver_madwifi_data *drv, int key_idx,
- const u8 *addr)
-{
- struct ieee80211req_del_key wk;
-
- wpa_printf(MSG_DEBUG, "%s: keyidx=%d", __FUNCTION__, key_idx);
- os_memset(&wk, 0, sizeof(wk));
- wk.idk_keyix = key_idx;
- if (addr != NULL)
- os_memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN);
-
- return set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk), 1);
-}
-
-static int
-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
- const u8 *addr, int key_idx, int set_tx,
- const u8 *seq, size_t seq_len,
- const u8 *key, size_t key_len)
-{
- struct wpa_driver_madwifi_data *drv = priv;
- struct ieee80211req_key wk;
- char *alg_name;
- u_int8_t cipher;
-
- if (alg == WPA_ALG_NONE)
- return wpa_driver_madwifi_del_key(drv, key_idx, addr);
-
- switch (alg) {
- case WPA_ALG_WEP:
- if (addr == NULL || os_memcmp(addr, "\xff\xff\xff\xff\xff\xff",
- ETH_ALEN) == 0) {
- /*
- * madwifi did not seem to like static WEP key
- * configuration with IEEE80211_IOCTL_SETKEY, so use
- * Linux wireless extensions ioctl for this.
- */
- return wpa_driver_wext_set_key(ifname, drv->wext, alg,
- addr, key_idx, set_tx,
- seq, seq_len,
- key, key_len);
- }
- alg_name = "WEP";
- cipher = IEEE80211_CIPHER_WEP;
- break;
- case WPA_ALG_TKIP:
- alg_name = "TKIP";
- cipher = IEEE80211_CIPHER_TKIP;
- break;
- case WPA_ALG_CCMP:
- alg_name = "CCMP";
- cipher = IEEE80211_CIPHER_AES_CCM;
- break;
- default:
- wpa_printf(MSG_DEBUG, "%s: unknown/unsupported algorithm %d",
- __FUNCTION__, alg);
- return -1;
- }
-
- wpa_printf(MSG_DEBUG, "%s: alg=%s key_idx=%d set_tx=%d seq_len=%lu "
- "key_len=%lu", __FUNCTION__, alg_name, key_idx, set_tx,
- (unsigned long) seq_len, (unsigned long) key_len);
-
- if (seq_len > sizeof(u_int64_t)) {
- wpa_printf(MSG_DEBUG, "%s: seq_len %lu too big",
- __FUNCTION__, (unsigned long) seq_len);
- return -2;
- }
- if (key_len > sizeof(wk.ik_keydata)) {
- wpa_printf(MSG_DEBUG, "%s: key length %lu too big",
- __FUNCTION__, (unsigned long) key_len);
- return -3;
- }
-
- os_memset(&wk, 0, sizeof(wk));
- wk.ik_type = cipher;
- wk.ik_flags = IEEE80211_KEY_RECV;
- if (addr == NULL ||
- os_memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) == 0)
- wk.ik_flags |= IEEE80211_KEY_GROUP;
- if (set_tx) {
- wk.ik_flags |= IEEE80211_KEY_XMIT | IEEE80211_KEY_DEFAULT;
- os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
- } else
- os_memset(wk.ik_macaddr, 0, IEEE80211_ADDR_LEN);
- wk.ik_keyix = key_idx;
- wk.ik_keylen = key_len;
-#ifdef WORDS_BIGENDIAN
- if (seq) {
- size_t i;
- u8 tmp[WPA_KEY_RSC_LEN];
- os_memset(tmp, 0, sizeof(tmp));
- for (i = 0; i < seq_len; i++)
- tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
- os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
- }
-#else /* WORDS_BIGENDIAN */
- if (seq)
- os_memcpy(&wk.ik_keyrsc, seq, seq_len);
-#endif /* WORDS_BIGENDIAN */
- os_memcpy(wk.ik_keydata, key, key_len);
-
- return set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk), 1);
-}
-
-static int
wpa_driver_madwifi_set_countermeasures(void *priv, int enabled)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
- return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled, 1);
+ return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled);
}
static int
wpa_driver_madwifi_deauthenticate(void *priv, const u8 *addr, int reason_code)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
struct ieee80211req_mlme mlme;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
mlme.im_op = IEEE80211_MLME_DEAUTH;
mlme.im_reason = reason_code;
os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN);
- return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme), 1);
+ return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme));
}
static int
wpa_driver_madwifi_disassociate(void *priv, const u8 *addr, int reason_code)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
struct ieee80211req_mlme mlme;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
mlme.im_op = IEEE80211_MLME_DISASSOC;
mlme.im_reason = reason_code;
os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN);
- return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme), 1);
+ return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme));
}
static int
wpa_driver_madwifi_associate(void *priv,
struct wpa_driver_associate_params *params)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
struct ieee80211req_mlme mlme;
int ret = 0, privacy = 1;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
if (set80211param(drv, IEEE80211_PARAM_DROPUNENCRYPTED,
- params->drop_unencrypted, 1) < 0)
+ params->drop_unencrypted) < 0)
ret = -1;
if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
@@ -1616,12 +1390,12 @@ wpa_driver_madwifi_associate(void *priv,
params->wpa_ie_len == 0)
privacy = 0;
- if (set80211param(drv, IEEE80211_PARAM_PRIVACY, privacy, 1) < 0)
+ if (set80211param(drv, IEEE80211_PARAM_PRIVACY, privacy) < 0)
ret = -1;
if (params->wpa_ie_len &&
set80211param(drv, IEEE80211_PARAM_WPA,
- params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1, 1) < 0)
+ params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
ret = -1;
if (params->bssid == NULL) {
@@ -1629,14 +1403,14 @@ wpa_driver_madwifi_associate(void *priv,
* roaming */
/* FIX: this does not seem to work; would probably need to
* change something in the driver */
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0, 1) < 0)
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0) < 0)
ret = -1;
if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
params->ssid_len) < 0)
ret = -1;
} else {
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2, 1) < 0)
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2) < 0)
ret = -1;
if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
params->ssid_len) < 0)
@@ -1645,7 +1419,7 @@ wpa_driver_madwifi_associate(void *priv,
mlme.im_op = IEEE80211_MLME_ASSOC;
os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN);
if (set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme,
- sizeof(mlme), 1) < 0) {
+ sizeof(mlme)) < 0) {
wpa_printf(MSG_DEBUG, "%s: SETMLME[ASSOC] failed",
__func__);
ret = -1;
@@ -1658,7 +1432,7 @@ wpa_driver_madwifi_associate(void *priv,
static int
wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
int authmode;
if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
@@ -1669,13 +1443,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr
else
authmode = IEEE80211_AUTH_OPEN;
- return set80211param(drv, IEEE80211_PARAM_AUTHMODE, authmode, 1);
+ return set80211param(drv, IEEE80211_PARAM_AUTHMODE, authmode);
}
static int
wpa_driver_madwifi_scan(void *priv, struct wpa_driver_scan_params *params)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
struct iwreq iwr;
int ret = 0;
const u8 *ssid = params->ssids[0].ssid;
@@ -1693,7 +1467,7 @@ wpa_driver_madwifi_scan(void *priv, stru
if (wpa_driver_wext_set_ssid(drv->wext, ssid, ssid_len) < 0)
ret = -1;
- if (ioctl(drv->sock, SIOCSIWSCAN, &iwr) < 0) {
+ if (ioctl(drv->ioctl_sock, SIOCSIWSCAN, &iwr) < 0) {
perror("ioctl[SIOCSIWSCAN]");
ret = -1;
}
@@ -1715,14 +1489,14 @@ wpa_driver_madwifi_scan(void *priv, stru
static int wpa_driver_madwifi_get_bssid(void *priv, u8 *bssid)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
return wpa_driver_wext_get_bssid(drv->wext, bssid);
}
static int wpa_driver_madwifi_get_ssid(void *priv, u8 *ssid)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
return wpa_driver_wext_get_ssid(drv->wext, ssid);
}
@@ -1730,14 +1504,16 @@ static int wpa_driver_madwifi_get_ssid(v
static struct wpa_scan_results *
wpa_driver_madwifi_get_scan_results(void *priv)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
return wpa_driver_wext_get_scan_results(drv->wext);
}
static int wpa_driver_madwifi_set_operstate(void *priv, int state)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
+ if (!drv->wext)
+ return 0;
return wpa_driver_wext_set_operstate(drv->wext, state);
}
@@ -1758,7 +1534,7 @@ static int wpa_driver_madwifi_set_probe_
ret = set80211priv(priv, IEEE80211_IOCTL_SET_APPIEBUF, probe_req_ie,
sizeof(struct ieee80211req_getset_appiebuf) +
- ies_len, 1);
+ ies_len);
os_free(probe_req_ie);
@@ -1768,7 +1544,7 @@ static int wpa_driver_madwifi_set_probe_
static void * wpa_driver_madwifi_init(void *ctx, const char *ifname)
{
- struct wpa_driver_madwifi_data *drv;
+ struct madwifi_driver_data *drv;
drv = os_zalloc(sizeof(*drv));
if (drv == NULL)
@@ -1779,17 +1555,17 @@ static void * wpa_driver_madwifi_init(vo
drv->ctx = ctx;
os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
- drv->sock = socket(PF_INET, SOCK_DGRAM, 0);
- if (drv->sock < 0)
+ drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
+ if (drv->ioctl_sock < 0)
goto fail2;
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2, 1) < 0) {
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2) < 0) {
wpa_printf(MSG_DEBUG, "%s: failed to set wpa_supplicant-based "
"roaming", __FUNCTION__);
goto fail3;
}
- if (set80211param(drv, IEEE80211_PARAM_WPA, 3, 1) < 0) {
+ if (set80211param(drv, IEEE80211_PARAM_WPA, 3) < 0) {
wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support",
__FUNCTION__);
goto fail3;
@@ -1798,7 +1574,7 @@ static void * wpa_driver_madwifi_init(vo
return drv;
fail3:
- close(drv->sock);
+ close(drv->ioctl_sock);
fail2:
wpa_driver_wext_deinit(drv->wext);
fail:
@@ -1809,38 +1585,37 @@ fail:
static void wpa_driver_madwifi_deinit(void *priv)
{
- struct wpa_driver_madwifi_data *drv = priv;
+ struct madwifi_driver_data *drv = priv;
if (wpa_driver_madwifi_set_wpa_ie(drv, NULL, 0) < 0) {
wpa_printf(MSG_DEBUG, "%s: failed to clear WPA IE",
__FUNCTION__);
}
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0, 1) < 0) {
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0) < 0) {
wpa_printf(MSG_DEBUG, "%s: failed to enable driver-based "
"roaming", __FUNCTION__);
}
- if (set80211param(drv, IEEE80211_PARAM_PRIVACY, 0, 1) < 0) {
+ if (set80211param(drv, IEEE80211_PARAM_PRIVACY, 0) < 0) {
wpa_printf(MSG_DEBUG, "%s: failed to disable forced Privacy "
"flag", __FUNCTION__);
}
- if (set80211param(drv, IEEE80211_PARAM_WPA, 0, 1) < 0) {
+ if (set80211param(drv, IEEE80211_PARAM_WPA, 0) < 0) {
wpa_printf(MSG_DEBUG, "%s: failed to disable WPA",
__FUNCTION__);
}
wpa_driver_wext_deinit(drv->wext);
- close(drv->sock);
+ close(drv->ioctl_sock);
os_free(drv);
}
-#endif /* HOSTAPD */
-
+#endif
const struct wpa_driver_ops wpa_driver_madwifi_ops = {
.name = "madwifi",
.desc = "MADWIFI 802.11 support (Atheros, etc.)",
- .set_key = wpa_driver_madwifi_set_key,
+ .set_key = madwifi_set_key,
#ifdef HOSTAPD
.hapd_init = madwifi_init,
.hapd_deinit = madwifi_deinit,
@@ -1861,7 +1636,8 @@ const struct wpa_driver_ops wpa_driver_m
.commit = madwifi_commit,
.set_ap_wps_ie = madwifi_set_ap_wps_ie,
.set_freq = madwifi_set_freq,
-#else /* HOSTAPD */
+#endif /* HOSTAPD */
+#if !defined(NO_SUPPLICANT)
.get_bssid = wpa_driver_madwifi_get_bssid,
.get_ssid = wpa_driver_madwifi_get_ssid,
.init = wpa_driver_madwifi_init,
@@ -1873,5 +1649,5 @@ const struct wpa_driver_ops wpa_driver_m
.disassociate = wpa_driver_madwifi_disassociate,
.associate = wpa_driver_madwifi_associate,
.set_operstate = wpa_driver_madwifi_set_operstate,
-#endif /* HOSTAPD */
+#endif
};
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -144,8 +144,8 @@ DRV_WPA_OBJS += ../src/drivers/driver_ro
endif
ifdef CONFIG_WIRELESS_EXTENSION
-DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
-DRV_WPA_OBJS += ../src/drivers/driver_wext.o
+DRV_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
+DRV_OBJS += ../src/drivers/driver_wext.o
NEED_RFKILL=y
endif

View File

@ -1,6 +1,6 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -600,6 +600,10 @@ static void wpa_driver_nl80211_event_rtm
@@ -886,6 +886,10 @@ static void wpa_driver_nl80211_event_rtm
return;
}
@ -11,7 +11,7 @@
wpa_printf(MSG_DEBUG, "RTM_NEWLINK: operstate=%d ifi_flags=0x%x "
"(%s%s%s%s)",
drv->operstate, ifi->ifi_flags,
@@ -692,6 +696,10 @@ static void wpa_driver_nl80211_event_rtm
@@ -993,6 +997,10 @@ static void wpa_driver_nl80211_event_rtm
attrlen = len;
attr = (struct rtattr *) buf;
@ -22,7 +22,7 @@
rta_len = RTA_ALIGN(sizeof(struct rtattr));
while (RTA_OK(attr, attrlen)) {
if (attr->rta_type == IFLA_IFNAME) {
@@ -2291,6 +2299,11 @@ static void * wpa_driver_nl80211_init(vo
@@ -2920,6 +2928,11 @@ static void * wpa_driver_nl80211_init(vo
drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
drv->nlmode = NL80211_IFTYPE_STATION;
@ -34,7 +34,7 @@
if (wpa_driver_nl80211_init_nl(drv)) {
os_free(drv);
return NULL;
@@ -6531,8 +6544,6 @@ static void *i802_init(struct hostapd_da
@@ -7654,8 +7667,6 @@ static void *i802_init(struct hostapd_da
br_ifindex = 0;
}

View File

@ -0,0 +1,50 @@
--- a/src/drivers/driver_madwifi.c
+++ b/src/drivers/driver_madwifi.c
@@ -439,8 +439,14 @@ wpa_driver_madwifi_set_key(const char *i
wpa_printf(MSG_DEBUG, "%s: alg=%d addr=%s key_idx=%d",
__func__, alg, ether_sprintf(addr), key_idx);
- if (alg == WPA_ALG_WEP)
+ if (alg == WPA_ALG_WEP) {
cipher = IEEE80211_CIPHER_WEP;
+ if ((!addr || !memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) &&
+ drv->wext)
+ return wpa_driver_wext_set_key(ifname, drv->wext, alg, addr,
+ key_idx, set_tx, seq, seq_len,
+ key, key_len);
+ }
else if (alg == WPA_ALG_TKIP)
cipher = IEEE80211_CIPHER_TKIP;
else if (alg == WPA_ALG_CCMP)
@@ -459,7 +465,9 @@ wpa_driver_madwifi_set_key(const char *i
memset(&wk, 0, sizeof(wk));
wk.ik_type = cipher;
- wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT;
+ wk.ik_flags = IEEE80211_KEY_RECV;
+ if (set_tx)
+ wk.ik_flags |= IEEE80211_KEY_XMIT;
if (addr == NULL || is_broadcast_ether_addr(addr)) {
memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
wk.ik_keyix = key_idx;
@@ -471,6 +479,20 @@ wpa_driver_madwifi_set_key(const char *i
wk.ik_keylen = key_len;
memcpy(wk.ik_keydata, key, key_len);
+#ifdef WORDS_BIGENDIAN
+#define WPA_KEY_RSC_LEN 8
+ {
+ size_t i;
+ u8 tmp[WPA_KEY_RSC_LEN];
+ os_memset(tmp, 0, sizeof(tmp));
+ for (i = 0; i < seq_len; i++)
+ tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
+ os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
+ }
+#else /* WORDS_BIGENDIAN */
+ os_memcpy(&wk.ik_keyrsc, seq, seq_len);
+#endif /* WORDS_BIGENDIAN */
+
ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk));
if (ret < 0) {
wpa_printf(MSG_DEBUG, "%s: Failed to set key (addr %s"

View File

@ -1,76 +0,0 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2289,6 +2289,7 @@ static void * wpa_driver_nl80211_init(vo
drv->monitor_ifidx = -1;
drv->monitor_sock = -1;
drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
+ drv->nlmode = NL80211_IFTYPE_STATION;
if (wpa_driver_nl80211_init_nl(drv)) {
os_free(drv);
@@ -2446,37 +2447,37 @@ wpa_driver_nl80211_finish_drv_init(struc
drv->ifindex = if_nametoindex(bss->ifname);
drv->first_bss.ifindex = drv->ifindex;
-#ifndef HOSTAPD
- /*
- * Make sure the interface starts up in station mode unless this is a
- * dynamically added interface (e.g., P2P) that was already configured
- * with proper iftype.
- */
- if ((drv->global == NULL ||
- drv->ifindex != drv->global->if_add_ifindex) &&
- wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) {
- wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to "
- "use managed mode");
- return -1;
- }
-
- if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
- if (rfkill_is_blocked(drv->rfkill)) {
- wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
- "interface '%s' due to rfkill",
- bss->ifname);
- drv->if_disabled = 1;
- send_rfkill_event = 1;
- } else {
- wpa_printf(MSG_ERROR, "nl80211: Could not set "
- "interface '%s' UP", bss->ifname);
+ if (drv->nlmode == NL80211_IFTYPE_STATION) {
+ /*
+ * Make sure the interface starts up in station mode unless this is a
+ * dynamically added interface (e.g., P2P) that was already configured
+ * with proper iftype.
+ */
+ if ((drv->global == NULL ||
+ drv->ifindex != drv->global->if_add_ifindex) &&
+ wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) {
+ wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to "
+ "use managed mode");
return -1;
}
- }
- netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
- 1, IF_OPER_DORMANT);
-#endif /* HOSTAPD */
+ if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
+ if (rfkill_is_blocked(drv->rfkill)) {
+ wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
+ "interface '%s' due to rfkill",
+ bss->ifname);
+ drv->if_disabled = 1;
+ send_rfkill_event = 1;
+ } else {
+ wpa_printf(MSG_ERROR, "nl80211: Could not set "
+ "interface '%s' UP", bss->ifname);
+ return -1;
+ }
+ }
+
+ netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
+ 1, IF_OPER_DORMANT);
+ }
if (wpa_driver_nl80211_capa(drv))
return -1;

View File

@ -1,69 +0,0 @@
--- a/src/drivers/driver_madwifi.c
+++ b/src/drivers/driver_madwifi.c
@@ -439,7 +439,11 @@ madwifi_set_key(const char *ifname, void
__func__, alg, ether_sprintf(addr), key_idx);
if (alg == WPA_ALG_WEP)
+ {
cipher = IEEE80211_CIPHER_WEP;
+ if ((!addr || !memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) && drv->wext)
+ return wpa_driver_wext_set_key(ifname, drv->wext, alg, addr, key_idx, set_tx, seq, seq_len, key, key_len);
+ }
else if (alg == WPA_ALG_TKIP)
cipher = IEEE80211_CIPHER_TKIP;
else if (alg == WPA_ALG_CCMP)
@@ -458,20 +462,45 @@ madwifi_set_key(const char *ifname, void
memset(&wk, 0, sizeof(wk));
wk.ik_type = cipher;
- wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT;
- if (addr == NULL || is_broadcast_ether_addr(addr)) {
- memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
+ wk.ik_flags = IEEE80211_KEY_RECV;
+ if (set_tx)
+ wk.ik_flags |= IEEE80211_KEY_XMIT;
+ if (addr == NULL) {
+ os_memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
wk.ik_keyix = key_idx;
- wk.ik_flags |= IEEE80211_KEY_DEFAULT;
- } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) {
- wk.ik_flags |= IEEE80211_KEY_GROUP;
- memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
} else {
- memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
- wk.ik_keyix = IEEE80211_KEYIX_NONE;
+ os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
+ /*
+ * Deduce whether group/global or unicast key by checking
+ * the address (yech). Note also that we can only mark global
+ * keys default; doing this for a unicast key is an error.
+ */
+ if (os_memcmp(addr, "\xff\xff\xff\xff\xff\xff",
+ IEEE80211_ADDR_LEN) == 0) {
+ wk.ik_flags |= IEEE80211_KEY_GROUP;
+ wk.ik_keyix = key_idx;
+ } else {
+ wk.ik_keyix = key_idx == 0 ? IEEE80211_KEYIX_NONE :
+ key_idx;
+ }
}
+ if (wk.ik_keyix != IEEE80211_KEYIX_NONE && set_tx)
+ wk.ik_flags |= IEEE80211_KEY_DEFAULT;
wk.ik_keylen = key_len;
memcpy(wk.ik_keydata, key, key_len);
+#ifdef WORDS_BIGENDIAN
+#define WPA_KEY_RSC_LEN 8
+ {
+ size_t i;
+ u8 tmp[WPA_KEY_RSC_LEN];
+ os_memset(tmp, 0, sizeof(tmp));
+ for (i = 0; i < seq_len; i++)
+ tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
+ os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
+ }
+#else /* WORDS_BIGENDIAN */
+ os_memcpy(&wk.ik_keyrsc, seq, seq_len);
+#endif /* WORDS_BIGENDIAN */
ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk));
if (ret < 0) {

View File

@ -1,554 +0,0 @@
--- a/src/drivers/driver_hostap.c
+++ b/src/drivers/driver_hostap.c
@@ -22,9 +22,6 @@
#include "eloop.h"
#include "driver_hostap.h"
-
-#ifdef HOSTAPD
-
#include <net/if_arp.h>
#include <netpacket/packet.h>
@@ -43,10 +40,16 @@
static const u8 rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
struct hostap_driver_data {
+ void *wext; /* private data for driver_wext */
+ void *ctx;
+ char ifname[IFNAMSIZ + 1];
+ int sock;
+ int current_mode; /* infra/adhoc */
+
+#ifdef HOSTAPD
struct hostapd_data *hapd;
char iface[IFNAMSIZ + 1];
- int sock; /* raw packet socket for driver access */
int ioctl_sock; /* socket for ioctl() use */
struct netlink_data *netlink;
@@ -56,9 +59,11 @@ struct hostap_driver_data {
size_t generic_ie_len;
u8 *wps_ie;
size_t wps_ie_len;
+#endif
};
+#ifdef HOSTAPD
static int hostapd_ioctl(void *priv, struct prism2_hostapd_param *param,
int len);
static int hostap_set_iface_flags(void *priv, int dev_up);
@@ -399,65 +404,6 @@ static int hostapd_ioctl(void *priv, str
}
-static int wpa_driver_hostap_set_key(const char *ifname, void *priv,
- enum wpa_alg alg, const u8 *addr,
- int key_idx, int set_tx,
- const u8 *seq, size_t seq_len,
- const u8 *key, size_t key_len)
-{
- struct hostap_driver_data *drv = priv;
- struct prism2_hostapd_param *param;
- u8 *buf;
- size_t blen;
- int ret = 0;
-
- blen = sizeof(*param) + key_len;
- buf = os_zalloc(blen);
- if (buf == NULL)
- return -1;
-
- param = (struct prism2_hostapd_param *) buf;
- param->cmd = PRISM2_SET_ENCRYPTION;
- if (addr == NULL)
- memset(param->sta_addr, 0xff, ETH_ALEN);
- else
- memcpy(param->sta_addr, addr, ETH_ALEN);
- switch (alg) {
- case WPA_ALG_NONE:
- os_strlcpy((char *) param->u.crypt.alg, "NONE",
- HOSTAP_CRYPT_ALG_NAME_LEN);
- break;
- case WPA_ALG_WEP:
- os_strlcpy((char *) param->u.crypt.alg, "WEP",
- HOSTAP_CRYPT_ALG_NAME_LEN);
- break;
- case WPA_ALG_TKIP:
- os_strlcpy((char *) param->u.crypt.alg, "TKIP",
- HOSTAP_CRYPT_ALG_NAME_LEN);
- break;
- case WPA_ALG_CCMP:
- os_strlcpy((char *) param->u.crypt.alg, "CCMP",
- HOSTAP_CRYPT_ALG_NAME_LEN);
- break;
- default:
- os_free(buf);
- return -1;
- }
- param->u.crypt.flags = set_tx ? HOSTAP_CRYPT_FLAG_SET_TX_KEY : 0;
- param->u.crypt.idx = key_idx;
- param->u.crypt.key_len = key_len;
- memcpy((u8 *) (param + 1), key, key_len);
-
- if (hostapd_ioctl(drv, param, blen)) {
- printf("Failed to set encryption.\n");
- ret = -1;
- }
- free(buf);
-
- return ret;
-}
-
-
static int hostap_get_seqnum(const char *ifname, void *priv, const u8 *addr,
int idx, u8 *seq)
{
@@ -1171,21 +1117,9 @@ static void wpa_driver_hostap_poll_clien
hostap_send_mlme(priv, (u8 *)&hdr, sizeof(hdr));
}
-#else /* HOSTAPD */
-
-struct wpa_driver_hostap_data {
- void *wext; /* private data for driver_wext */
- void *ctx;
- char ifname[IFNAMSIZ + 1];
- int sock;
- int current_mode; /* infra/adhoc */
-};
-
-
-static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg);
-
+#endif /* HOSTAPD */
-static int hostapd_ioctl(struct wpa_driver_hostap_data *drv,
+static int wpa_hostapd_ioctl(struct hostap_driver_data *drv,
struct prism2_hostapd_param *param,
int len, int show_err)
{
@@ -1207,7 +1141,12 @@ static int hostapd_ioctl(struct wpa_driv
}
-static int wpa_driver_hostap_set_wpa_ie(struct wpa_driver_hostap_data *drv,
+#if !defined(NO_SUPPLICANT)
+
+static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg);
+
+
+static int wpa_driver_hostap_set_wpa_ie(struct hostap_driver_data *drv,
const u8 *wpa_ie, size_t wpa_ie_len)
{
struct prism2_hostapd_param *param;
@@ -1223,7 +1162,7 @@ static int wpa_driver_hostap_set_wpa_ie(
param->cmd = PRISM2_HOSTAPD_SET_GENERIC_ELEMENT;
param->u.generic_elem.len = wpa_ie_len;
os_memcpy(param->u.generic_elem.data, wpa_ie, wpa_ie_len);
- res = hostapd_ioctl(drv, param, blen, 1);
+ res = wpa_hostapd_ioctl(drv, param, blen, 1);
os_free(param);
@@ -1231,7 +1170,7 @@ static int wpa_driver_hostap_set_wpa_ie(
}
-static int prism2param(struct wpa_driver_hostap_data *drv, int param,
+static int prism2param(struct hostap_driver_data *drv, int param,
int value)
{
struct iwreq iwr;
@@ -1253,7 +1192,7 @@ static int prism2param(struct wpa_driver
static int wpa_driver_hostap_set_wpa(void *priv, int enabled)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
int ret = 0;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
@@ -1269,125 +1208,15 @@ static int wpa_driver_hostap_set_wpa(voi
}
-static void show_set_key_error(struct prism2_hostapd_param *param)
-{
- switch (param->u.crypt.err) {
- case HOSTAP_CRYPT_ERR_UNKNOWN_ALG:
- wpa_printf(MSG_INFO, "Unknown algorithm '%s'.",
- param->u.crypt.alg);
- wpa_printf(MSG_INFO, "You may need to load kernel module to "
- "register that algorithm.");
- wpa_printf(MSG_INFO, "E.g., 'modprobe hostap_crypt_wep' for "
- "WEP.");
- break;
- case HOSTAP_CRYPT_ERR_UNKNOWN_ADDR:
- wpa_printf(MSG_INFO, "Unknown address " MACSTR ".",
- MAC2STR(param->sta_addr));
- break;
- case HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED:
- wpa_printf(MSG_INFO, "Crypt algorithm initialization failed.");
- break;
- case HOSTAP_CRYPT_ERR_KEY_SET_FAILED:
- wpa_printf(MSG_INFO, "Key setting failed.");
- break;
- case HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED:
- wpa_printf(MSG_INFO, "TX key index setting failed.");
- break;
- case HOSTAP_CRYPT_ERR_CARD_CONF_FAILED:
- wpa_printf(MSG_INFO, "Card configuration failed.");
- break;
- }
-}
-
-
-static int wpa_driver_hostap_set_key(const char *ifname, void *priv,
- enum wpa_alg alg, const u8 *addr,
- int key_idx, int set_tx,
- const u8 *seq, size_t seq_len,
- const u8 *key, size_t key_len)
-{
- struct wpa_driver_hostap_data *drv = priv;
- struct prism2_hostapd_param *param;
- u8 *buf;
- size_t blen;
- int ret = 0;
- char *alg_name;
-
- switch (alg) {
- case WPA_ALG_NONE:
- alg_name = "none";
- break;
- case WPA_ALG_WEP:
- alg_name = "WEP";
- break;
- case WPA_ALG_TKIP:
- alg_name = "TKIP";
- break;
- case WPA_ALG_CCMP:
- alg_name = "CCMP";
- break;
- default:
- return -1;
- }
-
- wpa_printf(MSG_DEBUG, "%s: alg=%s key_idx=%d set_tx=%d seq_len=%lu "
- "key_len=%lu", __FUNCTION__, alg_name, key_idx, set_tx,
- (unsigned long) seq_len, (unsigned long) key_len);
-
- if (seq_len > 8)
- return -2;
-
- blen = sizeof(*param) + key_len;
- buf = os_zalloc(blen);
- if (buf == NULL)
- return -1;
-
- param = (struct prism2_hostapd_param *) buf;
- param->cmd = PRISM2_SET_ENCRYPTION;
- /* TODO: In theory, STA in client mode can use five keys; four default
- * keys for receiving (with keyidx 0..3) and one individual key for
- * both transmitting and receiving (keyidx 0) _unicast_ packets. Now,
- * keyidx 0 is reserved for this unicast use and default keys can only
- * use keyidx 1..3 (i.e., default key with keyidx 0 is not supported).
- * This should be fine for more or less all cases, but for completeness
- * sake, the driver could be enhanced to support the missing key. */
-#if 0
- if (addr == NULL)
- os_memset(param->sta_addr, 0xff, ETH_ALEN);
- else
- os_memcpy(param->sta_addr, addr, ETH_ALEN);
-#else
- os_memset(param->sta_addr, 0xff, ETH_ALEN);
-#endif
- os_strlcpy((char *) param->u.crypt.alg, alg_name,
- HOSTAP_CRYPT_ALG_NAME_LEN);
- param->u.crypt.flags = set_tx ? HOSTAP_CRYPT_FLAG_SET_TX_KEY : 0;
- param->u.crypt.idx = key_idx;
- if (seq)
- os_memcpy(param->u.crypt.seq, seq, seq_len);
- param->u.crypt.key_len = key_len;
- os_memcpy((u8 *) (param + 1), key, key_len);
-
- if (hostapd_ioctl(drv, param, blen, 1)) {
- wpa_printf(MSG_WARNING, "Failed to set encryption.");
- show_set_key_error(param);
- ret = -1;
- }
- os_free(buf);
-
- return ret;
-}
-
-
static int wpa_driver_hostap_set_countermeasures(void *priv, int enabled)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
return prism2param(drv, PRISM2_PARAM_TKIP_COUNTERMEASURES, enabled);
}
-static int wpa_driver_hostap_reset(struct wpa_driver_hostap_data *drv,
+static int wpa_driver_hostap_reset(struct hostap_driver_data *drv,
int type)
{
struct iwreq iwr;
@@ -1408,7 +1237,7 @@ static int wpa_driver_hostap_reset(struc
}
-static int wpa_driver_hostap_mlme(struct wpa_driver_hostap_data *drv,
+static int wpa_driver_hostap_mlme(struct hostap_driver_data *drv,
const u8 *addr, int cmd, int reason_code)
{
struct prism2_hostapd_param param;
@@ -1423,7 +1252,7 @@ static int wpa_driver_hostap_mlme(struct
os_memcpy(param.sta_addr, addr, ETH_ALEN);
param.u.mlme.cmd = cmd;
param.u.mlme.reason_code = reason_code;
- ret = hostapd_ioctl(drv, &param, sizeof(param), 1);
+ ret = wpa_hostapd_ioctl(drv, &param, sizeof(param), 1);
if (ret == 0) {
os_sleep(0, 100000);
ret = wpa_driver_hostap_reset(drv, 2);
@@ -1435,7 +1264,7 @@ static int wpa_driver_hostap_mlme(struct
static int wpa_driver_hostap_deauthenticate(void *priv, const u8 *addr,
int reason_code)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
return wpa_driver_hostap_mlme(drv, addr, MLME_STA_DEAUTH,
reason_code);
@@ -1445,7 +1274,7 @@ static int wpa_driver_hostap_deauthentic
static int wpa_driver_hostap_disassociate(void *priv, const u8 *addr,
int reason_code)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
return wpa_driver_hostap_mlme(drv, addr, MLME_STA_DISASSOC,
reason_code);
@@ -1456,7 +1285,7 @@ static int
wpa_driver_hostap_associate(void *priv,
struct wpa_driver_associate_params *params)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
int ret = 0;
int allow_unencrypted_eapol;
@@ -1520,7 +1349,7 @@ wpa_driver_hostap_associate(void *priv,
static int wpa_driver_hostap_scan(void *priv,
struct wpa_driver_scan_params *params)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
struct prism2_hostapd_param param;
int ret;
const u8 *ssid = params->ssids[0].ssid;
@@ -1541,7 +1370,7 @@ static int wpa_driver_hostap_scan(void *
param.cmd = PRISM2_HOSTAPD_SCAN_REQ;
param.u.scan_req.ssid_len = ssid_len;
os_memcpy(param.u.scan_req.ssid, ssid, ssid_len);
- ret = hostapd_ioctl(drv, &param, sizeof(param), 1);
+ ret = wpa_hostapd_ioctl(drv, &param, sizeof(param), 1);
/* Not all drivers generate "scan completed" wireless event, so try to
* read results after a timeout. */
@@ -1556,7 +1385,7 @@ static int wpa_driver_hostap_scan(void *
static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
int algs = 0;
if (auth_alg & WPA_AUTH_ALG_OPEN)
@@ -1574,35 +1403,35 @@ static int wpa_driver_hostap_set_auth_al
static int wpa_driver_hostap_get_bssid(void *priv, u8 *bssid)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
return wpa_driver_wext_get_bssid(drv->wext, bssid);
}
static int wpa_driver_hostap_get_ssid(void *priv, u8 *ssid)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
return wpa_driver_wext_get_ssid(drv->wext, ssid);
}
static struct wpa_scan_results * wpa_driver_hostap_get_scan_results(void *priv)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
return wpa_driver_wext_get_scan_results(drv->wext);
}
static int wpa_driver_hostap_set_operstate(void *priv, int state)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
return wpa_driver_wext_set_operstate(drv->wext, state);
}
static void * wpa_driver_hostap_init(void *ctx, const char *ifname)
{
- struct wpa_driver_hostap_data *drv;
+ struct hostap_driver_data *drv;
drv = os_zalloc(sizeof(*drv));
if (drv == NULL)
@@ -1642,14 +1471,120 @@ static void * wpa_driver_hostap_init(voi
static void wpa_driver_hostap_deinit(void *priv)
{
- struct wpa_driver_hostap_data *drv = priv;
+ struct hostap_driver_data *drv = priv;
wpa_driver_hostap_set_wpa(drv, 0);
wpa_driver_wext_deinit(drv->wext);
close(drv->sock);
os_free(drv);
}
-#endif /* HOSTAPD */
+#endif
+
+
+static void show_set_key_error(struct prism2_hostapd_param *param)
+{
+ switch (param->u.crypt.err) {
+ case HOSTAP_CRYPT_ERR_UNKNOWN_ALG:
+ wpa_printf(MSG_INFO, "Unknown algorithm '%s'.",
+ param->u.crypt.alg);
+ wpa_printf(MSG_INFO, "You may need to load kernel module to "
+ "register that algorithm.");
+ wpa_printf(MSG_INFO, "E.g., 'modprobe hostap_crypt_wep' for "
+ "WEP.");
+ break;
+ case HOSTAP_CRYPT_ERR_UNKNOWN_ADDR:
+ wpa_printf(MSG_INFO, "Unknown address " MACSTR ".",
+ MAC2STR(param->sta_addr));
+ break;
+ case HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED:
+ wpa_printf(MSG_INFO, "Crypt algorithm initialization failed.");
+ break;
+ case HOSTAP_CRYPT_ERR_KEY_SET_FAILED:
+ wpa_printf(MSG_INFO, "Key setting failed.");
+ break;
+ case HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED:
+ wpa_printf(MSG_INFO, "TX key index setting failed.");
+ break;
+ case HOSTAP_CRYPT_ERR_CARD_CONF_FAILED:
+ wpa_printf(MSG_INFO, "Card configuration failed.");
+ break;
+ }
+}
+
+
+static int wpa_driver_hostap_set_key(const char *ifname, void *priv,
+ enum wpa_alg alg, const u8 *addr,
+ int key_idx, int set_tx,
+ const u8 *seq, size_t seq_len,
+ const u8 *key, size_t key_len)
+{
+ struct hostap_driver_data *drv = priv;
+ struct prism2_hostapd_param *param;
+ u8 *buf;
+ size_t blen;
+ int ret = 0;
+ char *alg_name;
+
+ switch (alg) {
+ case WPA_ALG_NONE:
+ alg_name = "none";
+ break;
+ case WPA_ALG_WEP:
+ alg_name = "WEP";
+ break;
+ case WPA_ALG_TKIP:
+ alg_name = "TKIP";
+ break;
+ case WPA_ALG_CCMP:
+ alg_name = "CCMP";
+ break;
+ default:
+ return -1;
+ }
+
+ wpa_printf(MSG_DEBUG, "%s: alg=%s key_idx=%d set_tx=%d seq_len=%lu "
+ "key_len=%lu", __FUNCTION__, alg_name, key_idx, set_tx,
+ (unsigned long) seq_len, (unsigned long) key_len);
+
+ if (seq_len > 8)
+ return -2;
+
+ blen = sizeof(*param) + key_len;
+ buf = os_zalloc(blen);
+ if (buf == NULL)
+ return -1;
+
+ param = (struct prism2_hostapd_param *) buf;
+ param->cmd = PRISM2_SET_ENCRYPTION;
+ /* TODO: In theory, STA in client mode can use five keys; four default
+ * keys for receiving (with keyidx 0..3) and one individual key for
+ * both transmitting and receiving (keyidx 0) _unicast_ packets. Now,
+ * keyidx 0 is reserved for this unicast use and default keys can only
+ * use keyidx 1..3 (i.e., default key with keyidx 0 is not supported).
+ * This should be fine for more or less all cases, but for completeness
+ * sake, the driver could be enhanced to support the missing key. */
+ if (addr == NULL)
+ os_memset(param->sta_addr, 0xff, ETH_ALEN);
+ else
+ os_memcpy(param->sta_addr, addr, ETH_ALEN);
+ os_strlcpy((char *) param->u.crypt.alg, alg_name,
+ HOSTAP_CRYPT_ALG_NAME_LEN);
+ param->u.crypt.flags = set_tx ? HOSTAP_CRYPT_FLAG_SET_TX_KEY : 0;
+ param->u.crypt.idx = key_idx;
+ if (seq)
+ os_memcpy(param->u.crypt.seq, seq, seq_len);
+ param->u.crypt.key_len = key_len;
+ os_memcpy((u8 *) (param + 1), key, key_len);
+
+ if (wpa_hostapd_ioctl(drv, param, blen, 1)) {
+ wpa_printf(MSG_WARNING, "Failed to set encryption.");
+ show_set_key_error(param);
+ ret = -1;
+ }
+ os_free(buf);
+
+ return ret;
+}
const struct wpa_driver_ops wpa_driver_hostap_ops = {
@@ -1679,7 +1614,8 @@ const struct wpa_driver_ops wpa_driver_h
.set_ap_wps_ie = hostap_set_ap_wps_ie,
.set_freq = hostap_set_freq,
.poll_client = wpa_driver_hostap_poll_client,
-#else /* HOSTAPD */
+#endif /* HOSTAPD */
+#if !defined(NO_SUPPLICANT)
.get_bssid = wpa_driver_hostap_get_bssid,
.get_ssid = wpa_driver_hostap_get_ssid,
.set_countermeasures = wpa_driver_hostap_set_countermeasures,
@@ -1691,5 +1627,5 @@ const struct wpa_driver_ops wpa_driver_h
.init = wpa_driver_hostap_init,
.deinit = wpa_driver_hostap_deinit,
.set_operstate = wpa_driver_hostap_set_operstate,
-#endif /* HOSTAPD */
+#endif
};

View File

@ -1,18 +0,0 @@
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -685,6 +685,7 @@ static int wpa_supplicant_ctrl_iface_ibs
#endif /* CONFIG_IBSS_RSN */
+#ifdef IEEE8021X_EAPOL
int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid,
const char *field,
@@ -750,6 +751,7 @@ int wpa_supplicant_ctrl_iface_ctrl_rsp_h
return 0;
}
+#endif
static int wpa_supplicant_ctrl_iface_ctrl_rsp(struct wpa_supplicant *wpa_s,

View File

@ -1,6 +1,6 @@
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -235,6 +235,7 @@ struct hostapd_iface {
@@ -247,6 +247,7 @@ struct hostapd_iface {
int (*for_each_interface)(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
@ -10,7 +10,7 @@
/* hostapd.c */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -804,6 +804,9 @@ int hostapd_setup_interface_complete(str
@@ -851,6 +851,9 @@ int hostapd_setup_interface_complete(str
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
@ -22,7 +22,7 @@
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -36,6 +36,8 @@
@@ -31,6 +31,8 @@
extern int wpa_debug_level;
extern int wpa_debug_show_keys;
extern int wpa_debug_timestamp;
@ -31,7 +31,7 @@
extern struct wpa_driver_ops *wpa_drivers[];
@@ -173,6 +175,16 @@ static void hostapd_logger_cb(void *ctx,
@@ -145,6 +147,16 @@ static void hostapd_logger_cb(void *ctx,
}
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
@ -48,7 +48,7 @@
/**
* hostapd_init - Allocate and initialize per-interface data
@@ -194,6 +206,7 @@ static struct hostapd_iface * hostapd_in
@@ -166,6 +178,7 @@ static struct hostapd_iface * hostapd_in
if (hapd_iface == NULL)
goto fail;
@ -56,7 +56,7 @@
hapd_iface->reload_config = hostapd_reload_config;
hapd_iface->config_read_cb = hostapd_config_read;
hapd_iface->config_fname = os_strdup(config_file);
@@ -442,7 +455,7 @@ static int hostapd_global_init(struct ha
@@ -419,7 +432,7 @@ static int hostapd_global_init(struct ha
}
@ -65,7 +65,7 @@
{
int i;
@@ -472,8 +485,7 @@ static void hostapd_global_deinit(const
@@ -449,8 +462,7 @@ static void hostapd_global_deinit(const
}
@ -75,7 +75,7 @@
{
#ifdef EAP_SERVER_TNC
int tnc = 0;
@@ -494,11 +506,6 @@ static int hostapd_global_run(struct hap
@@ -471,11 +483,6 @@ static int hostapd_global_run(struct hap
}
#endif /* EAP_SERVER_TNC */
@ -87,7 +87,7 @@
eloop_run();
return 0;
@@ -555,8 +562,7 @@ int main(int argc, char *argv[])
@@ -532,8 +539,7 @@ int main(int argc, char *argv[])
struct hapd_interfaces interfaces;
int ret = 1;
size_t i;
@ -97,7 +97,7 @@
const char *log_file = NULL;
const char *entropy_file = NULL;
@@ -634,7 +640,7 @@ int main(int argc, char *argv[])
@@ -611,7 +617,7 @@ int main(int argc, char *argv[])
goto out;
}
@ -106,7 +106,7 @@
goto out;
ret = 0;
@@ -645,7 +651,7 @@ int main(int argc, char *argv[])
@@ -622,7 +628,7 @@ int main(int argc, char *argv[])
hostapd_interface_deinit_free(interfaces.iface[i]);
os_free(interfaces.iface);
@ -117,7 +117,7 @@
if (log_file)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1925,6 +1925,8 @@ struct hostapd_config * hostapd_config_r
@@ -1941,6 +1941,8 @@ static int hostapd_config_fill(struct ho
}
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N
@ -128,7 +128,7 @@
} else if (os_strcmp(buf, "ht_capab") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -412,6 +412,7 @@ struct hostapd_config {
@@ -430,6 +430,7 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
@ -138,7 +138,7 @@
int require_ht;
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -449,7 +449,7 @@ static int ieee80211n_check_40mhz(struct
@@ -451,7 +451,7 @@ static int ieee80211n_check_40mhz(struct
{
struct wpa_driver_scan_params params;

View File

@ -26,7 +26,7 @@
LIBS += $(DRV_AP_LIBS)
ifdef CONFIG_L2_PACKET
@@ -799,6 +804,12 @@ install: all
@@ -815,6 +820,12 @@ install: all
BCHECK=../src/drivers/build.hostapd
@ -39,7 +39,7 @@
hostapd: $(BCHECK) $(OBJS)
$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
@$(E) " LD " $@
@@ -837,6 +848,12 @@ HOBJS += ../src/crypto/aes-internal.o
@@ -853,6 +864,12 @@ HOBJS += ../src/crypto/aes-internal.o
HOBJS += ../src/crypto/aes-internal-enc.o
endif
@ -60,9 +60,9 @@
-include .config
+-include $(if $(MULTICALL),../hostapd/.config)
ALL=wpa_supplicant wpa_cli
BINALL=wpa_supplicant wpa_cli
@@ -663,6 +664,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
@@ -673,6 +674,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
LIBS += -ldl -rdynamic
endif
@ -73,7 +73,7 @@
endif
ifdef CONFIG_AP
@@ -671,9 +676,11 @@ NEED_EAP_COMMON=y
@@ -681,9 +686,11 @@ NEED_EAP_COMMON=y
NEED_RSN_AUTHENTICATOR=y
CFLAGS += -DCONFIG_AP
OBJS += ap.o
@ -85,9 +85,9 @@
OBJS += ../src/ap/hostapd.o
OBJS += ../src/ap/wpa_auth_glue.o
OBJS += ../src/ap/utils.o
@@ -718,10 +725,18 @@ CFLAGS += -DEAP_SERVER_WSC
OBJS += ../src/ap/wps_hostapd.o
OBJS += ../src/eap_server/eap_server_wsc.o
@@ -731,10 +738,18 @@ endif
ifdef CONFIG_INTERWORKING
OBJS += ../src/ap/gas_serv.o
endif
+else
+ ifdef MULTICALL
@ -104,9 +104,9 @@
NEED_AES_WRAP=y
OBJS += ../src/ap/wpa_auth.o
OBJS += ../src/ap/wpa_auth_ie.o
@@ -1397,6 +1412,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
$(Q)$(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS)
@$(E) " LD " $@
@@ -1415,6 +1430,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
$(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
+wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
+ $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
@ -114,11 +114,11 @@
+ @rm -f $@
+ @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
+
wpa_supplicant: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
@$(E) " LD " $@
@@ -1460,6 +1481,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2.
%.service: %.service.in
@@ -1481,6 +1502,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2.
%@.service: %.service.arg.in
sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
+dump_cflags:
@ -132,7 +132,7 @@
wpa_cli.exe: wpa_cli
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -3452,8 +3452,8 @@ union wpa_event_data {
@@ -3541,8 +3541,8 @@ union wpa_event_data {
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
@ -145,7 +145,7 @@
/*
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -467,8 +467,8 @@ static void hostapd_event_eapol_rx(struc
@@ -459,8 +459,8 @@ static void hostapd_event_eapol_rx(struc
}
@ -155,10 +155,10 @@
+ union wpa_event_data *data)
{
struct hostapd_data *hapd = ctx;
#ifndef CONFIG_NO_STDOUT_DEBUG
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -825,8 +825,8 @@ static void wpa_priv_send_ft_response(st
@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
}
@ -169,7 +169,7 @@
{
struct wpa_priv_interface *iface = ctx;
@@ -968,6 +968,7 @@ int main(int argc, char *argv[])
@@ -962,6 +962,7 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
@ -179,7 +179,7 @@
for (;;) {
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1936,8 +1936,8 @@ static void wnm_action_rx(struct wpa_sup
@@ -2046,8 +2046,8 @@ static void wnm_action_rx(struct wpa_sup
}
@ -192,8 +192,8 @@
u16 reason_code = 0;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2412,6 +2412,9 @@ static void wpa_supplicant_deinit_iface(
wpa_drv_deinit(wpa_s);
@@ -2680,6 +2680,9 @@ static void wpa_supplicant_deinit_iface(
}
}
+extern void supplicant_event(void *ctx, enum wpa_event_type event,
@ -202,7 +202,7 @@
/**
* wpa_supplicant_add_iface - Add a new network interface
@@ -2602,6 +2605,7 @@ struct wpa_global * wpa_supplicant_init(
@@ -2871,6 +2874,7 @@ struct wpa_global * wpa_supplicant_init(
wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
#endif /* CONFIG_NO_WPA_MSG */
@ -212,7 +212,7 @@
wpa_debug_open_syslog();
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -556,6 +556,9 @@ static const char * hostapd_msg_ifname_c
@@ -533,6 +533,9 @@ static const char * hostapd_msg_ifname_c
return NULL;
}
@ -222,7 +222,7 @@
int main(int argc, char *argv[])
{
@@ -569,6 +572,7 @@ int main(int argc, char *argv[])
@@ -546,6 +549,7 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
@ -232,7 +232,7 @@
if (c < 0)
--- a/src/drivers/drivers.c
+++ b/src/drivers/drivers.c
@@ -13,7 +13,11 @@
@@ -7,7 +7,11 @@
*/
#include "includes.h"

View File

@ -1,6 +1,6 @@
--- a/src/tls/x509v3.c
+++ b/src/tls/x509v3.c
@@ -1854,6 +1854,9 @@ int x509_certificate_chain_validate(stru
@@ -1848,6 +1848,9 @@ int x509_certificate_chain_validate(stru
if (chain_trusted)
continue;

View File

@ -1,6 +1,6 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2157,7 +2157,7 @@ static struct wpa_supplicant * wpa_suppl
@@ -2191,7 +2191,7 @@ static struct wpa_supplicant * wpa_suppl
if (wpa_s == NULL)
return NULL;
wpa_s->scan_req = 1;

View File

@ -1,6 +1,6 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -198,7 +198,9 @@ struct wpa_driver_nl80211_data {
@@ -211,7 +211,9 @@ struct wpa_driver_nl80211_data {
int if_removed;
int if_disabled;
int ignore_if_down_event;
@ -10,8 +10,8 @@
struct wpa_driver_capa capa;
int has_capability;
@@ -2203,7 +2205,7 @@ err3:
return -1;
@@ -2755,7 +2757,7 @@ static int wpa_driver_nl80211_init_nl(st
return 0;
}
-
@ -19,7 +19,7 @@
static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
{
wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
@@ -2226,6 +2228,7 @@ static void wpa_driver_nl80211_rfkill_un
@@ -2778,6 +2780,7 @@ static void wpa_driver_nl80211_rfkill_un
}
/* rtnetlink ifup handler will report interface as enabled */
}
@ -27,7 +27,7 @@
static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
@@ -2283,7 +2286,9 @@ static void * wpa_driver_nl80211_init(vo
@@ -2909,7 +2912,9 @@ static void * wpa_driver_nl80211_init(vo
void *global_priv)
{
struct wpa_driver_nl80211_data *drv;
@ -36,8 +36,8 @@
+#endif
struct i802_bss *bss;
drv = os_zalloc(sizeof(*drv));
@@ -2311,6 +2316,7 @@ static void * wpa_driver_nl80211_init(vo
if (global_priv == NULL)
@@ -2943,6 +2948,7 @@ static void * wpa_driver_nl80211_init(vo
nl80211_get_phy_name(drv);
@ -45,7 +45,7 @@
rcfg = os_zalloc(sizeof(*rcfg));
if (rcfg == NULL)
goto failed;
@@ -2323,6 +2329,7 @@ static void * wpa_driver_nl80211_init(vo
@@ -2955,6 +2961,7 @@ static void * wpa_driver_nl80211_init(vo
wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available");
os_free(rcfg);
}
@ -53,7 +53,7 @@
if (wpa_driver_nl80211_finish_drv_init(drv))
goto failed;
@@ -2445,10 +2452,12 @@ static int nl80211_register_action_frame
@@ -3241,10 +3248,12 @@ static void nl80211_mgmt_unsubscribe(str
}
@ -64,29 +64,29 @@
}
+#endif /* CONFIG_RFKILL */
static int
@@ -2475,13 +2484,16 @@ wpa_driver_nl80211_finish_drv_init(struc
}
if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
+#ifdef CONFIG_RFKILL
if (rfkill_is_blocked(drv->rfkill)) {
wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
"interface '%s' due to rfkill",
bss->ifname);
drv->if_disabled = 1;
send_rfkill_event = 1;
- } else {
+ } else
+#endif
+ {
wpa_printf(MSG_ERROR, "nl80211: Could not set "
"interface '%s' UP", bss->ifname);
return -1;
@@ -2510,8 +2522,10 @@ wpa_driver_nl80211_finish_drv_init(struc
wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv,
@@ -3265,13 +3274,16 @@ wpa_driver_nl80211_finish_drv_init_sta(s
}
if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) {
+#ifdef CONFIG_RFKILL
if (rfkill_is_blocked(drv->rfkill)) {
wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
"interface '%s' due to rfkill",
bss->ifname);
drv->if_disabled = 1;
*send_rfkill_event = 1;
- } else {
+ } else
+#endif
+ {
wpa_printf(MSG_ERROR, "nl80211: Could not set "
"interface '%s' UP", bss->ifname);
return -1;
@@ -3302,8 +3314,10 @@ wpa_driver_nl80211_finish_drv_init(struc
return -1;
if (send_rfkill_event) {
+#ifdef CONFIG_RFKILL
eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill,
@ -95,7 +95,7 @@
}
return 0;
@@ -2596,7 +2610,9 @@ static void wpa_driver_nl80211_deinit(vo
@@ -3389,7 +3403,9 @@ static void wpa_driver_nl80211_deinit(vo
netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, 0,
IF_OPER_UP);
@ -107,7 +107,7 @@
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -702,7 +702,7 @@ static void wpa_driver_wext_event_rtm_de
@@ -742,7 +742,7 @@ static void wpa_driver_wext_event_rtm_de
}
}
@ -116,7 +116,7 @@
static void wpa_driver_wext_rfkill_blocked(void *ctx)
{
wpa_printf(MSG_DEBUG, "WEXT: RFKILL blocked");
@@ -724,7 +724,7 @@ static void wpa_driver_wext_rfkill_unblo
@@ -764,7 +764,7 @@ static void wpa_driver_wext_rfkill_unblo
}
/* rtnetlink ifup handler will report interface as enabled */
}
@ -125,7 +125,7 @@
static void wext_get_phy_name(struct wpa_driver_wext_data *drv)
{
@@ -770,7 +770,9 @@ void * wpa_driver_wext_init(void *ctx, c
@@ -810,7 +810,9 @@ void * wpa_driver_wext_init(void *ctx, c
{
struct wpa_driver_wext_data *drv;
struct netlink_config *cfg;
@ -135,7 +135,7 @@
char path[128];
struct stat buf;
@@ -805,6 +807,7 @@ void * wpa_driver_wext_init(void *ctx, c
@@ -845,6 +847,7 @@ void * wpa_driver_wext_init(void *ctx, c
goto err2;
}
@ -143,7 +143,7 @@
rcfg = os_zalloc(sizeof(*rcfg));
if (rcfg == NULL)
goto err3;
@@ -817,6 +820,7 @@ void * wpa_driver_wext_init(void *ctx, c
@@ -857,6 +860,7 @@ void * wpa_driver_wext_init(void *ctx, c
wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available");
os_free(rcfg);
}
@ -151,7 +151,7 @@
drv->mlme_sock = -1;
@@ -828,7 +832,9 @@ void * wpa_driver_wext_init(void *ctx, c
@@ -874,7 +878,9 @@ void * wpa_driver_wext_init(void *ctx, c
return drv;
err3:
@ -161,7 +161,7 @@
netlink_deinit(drv->netlink);
err2:
close(drv->ioctl_sock);
@@ -838,10 +844,12 @@ err1:
@@ -884,10 +890,12 @@ err1:
}
@ -174,7 +174,7 @@
static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv)
@@ -849,13 +857,16 @@ static int wpa_driver_wext_finish_drv_in
@@ -895,13 +903,16 @@ static int wpa_driver_wext_finish_drv_in
int send_rfkill_event = 0;
if (linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 1) < 0) {
@ -192,7 +192,7 @@
wpa_printf(MSG_ERROR, "WEXT: Could not set "
"interface '%s' UP", drv->ifname);
return -1;
@@ -903,8 +914,10 @@ static int wpa_driver_wext_finish_drv_in
@@ -949,8 +960,10 @@ static int wpa_driver_wext_finish_drv_in
1, IF_OPER_DORMANT);
if (send_rfkill_event) {
@ -203,7 +203,7 @@
}
return 0;
@@ -934,7 +947,9 @@ void wpa_driver_wext_deinit(void *priv)
@@ -980,7 +993,9 @@ void wpa_driver_wext_deinit(void *priv)
netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
netlink_deinit(drv->netlink);
@ -215,31 +215,31 @@
eloop_unregister_read_sock(drv->mlme_sock);
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -43,7 +43,6 @@ NEED_SME=y
@@ -25,7 +25,6 @@ NEED_SME=y
NEED_AP_MLME=y
NEED_NETLINK=y
NEED_LINUX_IOCTL=y
-NEED_RFKILL=y
ifdef CONFIG_LIBNL_TINY
DRV_LIBS += -lnl-tiny
else
@@ -94,7 +93,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
ifdef CONFIG_LIBNL32
DRV_LIBS += -lnl-3
@@ -101,7 +100,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
CONFIG_WIRELESS_EXTENSION=y
NEED_NETLINK=y
NEED_LINUX_IOCTL=y
-NEED_RFKILL=y
endif
ifdef CONFIG_DRIVER_RALINK
@@ -146,7 +144,6 @@ endif
ifdef CONFIG_DRIVER_NDIS
@@ -127,7 +125,6 @@ endif
ifdef CONFIG_WIRELESS_EXTENSION
DRV_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
DRV_OBJS += ../src/drivers/driver_wext.o
DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
DRV_WPA_OBJS += ../src/drivers/driver_wext.o
-NEED_RFKILL=y
endif
ifdef NEED_NETLINK
@@ -159,6 +156,7 @@ endif
@@ -140,6 +137,7 @@ endif
ifdef NEED_RFKILL
DRV_OBJS += ../src/drivers/rfkill.o
@ -249,7 +249,7 @@
--- a/src/drivers/driver_wext.h
+++ b/src/drivers/driver_wext.h
@@ -28,7 +28,9 @@ struct wpa_driver_wext_data {
@@ -22,7 +22,9 @@ struct wpa_driver_wext_data {
int ifindex2;
int if_removed;
int if_disabled;

View File

@ -1,12 +1,12 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -124,6 +124,10 @@ int hostapd_reload_config(struct hostapd
@@ -136,6 +136,10 @@ int hostapd_reload_config(struct hostapd
oldconf = hapd->iconf;
iface->conf = newconf;
+ iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
+ if (iface->current_mode)
+ hostapd_prepare_rates(hapd, iface->current_mode);
+ hostapd_prepare_rates(iface, iface->current_mode);
+
for (j = 0; j < iface->num_bss; j++) {
hapd = iface->bss[j];

View File

@ -1,6 +1,6 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2532,22 +2532,41 @@ wpa_driver_nl80211_finish_drv_init(struc
@@ -3324,16 +3324,18 @@ wpa_driver_nl80211_finish_drv_init(struc
}
@ -21,7 +21,7 @@
return send_and_recv_msgs(drv, msg, NULL, NULL);
nla_put_failure:
+ nlmsg_free(msg);
@@ -3341,6 +3343,21 @@ static int wpa_driver_nl80211_del_beacon
return -ENOBUFS;
}
@ -38,13 +38,12 @@
+static int wpa_driver_nl80211_stop_ap(void *priv)
+{
+ struct i802_bss *bss = priv;
+
+ return wpa_driver_nl80211_del_beacon(bss->drv);
+}
/**
* wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface
@@ -7654,4 +7673,5 @@ const struct wpa_driver_ops wpa_driver_n
@@ -9054,4 +9071,5 @@ const struct wpa_driver_ops wpa_driver_n
.send_tdls_mgmt = nl80211_send_tdls_mgmt,
.tdls_oper = nl80211_tdls_oper,
#endif /* CONFIG_TDLS */
@ -52,12 +51,13 @@
};
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2452,6 +2452,8 @@ struct wpa_driver_ops {
@@ -2002,6 +2002,9 @@ struct wpa_driver_ops {
*/
void (*poll_client)(void *priv, const u8 *own_addr,
const u8 *addr, int qos);
int (*deinit_ap)(void *priv);
+
+ int (*stop_ap)(void *priv);
};
+
/**
* suspend - Notification on system suspend/hibernate event
* @priv: Private driver interface data

View File

@ -1,14 +1,14 @@
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -39,6 +39,7 @@
#include "wps/wps_defs.h"
@@ -33,6 +33,7 @@
#include "wps/wps.h"
#include "config_file.h"
#include "ctrl_iface.h"
+#include "config_file.h"
struct wpa_ctrl_dst {
@@ -49,6 +50,7 @@ struct wpa_ctrl_dst {
@@ -43,6 +44,7 @@ struct wpa_ctrl_dst {
int errors;
};
@ -16,7 +16,7 @@
static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
const char *buf, size_t len);
@@ -323,6 +325,66 @@ static int hostapd_ctrl_iface_disassocia
@@ -152,6 +154,66 @@ static int hostapd_ctrl_iface_new_sta(st
return 0;
}
@ -83,7 +83,7 @@
#ifdef CONFIG_IEEE80211W
#ifdef NEED_AP_MLME
@@ -873,6 +935,10 @@ static void hostapd_ctrl_iface_receive(i
@@ -710,6 +772,10 @@ static void hostapd_ctrl_iface_receive(i
reply_len += res;
}
#endif /* CONFIG_NO_RADIUS */

View File

@ -1,6 +1,6 @@
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -100,6 +100,8 @@ struct wpa_interface {
@@ -95,6 +95,8 @@ struct wpa_interface {
* receiving of EAPOL frames from an additional interface.
*/
const char *bridge_ifname;
@ -9,7 +9,7 @@
};
/**
@@ -260,6 +262,8 @@ struct wpa_supplicant {
@@ -263,6 +265,8 @@ struct wpa_supplicant {
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
char bridge_ifname[16];
@ -31,7 +31,7 @@
-include .config
-include $(if $(MULTICALL),../hostapd/.config)
@@ -69,6 +73,10 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctr
@@ -71,6 +75,10 @@ OBJS_c = wpa_cli.o ../src/common/wpa_ctr
OBJS_c += ../src/utils/wpa_debug.o
OBJS_c += ../src/utils/common.o
@ -44,7 +44,7 @@
CONFIG_OS=win32
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -125,6 +125,55 @@ extern int wpa_debug_show_keys;
@@ -103,6 +103,55 @@ extern int wpa_debug_show_keys;
extern int wpa_debug_timestamp;
extern struct wpa_driver_ops *wpa_drivers[];
@ -100,7 +100,7 @@
/* Configure default/group WEP keys for static WEP */
int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
{
@@ -632,8 +681,16 @@ void wpa_supplicant_set_state(struct wpa
@@ -607,8 +656,16 @@ void wpa_supplicant_set_state(struct wpa
#ifdef CONFIG_P2P
wpas_p2p_completed(wpa_s);
#endif /* CONFIG_P2P */
@ -117,7 +117,7 @@
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
#ifndef IEEE8021X_EAPOL
@@ -2245,6 +2302,21 @@ static int wpa_supplicant_init_iface(str
@@ -2498,6 +2555,21 @@ static int wpa_supplicant_init_iface(str
os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname,
sizeof(wpa_s->bridge_ifname));
}
@ -141,7 +141,7 @@
eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -17,6 +17,7 @@
@@ -11,6 +11,7 @@
#include "utils/common.h"
#include "utils/eloop.h"
#include "common/ieee802_11_defs.h"
@ -149,7 +149,7 @@
#include "drivers/driver.h"
#include "wpa_supplicant_i.h"
#include "config.h"
@@ -79,6 +80,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_
@@ -75,6 +76,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_
static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src)
{
@ -158,7 +158,7 @@
os_time_t usec;
dst->flags = src->flags;
@@ -91,6 +94,12 @@ static void wpa_bss_copy_res(struct wpa_
@@ -87,6 +90,12 @@ static void wpa_bss_copy_res(struct wpa_
dst->level = src->level;
dst->tsf = src->tsf;
@ -173,7 +173,7 @@
usec = (src->age % 1000) * 1000;
--- a/wpa_supplicant/bss.h
+++ b/wpa_supplicant/bss.h
@@ -57,6 +57,7 @@ struct wpa_bss {
@@ -51,6 +51,7 @@ struct wpa_bss {
unsigned int flags;
u8 bssid[ETH_ALEN];
u8 ssid[32];
@ -183,7 +183,7 @@
u16 beacon_int;
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -31,7 +31,7 @@ static void usage(void)
@@ -25,7 +25,7 @@ static void usage(void)
"usage:\n"
" wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] "
"[-g<global ctrl>] \\\n"
@ -192,15 +192,15 @@
"[-p<driver_param>] \\\n"
" [-b<br_ifname>] [-f<debug file>] [-e<entropy file>] "
"\\\n"
@@ -69,6 +69,7 @@ static void usage(void)
@@ -63,6 +63,7 @@ static void usage(void)
#endif /* CONFIG_DEBUG_SYSLOG */
printf(" -t = include timestamp in debug messages\n"
" -h = show this help text\n"
+ " -H = connect to a hostapd instance to manage state changes\n"
" -L = show license (GPL and BSD)\n"
" -L = show license (BSD)\n"
" -o = override driver parameter for new interfaces\n"
" -O = override ctrl_interface parameter for new interfaces\n"
@@ -145,7 +146,7 @@ int main(int argc, char *argv[])
@@ -139,7 +140,7 @@ int main(int argc, char *argv[])
wpa_supplicant_fd_workaround();
for (;;) {
@ -209,7 +209,7 @@
if (c < 0)
break;
switch (c) {
@@ -189,6 +190,9 @@ int main(int argc, char *argv[])
@@ -183,6 +184,9 @@ int main(int argc, char *argv[])
usage();
exitcode = 0;
goto out;

View File

@ -12,7 +12,7 @@
endif
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -906,6 +906,7 @@ static void hostapd_ctrl_iface_receive(i
@@ -743,6 +743,7 @@ static void hostapd_ctrl_iface_receive(i
} else if (os_strncmp(buf, "RELOG", 5) == 0) {
if (wpa_debug_reopen_file() < 0)
reply_len = -1;
@ -20,7 +20,7 @@
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
if (reply_len >= 0) {
@@ -935,10 +936,12 @@ static void hostapd_ctrl_iface_receive(i
@@ -772,10 +773,12 @@ static void hostapd_ctrl_iface_receive(i
reply_len += res;
}
#endif /* CONFIG_NO_RADIUS */
@ -33,7 +33,7 @@
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
reply_len = hostapd_ctrl_iface_sta_first(hapd, reply,
reply_size);
@@ -948,6 +951,7 @@ static void hostapd_ctrl_iface_receive(i
@@ -785,6 +788,7 @@ static void hostapd_ctrl_iface_receive(i
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
reply_size);
@ -43,7 +43,7 @@
reply_len = -1;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -709,6 +709,9 @@ ifdef CONFIG_IEEE80211N
@@ -719,6 +719,9 @@ ifdef CONFIG_IEEE80211N
OBJS += ../src/ap/ieee802_11_ht.o
endif
ifdef CONFIG_CTRL_IFACE
@ -55,7 +55,7 @@
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3231,6 +3231,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -3665,6 +3665,7 @@ char * wpa_supplicant_ctrl_iface_process
reply_len = -1;
} else if (os_strncmp(buf, "NOTE ", 5) == 0) {
wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
@ -63,7 +63,7 @@
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
if (reply_len >= 0) {
@@ -3242,6 +3243,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -3676,6 +3677,7 @@ char * wpa_supplicant_ctrl_iface_process
else
reply_len += res;
}
@ -71,7 +71,7 @@
} else if (os_strncmp(buf, "STATUS", 6) == 0) {
reply_len = wpa_supplicant_ctrl_iface_status(
wpa_s, buf + 6, reply, reply_size);
@@ -3570,6 +3572,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -4020,6 +4022,7 @@ char * wpa_supplicant_ctrl_iface_process
reply_len = wpa_supplicant_ctrl_iface_bss(
wpa_s, buf + 4, reply, reply_size);
#ifdef CONFIG_AP
@ -79,33 +79,40 @@
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
} else if (os_strncmp(buf, "STA ", 4) == 0) {
@@ -3578,6 +3581,7 @@ char * wpa_supplicant_ctrl_iface_process
@@ -4028,6 +4031,7 @@ char * wpa_supplicant_ctrl_iface_process
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
reply_size);
+#endif
#endif /* CONFIG_AP */
} else if (os_strcmp(buf, "SUSPEND") == 0) {
wpas_notify_suspend(wpa_s->global);
} else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) {
if (ap_ctrl_iface_sta_deauthenticate(wpa_s, buf + 15))
reply_len = -1;
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -24,6 +24,7 @@
#include "p2p_hostapd.h"
@@ -20,6 +20,7 @@
#include "ctrl_iface_ap.h"
#include "ap_drv_ops.h"
+#ifdef CONFIG_CTRL_IFACE_MIB
static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
struct sta_info *sta,
@@ -106,3 +107,5 @@ int hostapd_ctrl_iface_sta_next(struct h
}
@@ -103,6 +104,7 @@ int hostapd_ctrl_iface_sta_next(struct h
return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
}
+
+#endif
#ifdef CONFIG_P2P_MANAGER
static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
@@ -269,3 +271,4 @@ int hostapd_ctrl_iface_disassociate(stru
return 0;
}
+
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1926,6 +1926,7 @@ static const char * bool_txt(Boolean boo
@@ -1912,6 +1912,7 @@ static const char * bool_txt(Boolean boo
return bool ? "TRUE" : "FALSE";
}
@ -113,7 +120,7 @@
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
{
@@ -2078,6 +2079,7 @@ int ieee802_1x_get_mib_sta(struct hostap
@@ -2064,6 +2065,7 @@ int ieee802_1x_get_mib_sta(struct hostap
return len;
}
@ -123,7 +130,7 @@
struct sta_info *sta, int success)
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -2541,6 +2541,7 @@ static int wpa_cipher_bits(int cipher)
@@ -2638,6 +2638,7 @@ static int wpa_cipher_bits(int cipher)
}
}
@ -131,7 +138,7 @@
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
@@ -2704,7 +2705,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
@@ -2801,7 +2802,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
return len;
}
@ -142,7 +149,7 @@
{
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -1919,6 +1919,8 @@ static u32 wpa_cipher_suite(struct wpa_s
@@ -1918,6 +1918,8 @@ static u32 wpa_cipher_suite(struct wpa_s
}
@ -151,7 +158,7 @@
#define RSN_SUITE "%02x-%02x-%02x-%d"
#define RSN_SUITE_ARG(s) \
((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
@@ -1998,6 +2000,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
@@ -1997,6 +1999,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
return (int) len;
}

View File

@ -1,6 +1,6 @@
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -959,6 +959,31 @@ const char * wpa_key_mgmt_txt(int key_mg
@@ -953,6 +953,31 @@ const char * wpa_key_mgmt_txt(int key_mg
}
@ -32,7 +32,7 @@
int wpa_compare_rsn_ie(int ft_initial_assoc,
const u8 *ie1, size_t ie1len,
const u8 *ie2, size_t ie2len)
@@ -966,8 +991,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
@@ -960,8 +985,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
if (ie1 == NULL || ie2 == NULL)
return -1;

View File

@ -1,6 +1,6 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -720,11 +720,8 @@ int hostapd_setup_interface_complete(str
@@ -767,11 +767,8 @@ int hostapd_setup_interface_complete(str
size_t j;
u8 *prev_addr;
@ -14,7 +14,7 @@
wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (hapd->iconf->channel) {
@@ -740,7 +737,7 @@ int hostapd_setup_interface_complete(str
@@ -787,7 +784,7 @@ int hostapd_setup_interface_complete(str
hapd->iconf->secondary_channel)) {
wpa_printf(MSG_ERROR, "Could not set channel for "
"kernel driver");
@ -23,7 +23,7 @@
}
}
@@ -751,7 +748,7 @@ int hostapd_setup_interface_complete(str
@@ -798,7 +795,7 @@ int hostapd_setup_interface_complete(str
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_WARNING,
"Failed to prepare rates table.");
@ -32,7 +32,7 @@
}
}
@@ -759,14 +756,14 @@ int hostapd_setup_interface_complete(str
@@ -806,14 +803,14 @@ int hostapd_setup_interface_complete(str
hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
"kernel driver");
@ -49,7 +49,7 @@
}
prev_addr = hapd->own_addr;
@@ -776,7 +773,7 @@ int hostapd_setup_interface_complete(str
@@ -823,7 +820,7 @@ int hostapd_setup_interface_complete(str
if (j)
os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
if (hostapd_setup_bss(hapd, j == 0))
@ -58,7 +58,7 @@
if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
prev_addr = hapd->own_addr;
}
@@ -788,7 +785,7 @@ int hostapd_setup_interface_complete(str
@@ -835,7 +832,7 @@ int hostapd_setup_interface_complete(str
if (hostapd_driver_commit(hapd) < 0) {
wpa_printf(MSG_ERROR, "%s: Failed to commit driver "
"configuration", __func__);
@ -67,7 +67,7 @@
}
/*
@@ -812,6 +809,11 @@ int hostapd_setup_interface_complete(str
@@ -859,6 +856,11 @@ int hostapd_setup_interface_complete(str
iface->init_complete(iface);
return 0;

View File

@ -1,6 +1,6 @@
--- a/src/crypto/random.c
+++ b/src/crypto/random.c
@@ -38,6 +38,8 @@
@@ -32,6 +32,8 @@
#include "sha1.h"
#include "random.h"
@ -9,7 +9,7 @@
#define POOL_WORDS 32
#define POOL_WORDS_MASK (POOL_WORDS - 1)
#define POOL_TAP1 26
@@ -48,6 +50,8 @@
@@ -42,6 +44,8 @@
#define EXTRACT_LEN 16
#define MIN_READY_MARK 2
@ -18,7 +18,7 @@
static u32 pool[POOL_WORDS];
static unsigned int input_rotate = 0;
static unsigned int pool_pos = 0;
@@ -128,7 +132,7 @@ static void random_extract(u8 *out)
@@ -122,7 +126,7 @@ static void random_extract(u8 *out)
}
@ -27,7 +27,7 @@
{
struct os_time t;
static unsigned int count = 0;
@@ -197,16 +201,22 @@ int random_get_bytes(void *buf, size_t l
@@ -191,16 +195,22 @@ int random_get_bytes(void *buf, size_t l
int random_pool_ready(void)
{
#ifdef __linux__
@ -51,7 +51,7 @@
/*
* Try to fetch some more data from the kernel high quality
@@ -241,6 +251,7 @@ int random_pool_ready(void)
@@ -235,6 +245,7 @@ int random_pool_ready(void)
if (dummy_key_avail == sizeof(dummy_key)) {
if (own_pool_ready < MIN_READY_MARK)
own_pool_ready = MIN_READY_MARK;
@ -59,7 +59,7 @@
random_write_entropy();
return 1;
}
@@ -253,6 +264,7 @@ int random_pool_ready(void)
@@ -247,6 +258,7 @@ int random_pool_ready(void)
total_collected + 10 * own_pool_ready > MIN_COLLECT_ENTROPY) {
wpa_printf(MSG_INFO, "random: Allow operation to proceed "
"based on internal entropy");
@ -67,7 +67,7 @@
return 1;
}
@@ -268,10 +280,16 @@ int random_pool_ready(void)
@@ -262,10 +274,16 @@ int random_pool_ready(void)
void random_mark_pool_ready(void)
{
@ -84,7 +84,7 @@
}
@@ -428,3 +446,22 @@ void random_deinit(void)
@@ -422,3 +440,22 @@ void random_deinit(void)
os_free(random_entropy_file);
random_entropy_file = NULL;
}
@ -109,7 +109,7 @@
+}
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1137,9 +1137,8 @@ endif
@@ -1161,9 +1161,8 @@ endif
ifdef CONFIG_NO_RANDOM_POOL
CFLAGS += -DCONFIG_NO_RANDOM_POOL
@ -122,7 +122,7 @@
ifeq ($(CONFIG_CTRL_IFACE), y)
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -1132,9 +1132,8 @@ endif
@@ -1139,9 +1139,8 @@ endif
ifdef CONFIG_NO_RANDOM_POOL
L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
@ -135,7 +135,7 @@
ifeq ($(CONFIG_CTRL_IFACE), y)
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -720,11 +720,11 @@ endif
@@ -724,11 +724,11 @@ endif
ifdef CONFIG_NO_RANDOM_POOL
L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
else
@ -151,7 +151,7 @@
L_CFLAGS += -DRADIUS_SERVER
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -707,12 +707,12 @@ endif
@@ -719,12 +719,12 @@ endif
ifdef CONFIG_NO_RANDOM_POOL
CFLAGS += -DCONFIG_NO_RANDOM_POOL
else

View File

@ -1,6 +1,6 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5867,8 +5867,6 @@ static int wpa_driver_nl80211_set_mode(s
@@ -6995,8 +6995,6 @@ static int wpa_driver_nl80211_set_mode(s
ret = nl80211_set_mode(drv, drv->ifindex, nlmode);
if (ret == -EACCES)
break;
@ -9,7 +9,7 @@
if (res && !ret)
ret = -1;
else if (ret != -EBUSY)
@@ -5884,6 +5882,7 @@ static int wpa_driver_nl80211_set_mode(s
@@ -7012,6 +7010,7 @@ static int wpa_driver_nl80211_set_mode(s
"interface is down");
drv->nlmode = nlmode;
drv->ignore_if_down_event = 1;

View File

@ -1,6 +1,6 @@
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -514,6 +514,9 @@ static int hostapd_ctrl_iface_wps_ap_pin
@@ -343,6 +343,9 @@ static int hostapd_ctrl_iface_wps_ap_pin
char *pos;
const char *pin_txt;

View File

@ -1,6 +1,6 @@
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -799,11 +799,9 @@ int hostapd_init_wps(struct hostapd_data
@@ -855,11 +855,9 @@ int hostapd_init_wps(struct hostapd_data
if (conf->rsn_pairwise & WPA_CIPHER_CCMP)
wps->encr_types |= WPS_ENCR_AES;
@ -14,7 +14,7 @@
if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
wps->auth_types |= WPS_AUTH_WPAPSK;
if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
@@ -811,7 +809,7 @@ int hostapd_init_wps(struct hostapd_data
@@ -867,7 +865,7 @@ int hostapd_init_wps(struct hostapd_data
if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
wps->encr_types |= WPS_ENCR_AES;

View File

@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1935,6 +1935,10 @@ struct hostapd_config * hostapd_config_r
@@ -1951,6 +1951,10 @@ static int hostapd_config_fill(struct ho
"ht_capab", line);
errors++;
}
@ -13,7 +13,7 @@
#endif /* CONFIG_IEEE80211N */
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -416,6 +416,7 @@ struct hostapd_config {
@@ -434,6 +434,7 @@ struct hostapd_config {
int ieee80211n;
int secondary_channel;
int require_ht;
@ -23,7 +23,7 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -27,6 +27,7 @@
@@ -21,6 +21,7 @@
#include "beacon.h"
#include "iapp.h"
#include "ieee802_1x.h"
@ -31,9 +31,9 @@
#include "ieee802_11_auth.h"
#include "vlan_init.h"
#include "wpa_auth.h"
@@ -291,6 +292,7 @@ static void hostapd_cleanup_iface_pre(st
*/
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
@@ -306,6 +307,7 @@ static void hostapd_cleanup_iface_pre(st
static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
{
+ hostapd_deinit_ht(iface);
hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
@ -41,7 +41,7 @@
os_free(iface->current_rates);
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -226,6 +226,9 @@ struct hostapd_iface {
@@ -238,6 +238,9 @@ struct hostapd_iface {
/* Overlapping BSS information */
int olbc_ht;
@ -53,7 +53,7 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1193,6 +1193,9 @@ static void handle_beacon(struct hostapd
@@ -1205,6 +1205,9 @@ static void handle_beacon(struct hostapd
sizeof(mgmt->u.beacon)), &elems,
0);
@ -65,7 +65,7 @@
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -77,4 +77,17 @@ u8 * hostapd_eid_time_zone(struct hostap
@@ -73,4 +73,17 @@ u8 * hostapd_eid_time_zone(struct hostap
int hostapd_update_time_adv(struct hostapd_data *hapd);
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);

View File

@ -1,6 +1,6 @@
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -129,7 +129,7 @@ static int syslog_priority(int level)
@@ -118,7 +118,7 @@ static int syslog_priority(int level)
*
* Note: New line '\n' is added to the end of the text when printing to stdout.
*/
@ -9,7 +9,7 @@
{
va_list ap;
@@ -160,8 +160,8 @@ void wpa_printf(int level, const char *f
@@ -154,8 +154,8 @@ void wpa_printf(int level, const char *f
}
@ -20,8 +20,8 @@
{
size_t i;
if (level < wpa_debug_level)
@@ -197,20 +197,9 @@ static void _wpa_hexdump(int level, cons
#endif /* CONFIG_DEBUG_FILE */
@@ -262,20 +262,9 @@ static void _wpa_hexdump(int level, cons
#endif /* CONFIG_ANDROID_LOG */
}
-void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len)
@ -43,7 +43,7 @@
{
size_t i, llen;
const u8 *pos = buf;
@@ -294,19 +283,6 @@ static void _wpa_hexdump_ascii(int level
@@ -363,19 +352,6 @@ static void _wpa_hexdump_ascii(int level
}
@ -63,7 +63,7 @@
#ifdef CONFIG_DEBUG_FILE
static char *last_path = NULL;
#endif /* CONFIG_DEBUG_FILE */
@@ -391,7 +367,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
@@ -459,7 +435,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
}
@ -72,7 +72,7 @@
{
va_list ap;
char *buf;
@@ -425,7 +401,7 @@ void wpa_msg(void *ctx, int level, const
@@ -493,7 +469,7 @@ void wpa_msg(void *ctx, int level, const
}
@ -83,7 +83,7 @@
char *buf;
--- a/src/utils/wpa_debug.h
+++ b/src/utils/wpa_debug.h
@@ -75,6 +75,17 @@ int wpa_debug_open_file(const char *path
@@ -43,6 +43,17 @@ int wpa_debug_open_file(const char *path
int wpa_debug_reopen_file(void);
void wpa_debug_close_file(void);
@ -101,7 +101,7 @@
/**
* wpa_debug_printf_timestamp - Print timestamp for debug output
*
@@ -95,9 +106,15 @@ void wpa_debug_print_timestamp(void);
@@ -63,9 +74,15 @@ void wpa_debug_print_timestamp(void);
*
* Note: New line '\n' is added to the end of the text when printing to stdout.
*/
@ -118,7 +118,7 @@
/**
* wpa_hexdump - conditional hex dump
* @level: priority level (MSG_*) of the message
@@ -109,7 +126,13 @@ PRINTF_FORMAT(2, 3);
@@ -77,7 +94,13 @@ PRINTF_FORMAT(2, 3);
* output may be directed to stdout, stderr, and/or syslog based on
* configuration. The contents of buf is printed out has hex dump.
*/
@ -133,7 +133,7 @@
static inline void wpa_hexdump_buf(int level, const char *title,
const struct wpabuf *buf)
@@ -131,7 +154,13 @@ static inline void wpa_hexdump_buf(int l
@@ -99,7 +122,13 @@ static inline void wpa_hexdump_buf(int l
* like wpa_hexdump(), but by default, does not include secret keys (passwords,
* etc.) in debug output.
*/
@ -148,7 +148,7 @@
static inline void wpa_hexdump_buf_key(int level, const char *title,
const struct wpabuf *buf)
@@ -153,8 +182,14 @@ static inline void wpa_hexdump_buf_key(i
@@ -121,8 +150,14 @@ static inline void wpa_hexdump_buf_key(i
* the hex numbers and ASCII characters (for printable range) are shown. 16
* bytes per line will be shown.
*/
@ -165,7 +165,7 @@
/**
* wpa_hexdump_ascii_key - conditional hex dump, hide keys
@@ -170,8 +205,14 @@ void wpa_hexdump_ascii(int level, const
@@ -138,8 +173,14 @@ void wpa_hexdump_ascii(int level, const
* bytes per line will be shown. This works like wpa_hexdump_ascii(), but by
* default, does not include secret keys (passwords, etc.) in debug output.
*/
@ -182,7 +182,7 @@
/*
* wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
@@ -206,7 +247,12 @@ void wpa_hexdump_ascii_key(int level, co
@@ -172,7 +213,12 @@ void wpa_hexdump_ascii_key(int level, co
*
* Note: New line '\n' is added to the end of the text when printing to stdout.
*/
@ -196,7 +196,7 @@
/**
* wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
@@ -220,8 +266,13 @@ void wpa_msg(void *ctx, int level, const
@@ -186,8 +232,13 @@ void wpa_msg(void *ctx, int level, const
* attached ctrl_iface monitors. In other words, it can be used for frequent
* events that do not need to be sent to syslog.
*/

View File

@ -1,6 +1,6 @@
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -19,6 +19,7 @@
@@ -13,6 +13,7 @@
#include "utils/common.h"
#include "utils/eloop.h"
@ -8,7 +8,7 @@
#include "crypto/random.h"
#include "crypto/tls.h"
#include "common/version.h"
@@ -574,7 +575,7 @@ int main(int argc, char *argv[])
@@ -551,7 +552,7 @@ int main(int argc, char *argv[])
wpa_supplicant_event = hostapd_wpa_event;
for (;;) {
@ -17,7 +17,7 @@
if (c < 0)
break;
switch (c) {
@@ -606,6 +607,8 @@ int main(int argc, char *argv[])
@@ -583,6 +584,8 @@ int main(int argc, char *argv[])
wpa_debug_timestamp++;
break;
case 'v':
@ -28,7 +28,7 @@
break;
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -18,6 +18,7 @@
@@ -12,6 +12,7 @@
#endif /* __linux__ */
#include "common.h"
@ -36,7 +36,7 @@
#include "wpa_supplicant_i.h"
#include "driver_i.h"
@@ -146,7 +147,7 @@ int main(int argc, char *argv[])
@@ -140,7 +141,7 @@ int main(int argc, char *argv[])
wpa_supplicant_fd_workaround();
for (;;) {
@ -45,7 +45,7 @@
if (c < 0)
break;
switch (c) {
@@ -233,8 +234,12 @@ int main(int argc, char *argv[])
@@ -227,8 +228,12 @@ int main(int argc, char *argv[])
break;
#endif /* CONFIG_DBUS */
case 'v':

View File

@ -0,0 +1,11 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -121,7 +121,7 @@ static struct nl_handle * nl_create_hand
}
if (genl_connect(handle)) {
- wpa_printf(MSG_ERROR, "nl80211: Failed to connect to generic "
+ wpa_printf(MSG_DEBUG, "nl80211: Failed to connect to generic "
"netlink (%s)", dbg);
nl80211_handle_destroy(handle);
return NULL;

View File

@ -1,11 +0,0 @@
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -1337,7 +1337,7 @@ static void wpa_send_eapol(struct wpa_au
keyidx, encr, 0);
ctr = pairwise ? sm->TimeoutCtr : sm->GTimeoutCtr;
- if (ctr == 1 && wpa_auth->conf.tx_status)
+ if (ctr == 1 && wpa_auth->conf.tx_status && pairwise)
timeout_ms = eapol_key_timeout_first;
else
timeout_ms = eapol_key_timeout_subseq;

View File

@ -1,12 +0,0 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1774,6 +1774,9 @@ void ieee802_11_rx_from_unknown(struct h
sta = ap_get_sta(hapd, src);
if (sta && (sta->flags & WLAN_STA_ASSOC)) {
+ if (!hapd->conf->wds_sta)
+ return;
+
if (wds && !(sta->flags & WLAN_STA_WDS)) {
wpa_printf(MSG_DEBUG, "Enable 4-address WDS mode for "
"STA " MACSTR " (aid %u)",