Module Name: src
Committed By: bouyer
Date: Tue Mar 31 18:08:24 UTC 2009
Modified Files:
src/sys/dev/ic [netbsd-4]: rt2560.c rt2661.c
src/sys/dev/usb [netbsd-4]: if_rum.c if_ural.c
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1298):
sys/dev/usb/if_ural.c: revision 1.26 via patch
sys/dev/usb/if_rum.c: revision 1.17 via patch
sys/dev/ic/rt2661.c: revision 1.20 via patch
sys/dev/ic/rt2560.c: revision 1.14 via patch
Fix a number of driver which doesn't check wep flag in *_tx_mgt.
It is incorrect because we need to encrypt some management frame in case of
shared authentification.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/dev/ic/rt2560.c
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/dev/ic/rt2661.c
cvs rdiff -u -r1.3.2.4 -r1.3.2.5 src/sys/dev/usb/if_rum.c
cvs rdiff -u -r1.18.2.2 -r1.18.2.3 src/sys/dev/usb/if_ural.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/rt2560.c
diff -u src/sys/dev/ic/rt2560.c:1.7 src/sys/dev/ic/rt2560.c:1.7.2.1
--- src/sys/dev/ic/rt2560.c:1.7 Thu Nov 16 01:32:52 2006
+++ src/sys/dev/ic/rt2560.c Tue Mar 31 18:08:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2560.c,v 1.7 2006/11/16 01:32:52 christos Exp $ */
+/* $NetBSD: rt2560.c,v 1.7.2.1 2009/03/31 18:08:24 bouyer Exp $ */
/* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */
/* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
@@ -24,7 +24,7 @@
* http://www.ralinktech.com/
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.7 2006/11/16 01:32:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.7.2.1 2009/03/31 18:08:24 bouyer Exp $");
#include "bpfilter.h"
@@ -1800,6 +1800,7 @@
struct rt2560_tx_desc *desc;
struct rt2560_tx_data *data;
struct ieee80211_frame *wh;
+ struct ieee80211_key *k;
uint16_t dur;
uint32_t flags = 0;
int rate, error;
@@ -1809,6 +1810,16 @@
rate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 2;
+ wh = mtod(m0, struct ieee80211_frame *);
+
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+ k = ieee80211_crypto_encap(ic, ni, m0);
+ if (k == NULL) {
+ m_freem(m0);
+ return ENOBUFS;
+ }
+ }
+
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m0,
BUS_DMA_NOWAIT);
if (error != 0) {
Index: src/sys/dev/ic/rt2661.c
diff -u src/sys/dev/ic/rt2661.c:1.13 src/sys/dev/ic/rt2661.c:1.13.2.1
--- src/sys/dev/ic/rt2661.c:1.13 Thu Nov 16 01:32:52 2006
+++ src/sys/dev/ic/rt2661.c Tue Mar 31 18:08:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2661.c,v 1.13 2006/11/16 01:32:52 christos Exp $ */
+/* $NetBSD: rt2661.c,v 1.13.2.1 2009/03/31 18:08:24 bouyer Exp $ */
/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.13 2006/11/16 01:32:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.13.2.1 2009/03/31 18:08:24 bouyer Exp $");
#include "bpfilter.h"
@@ -1574,6 +1574,7 @@
struct rt2661_tx_desc *desc;
struct rt2661_tx_data *data;
struct ieee80211_frame *wh;
+ struct ieee80211_key *k;
uint16_t dur;
uint32_t flags = 0;
int rate, error;
@@ -1584,6 +1585,16 @@
/* send mgt frames at the lowest available rate */
rate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 2;
+ wh = mtod(m0, struct ieee80211_frame *);
+
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+ k = ieee80211_crypto_encap(ic, ni, m0);
+ if (k == NULL) {
+ m_freem(m0);
+ return ENOBUFS;
+ }
+ }
+
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m0,
BUS_DMA_NOWAIT);
if (error != 0) {
Index: src/sys/dev/usb/if_rum.c
diff -u src/sys/dev/usb/if_rum.c:1.3.2.4 src/sys/dev/usb/if_rum.c:1.3.2.5
--- src/sys/dev/usb/if_rum.c:1.3.2.4 Sat Sep 29 08:53:17 2007
+++ src/sys/dev/usb/if_rum.c Tue Mar 31 18:08:24 2009
@@ -1,5 +1,5 @@
/* $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $ */
-/* $NetBSD: if_rum.c,v 1.3.2.4 2007/09/29 08:53:17 xtraeme Exp $ */
+/* $NetBSD: if_rum.c,v 1.3.2.5 2009/03/31 18:08:24 bouyer Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <[email protected]>
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.3.2.4 2007/09/29 08:53:17 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.3.2.5 2009/03/31 18:08:24 bouyer Exp $");
#include "bpfilter.h"
@@ -1086,6 +1086,7 @@
struct rum_tx_desc *desc;
struct rum_tx_data *data;
struct ieee80211_frame *wh;
+ struct ieee80211_key *k;
uint32_t flags = 0;
uint16_t dur;
usbd_status error;
@@ -1101,6 +1102,16 @@
wh = mtod(m0, struct ieee80211_frame *);
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+ k = ieee80211_crypto_encap(ic, ni, m0);
+ if (k == NULL) {
+ m_freem(m0);
+ return ENOBUFS;
+ }
+ }
+
+ wh = mtod(m0, struct ieee80211_frame *);
+
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
flags |= RT2573_TX_ACK;
Index: src/sys/dev/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.18.2.2 src/sys/dev/usb/if_ural.c:1.18.2.3
--- src/sys/dev/usb/if_ural.c:1.18.2.2 Tue Mar 31 18:04:49 2009
+++ src/sys/dev/usb/if_ural.c Tue Mar 31 18:08:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ural.c,v 1.18.2.2 2009/03/31 18:04:49 bouyer Exp $ */
+/* $NetBSD: if_ural.c,v 1.18.2.3 2009/03/31 18:08:24 bouyer Exp $ */
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $ */
/*-
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.18.2.2 2009/03/31 18:04:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.18.2.3 2009/03/31 18:08:24 bouyer Exp $");
#include "bpfilter.h"
@@ -1211,6 +1211,7 @@
struct ural_tx_desc *desc;
struct ural_tx_data *data;
struct ieee80211_frame *wh;
+ struct ieee80211_key *k;
uint32_t flags = 0;
uint16_t dur;
usbd_status error;
@@ -1221,6 +1222,16 @@
rate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 2;
+ wh = mtod(m0, struct ieee80211_frame *);
+
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
+ k = ieee80211_crypto_encap(ic, ni, m0);
+ if (k == NULL) {
+ m_freem(m0);
+ return ENOBUFS;
+ }
+ }
+
data->m = m0;
data->ni = ni;