{
struct madwifi_driver_data *drv = priv;
struct ieee80211req_key wk;
-@@ -462,10 +459,14 @@ 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;
-+
- if (addr == NULL) {
+@@ -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 {
memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
wk.ik_keyix = IEEE80211_KEYIX_NONE;
-@@ -485,6 +486,7 @@ wpa_driver_madwifi_set_key(const char *i
+@@ -485,6 +485,7 @@ wpa_driver_madwifi_set_key(const char *i
}
static int
madwifi_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
u8 *seq)
-@@ -591,7 +593,7 @@ madwifi_read_sta_driver_data(void *priv,
+@@ -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,
f = fopen(buf, "r");
if (!f) {
-@@ -757,7 +759,7 @@ static int madwifi_receive_probe_req(str
+@@ -759,7 +760,7 @@ static int madwifi_receive_probe_req(str
if (ret)
return ret;
madwifi_raw_receive, drv, 1);
if (drv->sock_raw == NULL)
return -1;
-@@ -1017,7 +1019,7 @@ madwifi_get_we_version(struct madwifi_dr
+@@ -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));
iwr.u.data.pointer = (caddr_t) range;
iwr.u.data.length = buflen;
-@@ -1134,17 +1136,17 @@ madwifi_init(struct hostapd_data *hapd,
+@@ -1154,17 +1155,17 @@ madwifi_init(struct hostapd_data *hapd,
perror("socket[PF_INET,SOCK_DGRAM]");
goto bad;
}
handle_read, drv, 1);
if (drv->sock_xmit == NULL)
goto bad;
-@@ -1158,7 +1160,7 @@ madwifi_init(struct hostapd_data *hapd,
+@@ -1178,7 +1179,7 @@ madwifi_init(struct hostapd_data *hapd,
1);
if (drv->sock_recv == NULL)
goto bad;
wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for "
"EAPOL receive", brname);
drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL,
-@@ -1169,7 +1171,7 @@ madwifi_init(struct hostapd_data *hapd,
+@@ -1189,7 +1190,7 @@ madwifi_init(struct hostapd_data *hapd,
drv->sock_recv = drv->sock_xmit;
memset(&iwr, 0, sizeof(iwr));
iwr.u.mode = IW_MODE_MASTER;
-@@ -1180,7 +1182,7 @@ madwifi_init(struct hostapd_data *hapd,
+@@ -1200,7 +1201,7 @@ madwifi_init(struct hostapd_data *hapd,
}
/* mark down during setup */
madwifi_set_privacy(drv, 0); /* default to no privacy */
madwifi_receive_probe_req(drv);
-@@ -1206,7 +1208,7 @@ madwifi_deinit(void *priv)
+@@ -1226,7 +1227,7 @@ madwifi_deinit(void *priv)
struct madwifi_driver_data *drv = priv;
netlink_deinit(drv->netlink);
if (drv->ioctl_sock >= 0)
close(drv->ioctl_sock);
if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit)
-@@ -1225,7 +1227,7 @@ madwifi_set_ssid(void *priv, const u8 *b
+@@ -1245,7 +1246,7 @@ madwifi_set_ssid(void *priv, const u8 *b
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
iwr.u.essid.flags = 1; /* SSID active */
iwr.u.essid.pointer = (caddr_t) buf;
iwr.u.essid.length = len + 1;
-@@ -1246,7 +1248,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in
+@@ -1266,7 +1267,7 @@ madwifi_get_ssid(void *priv, u8 *buf, in
int ret = 0;
memset(&iwr, 0, sizeof(iwr));
iwr.u.essid.pointer = (caddr_t) buf;
iwr.u.essid.length = len;
-@@ -1271,140 +1273,19 @@ static int
+@@ -1291,140 +1292,19 @@ static int
madwifi_commit(void *priv)
{
struct madwifi_driver_data *drv = priv;
- return 0;
-}
-
--static int
+ static int
-set80211param(struct wpa_driver_madwifi_data *drv, int op, int arg,
- int show_err)
-{
- return 0;
-}
-
- static int
+-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;
-@@ -1415,7 +1296,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
+@@ -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;
perror("ioctl[IEEE80211_IOCTL_SETOPTIE]");
return -1;
}
-@@ -1423,156 +1304,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
+@@ -1443,157 +1323,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
}
static int
- 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));
- os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
- }
-#else /* WORDS_BIGENDIAN */
-- os_memcpy(&wk.ik_keyrsc, seq, seq_len);
+- if (seq)
+- os_memcpy(&wk.ik_keyrsc, seq, seq_len);
-#endif /* WORDS_BIGENDIAN */
- os_memcpy(wk.ik_keydata, key, key_len);
-
ret = -1;
if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
-@@ -1595,12 +1371,12 @@ wpa_driver_madwifi_associate(void *priv,
+@@ -1616,12 +1390,12 @@ wpa_driver_madwifi_associate(void *priv,
params->wpa_ie_len == 0)
privacy = 0;
ret = -1;
if (params->bssid == NULL) {
-@@ -1608,14 +1384,14 @@ wpa_driver_madwifi_associate(void *priv,
+@@ -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 */
ret = -1;
if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
params->ssid_len) < 0)
-@@ -1624,7 +1400,7 @@ wpa_driver_madwifi_associate(void *priv,
+@@ -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,
wpa_printf(MSG_DEBUG, "%s: SETMLME[ASSOC] failed",
__func__);
ret = -1;
-@@ -1637,7 +1413,7 @@ wpa_driver_madwifi_associate(void *priv,
+@@ -1658,7 +1432,7 @@ wpa_driver_madwifi_associate(void *priv,
static int
wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg)
{
int authmode;
if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
-@@ -1648,13 +1424,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr
+@@ -1669,13 +1443,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr
else
authmode = IEEE80211_AUTH_OPEN;
struct iwreq iwr;
int ret = 0;
const u8 *ssid = params->ssids[0].ssid;
-@@ -1672,7 +1448,7 @@ wpa_driver_madwifi_scan(void *priv, stru
+@@ -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;
perror("ioctl[SIOCSIWSCAN]");
ret = -1;
}
-@@ -1694,14 +1470,14 @@ wpa_driver_madwifi_scan(void *priv, stru
+@@ -1715,14 +1489,14 @@ wpa_driver_madwifi_scan(void *priv, stru
static int wpa_driver_madwifi_get_bssid(void *priv, u8 *bssid)
{
return wpa_driver_wext_get_ssid(drv->wext, ssid);
}
-@@ -1709,14 +1485,16 @@ static int wpa_driver_madwifi_get_ssid(v
+@@ -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)
{
return wpa_driver_wext_set_operstate(drv->wext, state);
}
-@@ -1737,7 +1515,7 @@ static int wpa_driver_madwifi_set_probe_
+@@ -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) +
os_free(probe_req_ie);
-@@ -1747,7 +1525,7 @@ static int wpa_driver_madwifi_set_probe_
+@@ -1768,7 +1544,7 @@ static int wpa_driver_madwifi_set_probe_
static void * wpa_driver_madwifi_init(void *ctx, const char *ifname)
{
drv = os_zalloc(sizeof(*drv));
if (drv == NULL)
-@@ -1758,17 +1536,17 @@ static void * wpa_driver_madwifi_init(vo
+@@ -1779,17 +1555,17 @@ static void * wpa_driver_madwifi_init(vo
drv->ctx = ctx;
os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support",
__FUNCTION__);
goto fail3;
-@@ -1777,7 +1555,7 @@ static void * wpa_driver_madwifi_init(vo
+@@ -1798,7 +1574,7 @@ static void * wpa_driver_madwifi_init(vo
return drv;
fail3:
fail2:
wpa_driver_wext_deinit(drv->wext);
fail:
-@@ -1788,38 +1566,37 @@ fail:
+@@ -1809,38 +1585,37 @@ fail:
static void wpa_driver_madwifi_deinit(void *priv)
{
#ifdef HOSTAPD
.hapd_init = madwifi_init,
.hapd_deinit = madwifi_deinit,
-@@ -1839,7 +1616,8 @@ const struct wpa_driver_ops wpa_driver_m
- .sta_clear_stats = madwifi_sta_clear_stats,
+@@ -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,
-@@ -1851,5 +1629,5 @@ const struct wpa_driver_ops wpa_driver_m
+@@ -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
+