[oe-commits] org.oe.dreambox wpa-supplicant: add patch for rt73 support
tmbinc commit
oe at amethyst.openembedded.net
Mon May 26 21:47:01 UTC 2008
wpa-supplicant: add patch for rt73 support
Author: tmbinc at openembedded.org
Branch: org.openembedded.dreambox
Revision: aefaf77ef32f6dcdaa9cc6e9b6ac58bfc245b2ea
ViewMTN: http://monotone.openembedded.org/revision/info/aefaf77ef32f6dcdaa9cc6e9b6ac58bfc245b2ea
Files:
1
packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73-fix.patch
packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73.patch
packages/wpa-supplicant/wpa-supplicant_0.4.7.bb
Diffs:
#
# mt diff -r24ac428fb4af20dc1feaa34c196f59497b24fb47 -raefaf77ef32f6dcdaa9cc6e9b6ac58bfc245b2ea
#
#
#
# add_file "packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73-fix.patch"
# content [8c8cb57e81a79c5b2f8df1d9f6ba47ccc155edf0]
#
# add_file "packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73.patch"
# content [15951ea5f0aa07e0fc59c4ffd10d848a8754abaf]
#
# patch "packages/wpa-supplicant/wpa-supplicant_0.4.7.bb"
# from [ceb984b113c00411503c6adb653e1925e663c1e2]
# to [904614f283593c561bd6724ec644c11788a61bce]
#
============================================================
--- packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73-fix.patch 8c8cb57e81a79c5b2f8df1d9f6ba47ccc155edf0
+++ packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73-fix.patch 8c8cb57e81a79c5b2f8df1d9f6ba47ccc155edf0
@@ -0,0 +1,20 @@
+ Fix as described on
+ <URL:http://rt2x00.serialmonkey.com/phpBB2/viewtopic.php?p=18240#18240> and
+ <URL:http://rt2x00.serialmonkey.com/phpBB2/viewtopic.php?p=18314#18314>
+ (needs current rt73 from <URL:http://rt2x00.serialmonkey.com/> to work)
+
+ 2007-05-16 Milan Holzaepfel <public at mjh dot name>
+
+
+diff -Nurp wpa_supplicant-0.5.7_rt73/driver_ralink.h wpa_supplicant-0.5.7_rt73-fixed/driver_ralink.h
+--- wpa_supplicant-0.5.7_rt73/driver_ralink.h 2007-05-13 16:08:52.000000000 +0200
++++ wpa_supplicant-0.5.7_rt73-fixed/driver_ralink.h 2007-05-13 16:26:37.000000000 +0200
+@@ -15,7 +15,7 @@
+ #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
+ #endif
+
+-#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x0E)
++#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01)
+ #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
+
+ // IEEE 802.11 OIDs & Ralink defined OIDs ******
============================================================
--- packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73.patch 15951ea5f0aa07e0fc59c4ffd10d848a8754abaf
+++ packages/wpa-supplicant/wpa-supplicant-0.4.7/wpa_supplicant-ralink_rt73.patch 15951ea5f0aa07e0fc59c4ffd10d848a8754abaf
@@ -0,0 +1,1765 @@
+ driver_ralink.c and driver_ralink.h copied from [1].
+
+ Copyright header was added as specified by an Ralink employee to me by
+ mail.
+
+ Modifications to other files were done according to the instructions
+ contained in [1].
+
+ [1]: <URL:http://www.ralinktech.com.tw/data/RT73_Linux_STA_Drv1.0.3.6.tar.gz>,
+ linked from <URL:http://www.ralinktech.com/ralink/Home/Support/Linux.html>
+ as "RT2501USB(RT2571W/RT2671)"
+
+ 2007-05-16 Milan Holzaepfel <public at mjh dot name>
+
+
+diff -Nurp wpa_supplicant-0.5.7/defconfig wpa_supplicant-0.5.7_rt73/defconfig
+--- wpa_supplicant-0.5.7/defconfig 2006-10-29 19:27:49.000000000 +0100
++++ wpa_supplicant-0.5.7_rt73/defconfig 2007-05-13 16:07:19.000000000 +0200
+@@ -73,6 +73,9 @@ CONFIG_DRIVER_ATMEL=y
+ # Driver interface for Intel ipw2100/2200 driver
+ #CONFIG_DRIVER_IPW=y
+
++# Driver interface for Ralink rt73 driver
++CONFIG_DRIVER_RALINK=y
++
+ # Driver interface for generic Linux wireless extensions
+ CONFIG_DRIVER_WEXT=y
+
+diff -Nurp wpa_supplicant-0.5.7/driver_ralink.c wpa_supplicant-0.5.7_rt73/driver_ralink.c
+--- wpa_supplicant-0.5.7/driver_ralink.c 1970-01-01 01:00:00.000000000 +0100
++++ wpa_supplicant-0.5.7_rt73/driver_ralink.c 2007-05-16 15:52:17.000000000 +0200
+@@ -0,0 +1,1300 @@
++/*
++ ***************************************************************************
++ * Ralink Tech Inc.
++ * 4F, No. 2 Technology 5th Rd.
++ * Science-based Industrial Park
++ * Hsin-chu, Taiwan, R.O.C.
++ *
++ * (c) Copyright 2002-2006, Ralink Technology, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify *
++ * it under the terms of the GNU General Public License as published by *
++ * the Free Software Foundation; either version 2 of the License, or *
++ * (at your option) any later version. *
++ * *
++ * This program is distributed in the hope that it will be useful, *
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++ * GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License *
++ * along with this program; if not, write to the *
++ * Free Software Foundation, Inc., *
++ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
++ * *
++ ************************************************************************
++ */
++/*
++ * WPA Supplicant - driver interaction with Ralink rt73.o driver
++ */
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <string.h>
++#include <sys/ioctl.h>
++#include <errno.h>
++#include <sys/socket.h>
++#include <net/if_arp.h>
++
++#include <linux/if_packet.h>
++#include <linux/if_ether.h> /* The L2 protocols */
++#include <netinet/in.h>
++//#include <linux/wireless.h>
++#include "wireless_copy.h"
++
++#include "common.h"
++#include "driver.h"
++#include "l2_packet.h"
++#include "eloop.h"
++#include "wpa_supplicant.h"
++#include "priv_netlink.h"
++#include "wpa.h"
++#include "driver_ralink.h"
++#include "wpa_supplicant_i.h"
++#include "config_ssid.h"
++#include "config.h"
++
++static int scanning_done = 1;
++
++struct wpa_driver_ralink_data {
++ void *ctx;
++ int ioctl_sock;
++ int event_sock;
++ char ifname[IFNAMSIZ + 1];
++ u8 *assoc_req_ies;
++ size_t assoc_req_ies_len;
++ u8 *assoc_resp_ies;
++ size_t assoc_resp_ies_len;
++ int no_of_pmkid;
++ struct ndis_pmkid_entry *pmkid;
++ int we_version_compiled;
++};
++
++static int ralink_set_oid(struct wpa_driver_ralink_data *drv, unsigned short oid,
++ char *data, int len)
++{
++ char *buf;
++ struct iwreq iwr;
++
++ buf = malloc(len);
++ if (buf == NULL)
++ return -1;
++ memset(buf, 0,len);
++ memset(&iwr, 0, sizeof(iwr));
++ strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
++ iwr.u.data.flags = oid;
++ iwr.u.data.flags |= OID_GET_SET_TOGGLE;
++
++ if (data)
++ memcpy(buf, data, len);
++
++ iwr.u.data.pointer = (caddr_t) buf;
++ iwr.u.data.length = len;
++
++ if (ioctl(drv->ioctl_sock, RT_PRIV_IOCTL, &iwr) < 0) {
++ wpa_printf(MSG_DEBUG, "%s: oid=0x%x len (%d) failed",
++ __func__, oid, len);
++ free(buf);
++ return -1;
++ }
++ free(buf);
++ return 0;
++}
++
++static int wpa_driver_ralink_get_bssid(void *priv, u8 *bssid)
++{
++ struct wpa_driver_ralink_data *drv = priv;
++ struct iwreq iwr;
++ int ret = 0;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ memset(&iwr, 0, sizeof(iwr));
++ strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
++
++ if (ioctl(drv->ioctl_sock, SIOCGIWAP, &iwr) < 0) {
++ perror("ioctl[SIOCGIWAP]");
++ ret = -1;
++ }
++ memcpy(bssid, iwr.u.ap_addr.sa_data, ETH_ALEN);
++
++ return ret;
++}
++
++static int wpa_driver_ralink_get_ssid(void *priv, u8 *ssid)
++{
++ struct wpa_driver_ralink_data *drv = priv;
++ struct wpa_supplicant *wpa_s = drv->ctx;
++ struct wpa_ssid *entry;
++ int ssid_len;
++ u8 bssid[ETH_ALEN];
++ u8 ssid_str[MAX_SSID_LEN];
++ struct iwreq iwr;
++ int result = 0;
++ int ret = 0;
++ BOOLEAN ieee8021x_mode = FALSE;
++ BOOLEAN ieee8021x_required_key = FALSE;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ memset(&iwr, 0, sizeof(iwr));
++ strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
++ iwr.u.essid.pointer = (caddr_t) ssid;
++ iwr.u.essid.length = 32;
++
++ if (ioctl(drv->ioctl_sock, SIOCGIWESSID, &iwr) < 0) {
++ perror("ioctl[SIOCGIWESSID]");
++ ret = -1;
++ } else
++ ret = iwr.u.essid.length;
++
++ if(ret <= 0)
++ return ret;
++
++ ssid_len = ret;
++ memset(ssid_str, 0, MAX_SSID_LEN);
++ memcpy(ssid_str, ssid, ssid_len);
++
++ if(wpa_s->conf->ap_scan == 0)
++ {
++ // Read BSSID form driver
++ if (wpa_driver_ralink_get_bssid(priv, bssid) < 0) {
++ wpa_printf(MSG_WARNING, "Could not read BSSID from driver.");
++ return ret;
++ }
++
++ entry = wpa_s->conf->ssid;
++ while (entry) {
++ if (!entry->disabled && ssid_len == entry->ssid_len && memcmp(ssid_str, entry->ssid, ssid_len) == 0 &&
++ (!entry->bssid_set || memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
++ {
++ // match the config of driver
++ result = 1;
++ break;
++ }
++ entry = entry->next;
++ }
++
++ if(result)
++ {
++ wpa_printf(MSG_DEBUG, "Ready to set 802.1x mode and ieee_required_keys parameters to driver");
++
++ // set 802.1x mode and ieee_required_keys parameter
++ if(entry->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA)
++ {
++ if ((entry->eapol_flags & (EAPOL_FLAG_REQUIRE_KEY_UNICAST | EAPOL_FLAG_REQUIRE_KEY_BROADCAST)))
++ ieee8021x_required_key = TRUE;
++
++ ieee8021x_mode = TRUE;
++ }
++
++ if (ralink_set_oid(drv, OID_802_11_SET_IEEE8021X, (char *) &ieee8021x_mode, sizeof(BOOLEAN)) < 0)
++ {
++ wpa_printf(MSG_DEBUG, "RALINK: Failed to set OID_802_11_SET_IEEE8021X(%d)", (int) ieee8021x_mode);
++ }
++ else
++ {
++ wpa_printf(MSG_DEBUG, "ieee8021x_mode is %s", ieee8021x_mode ? "TRUE" : "FALSE");
++ }
++
++
++ if (ralink_set_oid(drv, OID_802_11_SET_IEEE8021X_REQUIRE_KEY, (char *) &ieee8021x_required_key, sizeof(BOOLEAN)) < 0)
++ {
++ wpa_printf(MSG_DEBUG, "ERROR: Failed to set OID_802_11_SET_IEEE8021X_REQUIRE_KEY(%d)", (int) ieee8021x_required_key);
++ }
++ else
++ {
++ wpa_printf(MSG_DEBUG, "ieee8021x_required_key is %s and eapol_flag(%d)", ieee8021x_required_key ? "TRUE" : "FALSE",
++ entry->eapol_flags);
++ }
++ }
++ }
++
++ return ret;
++}
++
++static int wpa_driver_ralink_set_ssid(struct wpa_driver_ralink_data *drv,
++ const u8 *ssid, size_t ssid_len)
++{
++ NDIS_802_11_SSID *buf;
++ int ret = 0;
++ struct iwreq iwr;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ buf = (NDIS_802_11_SSID *)malloc(sizeof(NDIS_802_11_SSID));
++ if (buf == NULL)
++ return -1;
++ memset(buf, 0, sizeof(buf));
++ buf->SsidLength = ssid_len;
++ memcpy(buf->Ssid, ssid, ssid_len);
++ memset(&iwr, 0, sizeof(iwr));
++ strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
++
++ iwr.u.data.flags = OID_802_11_SSID;
++ iwr.u.data.flags |= OID_GET_SET_TOGGLE;
++ iwr.u.data.pointer = (caddr_t) buf;
++ iwr.u.data.length = sizeof(NDIS_802_11_SSID);
++
++ if (ioctl(drv->ioctl_sock, RT_PRIV_IOCTL, &iwr) < 0) {
++ perror("ioctl[RT_PRIV_IOCTL] -- OID_802_11_SSID");
++ ret = -1;
++ }
++ free(buf);
++ return ret;
++}
++
++static void wpa_driver_ralink_event_pmkid(struct wpa_driver_ralink_data *drv,
++ const u8 *data, size_t data_len)
++{
++ NDIS_802_11_PMKID_CANDIDATE_LIST *pmkid;
++ int i;
++ union wpa_event_data event;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ if (data_len < 8) {
++ wpa_printf(MSG_DEBUG, "RALINK: Too short PMKID Candidate List "
++ "Event (len=%d)", data_len);
++ return;
++ }
++ pmkid = (NDIS_802_11_PMKID_CANDIDATE_LIST *) data;
++ wpa_printf(MSG_DEBUG, "RALINK: PMKID Candidate List Event - Version %d "
++ "NumCandidates %d",
++ (int) pmkid->Version, (int) pmkid->NumCandidates);
++
++ if (pmkid->Version != 1) {
++ wpa_printf(MSG_DEBUG, "RALINK: Unsupported PMKID Candidate List "
++ "Version %d", (int) pmkid->Version);
++ return;
++ }
++
++ if (data_len < 8 + pmkid->NumCandidates * sizeof(PMKID_CANDIDATE)) {
++ wpa_printf(MSG_DEBUG, "RALINK: PMKID Candidate List underflow");
++ return;
++ }
++
++ memset(&event, 0, sizeof(event));
++ for (i = 0; i < pmkid->NumCandidates; i++) {
++ PMKID_CANDIDATE *p = &pmkid->CandidateList[i];
++ wpa_printf(MSG_DEBUG, "RALINK: %d: " MACSTR " Flags 0x%x",
++ i, MAC2STR(p->BSSID), (int) p->Flags);
++ memcpy(event.pmkid_candidate.bssid, p->BSSID, ETH_ALEN);
++ event.pmkid_candidate.index = i;
++ event.pmkid_candidate.preauth =
++ p->Flags & NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED;
++ wpa_supplicant_event(drv->ctx, EVENT_PMKID_CANDIDATE,
++ &event);
++ }
++}
++
++static int wpa_driver_ralink_set_pmkid(struct wpa_driver_ralink_data *drv)
++{
++ int len, count, i, ret;
++ struct ndis_pmkid_entry *entry;
++ NDIS_802_11_PMKID *p;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ count = 0;
++ entry = drv->pmkid;
++ while (entry) {
++ count++;
++ if (count >= drv->no_of_pmkid)
++ break;
++ entry = entry->next;
++ }
++ len = 8 + count * sizeof(BSSID_INFO);
++ p = malloc(len);
++ if (p == NULL)
++ return -1;
++ memset(p, 0, len);
++ p->Length = len;
++ p->BSSIDInfoCount = count;
++ entry = drv->pmkid;
++ for (i = 0; i < count; i++) {
++ memcpy(&p->BSSIDInfo[i].BSSID, entry->bssid, ETH_ALEN);
++ memcpy(&p->BSSIDInfo[i].PMKID, entry->pmkid, 16);
++ entry = entry->next;
++ }
++ wpa_hexdump(MSG_MSGDUMP, "NDIS: OID_802_11_PMKID", (char *) p, len);
++ ret = ralink_set_oid(drv, OID_802_11_PMKID, (char *) p, len);
++ free(p);
++ return ret;
++}
++
++static int wpa_driver_ralink_add_pmkid(void *priv, const u8 *bssid,
++ const u8 *pmkid)
++{
++ struct wpa_driver_ralink_data *drv = priv;
++ struct ndis_pmkid_entry *entry, *prev;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ if (drv->no_of_pmkid == 0)
++ return 0;
++
++ prev = NULL;
++ entry = drv->pmkid;
++ while (entry) {
++ if (memcmp(entry->bssid, bssid, ETH_ALEN) == 0)
++ break;
++ prev = entry;
++ entry = entry->next;
++ }
++
++ if (entry) {
++ /* Replace existing entry for this BSSID and move it into the
++ * beginning of the list. */
++ memcpy(entry->pmkid, pmkid, 16);
++ if (prev) {
++ prev->next = entry->next;
++ entry->next = drv->pmkid;
++ drv->pmkid = entry;
++ }
++ } else {
++ entry = malloc(sizeof(*entry));
++ if (entry) {
++ memcpy(entry->bssid, bssid, ETH_ALEN);
++ memcpy(entry->pmkid, pmkid, 16);
++ entry->next = drv->pmkid;
++ drv->pmkid = entry;
++ }
++ }
++
++ return wpa_driver_ralink_set_pmkid(drv);
++}
++
++
++static int wpa_driver_ralink_remove_pmkid(void *priv, const u8 *bssid,
++ const u8 *pmkid)
++{
++ struct wpa_driver_ralink_data *drv = priv;
++ struct ndis_pmkid_entry *entry, *prev;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ if (drv->no_of_pmkid == 0)
++ return 0;
++
++ entry = drv->pmkid;
++ prev = NULL;
++ drv->pmkid = NULL;
++ while (entry) {
++ if (memcmp(entry->bssid, bssid, ETH_ALEN) == 0 &&
++ memcmp(entry->pmkid, pmkid, 16) == 0) {
++ if (prev)
++ prev->next = entry->next;
++ else
++ drv->pmkid = entry->next;
++ free(entry);
++ break;
++ }
++ prev = entry;
++ entry = entry->next;
++ }
++ return wpa_driver_ralink_set_pmkid(drv);
++}
++
++
++static int wpa_driver_ralink_flush_pmkid(void *priv)
++{
++ struct wpa_driver_ralink_data *drv = priv;
++ NDIS_802_11_PMKID p;
++ struct ndis_pmkid_entry *pmkid, *prev;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ if (drv->no_of_pmkid == 0)
++ return 0;
++
++ pmkid = drv->pmkid;
++ drv->pmkid = NULL;
++ while (pmkid) {
++ prev = pmkid;
++ pmkid = pmkid->next;
++ free(prev);
++ }
++
++ memset(&p, 0, sizeof(p));
++ p.Length = 8;
++ p.BSSIDInfoCount = 0;
++ wpa_hexdump(MSG_MSGDUMP, "NDIS: OID_802_11_PMKID (flush)",
++ (char *) &p, 8);
++ return ralink_set_oid(drv, OID_802_11_PMKID, (char *) &p, 8);
++}
++
++static void
++wpa_driver_ralink_event_wireless_custom(struct wpa_driver_ralink_data *drv,
++ void *ctx, char *custom)
++{
++ union wpa_event_data data;
++
++ wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
++
++ wpa_printf(MSG_DEBUG, "Custom wireless event: '%s'", custom);
++
++ memset(&data, 0, sizeof(data));
++ /* Host AP driver */
++ if (strncmp(custom, "MLME-MICHAELMICFAILURE.indication", 33) == 0) {
++ data.michael_mic_failure.unicast =
++ strstr(custom, " unicast ") != NULL;
++ /* TODO: parse parameters(?) */
++ wpa_supplicant_event(ctx, EVENT_MICHAEL_MIC_FAILURE, &data);
++ }
++ else if (strncmp(custom, "ASSOCINFO(ReqIEs=", 17) == 0) {
++ char *spos;
++ int bytes;
++
++ spos = custom + 17;
++
++ bytes = strspn(spos, "0123456789abcdefABCDEF");
++ if (!bytes || (bytes & 1))
++ return;
++ bytes%s
>>> DIFF TRUNCATED @ 16K
More information about the Openembedded-commits
mailing list