Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ral and wpa_supplicant, anybody running this?



Dear Quentin,

with the following patch, I have wpa_supplicant running now. (The patch is against a netbsd-5 tree with your driver patch already applied to)

# diff -w -b -u rt2860.c.orig rt2860.c
--- rt2860.c.orig       2010-02-16 20:36:51.000000000 +0100
+++ rt2860.c    2010-02-20 17:08:48.000000000 +0100
@@ -258,9 +258,9 @@
            IEEE80211_C_HOSTAP |        /* HostAP mode supported */
            IEEE80211_C_TXPMGT |        /* tx power management */
            IEEE80211_C_SHPREAMBLE |    /* short preamble supported */
-           IEEE80211_C_SHSLOT;/* | */  /* short slot time supported */
-           /*IEEE80211_C_WEP |*/               /* s/w WEP */
-           /*IEEE80211_C_WPA;*/                /* WPA/RSN */
+           IEEE80211_C_SHSLOT|/* | */  /* short slot time supported */
+           IEEE80211_C_WEP |           /* s/w WEP */
+           IEEE80211_C_WPA;            /* WPA/RSN */

        if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) {
                /* set supported .11a rates */
@@ -1040,9 +1040,9 @@
 {
        struct ieee80211com *ic = &sc->sc_ic;
        struct ifnet *ifp = ic->ic_ifp;
-       struct ieee80211_frame *wh;
+       struct ieee80211_frame *wh = NULL;
        struct ieee80211_node *ni;
-       struct mbuf *m, *mnew;
+       struct mbuf *m = NULL, *mnew;
        uint8_t ant, rssi;
        int error;
        bool decrypted = false;
@@ -1069,6 +1069,13 @@
                        goto skip;
                }

+               if (rxd->flags & htole32(RT2860_RX_MICERR)) {
+ ieee80211_notify_michael_failure(ic, wh, 0 /* XXX */);
+                       ifp->if_ierrors++;
+                       m_freem(m);
+                       goto skip;
+               }
+
                MGETHDR(mnew, M_DONTWAIT, MT_DATA);
                if (mnew == NULL) {
                        ifp->if_ierrors++;
@@ -1121,14 +1128,8 @@

                wh = mtod(m, struct ieee80211_frame *);

-               if (rxd->flags & htole32(RT2860_RX_MICERR)) {
- ieee80211_notify_michael_failure(ic, wh, 0 /* XXX */);
-                       ifp->if_ierrors++;
-                       m_freem(m);
-                       goto skip;
-               }

-#define HW_WEP
+//#define HW_WEP
 #ifdef HW_WEP
                if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
                        /*
@@ -1380,6 +1381,7 @@
        struct rt2860_tx_data *data;
        struct rt2860_txd *txd;
        struct rt2860_txwi *txwi;
+       struct ieee80211_key *k;
        struct ieee80211_frame *wh;
        bus_dma_segment_t *seg;
        u_int hdrlen;
@@ -1408,6 +1410,18 @@
        /* get MCS code from rate */
        mcs = rt2860_rate2mcs(rate);

+       if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+               k = ieee80211_crypto_encap(ic, ni, m0);
+               if (k == NULL) {
+                       m_freem(m0);
+                       return ENOBUFS;
+               }
+
+               /* packet header may have moved, reset our local pointer */
+               wh = mtod(m0, struct ieee80211_frame *);
+       }
+
+
        /* setup TX Wireless Information */
        txwi = data->txwi;
        memset(txwi, 0, sizeof (struct rt2860_txwi));
@@ -2157,7 +2171,7 @@
                return EINVAL;
        }

-       if (1) {//k->wk_flags & IEEE80211_KEY_GROUP) {
+ if (k->wk_flags & IEEE80211_KEY_GROUP) {//k->wk_flags & IEEE80211_KEY_GROUP) {
                /* install group key */
                base = RT2860_SKEY(0, k->wk_keyix);
                if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) {


I only have access to WPA networks, so I haven't checked for WEP-only (especially not without wpa_supplicant), but WPA and WPA2 works for me.

I Cc to current-users if someone finds the patch useful...

Of course it would be nice to see all this in-tree some day ;-)

BR

   Torsten


--
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>                                                              <>
<> Dr. Torsten Harenberg     harenberg%physik.uni-wuppertal.de@localhost  <>
<> Bergische Universitaet                                       <>
<> FB C - Physik             Tel.: +49 (0)202 439-3521          <>
<> Gaussstr. 20              Fax : +49 (0)202 439-2811          <>
<> 42097 Wuppertal                                              <>
<>                                                              <>
<><><><><><><>< Of course it runs NetBSD http://www.netbsd.org ><>


Home | Main Index | Thread Index | Old Index