PERFORCE change 139170 for review
Sam Leffler
sam at FreeBSD.org
Tue Apr 1 15:05:55 PDT 2008
http://perforce.freebsd.org/chv.cgi?CH=139170
Change 139170 by sam at sam_ebb on 2008/04/01 22:05:16
split crypto capabilities into their own area and explicitly
connect the bits to the cipher values; we were out of capability
bits and the cipher caps need to grow too
Affected files ...
.. //depot/projects/vap/sbin/ifconfig/ifieee80211.c#17 edit
.. //depot/projects/vap/sys/conf/files#27 edit
.. //depot/projects/vap/sys/dev/ath/if_ath.c#55 edit
.. //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#9 edit
.. //depot/projects/vap/sys/dev/mwl/if_mwl.c#2 edit
.. //depot/projects/vap/sys/dev/wi/if_wi.c#21 edit
.. //depot/projects/vap/sys/net80211/ieee80211.c#32 edit
.. //depot/projects/vap/sys/net80211/ieee80211_crypto.c#11 edit
.. //depot/projects/vap/sys/net80211/ieee80211_crypto.h#11 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ddb.c#9 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#49 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ioctl.h#17 edit
.. //depot/projects/vap/sys/net80211/ieee80211_var.h#35 edit
Differences ...
==== //depot/projects/vap/sbin/ifconfig/ifieee80211.c#17 (text+ko) ====
@@ -3061,23 +3061,33 @@
}
#define IEEE80211_C_BITS \
-"\020\1WEP\2TKIP\3AES\4AES_CCM\6CKIP\7FF\10TURBOP\11IBSS\12PMGT\13HOSTAP\14AHDEMO" \
-"\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE\21MONITOR\22TKIPMIC\30WPA1" \
-"\31WPA2\32BURST\33WME\34WDS\36BGSCAN\37TXFRAG"
+ "\20\7FF\10TURBOP\11IBSS\12PMGT" \
+ "\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
+ "\21MONITOR\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
+ "\37TXFRAG"
+
+#define IEEE80211_CRYPTO_BITS \
+ "\20\1WEP\2TKIP\3AES\4AES_CCM\5TKIPMIC\6CKIP\12PMGT"
+
+#define IEEE80211_HTCAP_BITS \
+ "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
+ "\21AMPDU\22AMSDU\23HT"
static void
list_capabilities(int s)
{
- struct ieee80211req ireq;
- u_int32_t caps;
+ struct ieee80211_devcaps_req dc;
- (void) memset(&ireq, 0, sizeof(ireq));
- (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
- ireq.i_type = IEEE80211_IOC_DRIVER_CAPS;
- if (ioctl(s, SIOCG80211, &ireq) < 0)
- errx(1, "unable to get driver capabilities");
- caps = (((u_int16_t) ireq.i_val) << 16) | ((u_int16_t) ireq.i_len);
- printb(name, caps, IEEE80211_C_BITS);
+ getdevcaps(s, &dc);
+ printb("drivercaps", dc.dc_drivercaps, IEEE80211_C_BITS);
+ if (dc.dc_cryptocaps != 0 || verbose) {
+ putchar('\n');
+ printb("cryptocaps", dc.dc_cryptocaps, IEEE80211_CRYPTO_BITS);
+ }
+ if (dc.dc_htcaps != 0 || verbose) {
+ putchar('\n');
+ printb("htcaps", dc.dc_htcaps, IEEE80211_HTCAP_BITS);
+ }
putchar('\n');
}
==== //depot/projects/vap/sys/conf/files#27 (text+ko) ====
@@ -1161,6 +1161,7 @@
dev/usb/ufm.c optional ufm
dev/usb/uftdi.c optional uftdi
dev/usb/ugen.c optional ugen
+dev/usb/ugencom.c optional ugencom
dev/usb/uhci.c optional uhci
dev/usb/uhci_pci.c optional uhci pci
dev/usb/uhid.c optional uhid
==== //depot/projects/vap/sys/dev/ath/if_ath.c#55 (text+ko) ====
@@ -524,22 +524,22 @@
* Query the hal to figure out h/w crypto support.
*/
if (ath_hal_ciphersupported(ah, HAL_CIPHER_WEP))
- ic->ic_caps |= IEEE80211_C_WEP;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP);
if (ath_hal_ciphersupported(ah, HAL_CIPHER_AES_OCB))
- ic->ic_caps |= IEEE80211_C_AES;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_AES_OCB);
if (ath_hal_ciphersupported(ah, HAL_CIPHER_AES_CCM))
- ic->ic_caps |= IEEE80211_C_AES_CCM;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_AES_CCM);
if (ath_hal_ciphersupported(ah, HAL_CIPHER_CKIP))
- ic->ic_caps |= IEEE80211_C_CKIP;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_CKIP);
if (ath_hal_ciphersupported(ah, HAL_CIPHER_TKIP)) {
- ic->ic_caps |= IEEE80211_C_TKIP;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIP);
/*
* Check if h/w does the MIC and/or whether the
* separate key cache entries are required to
* handle both tx+rx MIC keys.
*/
if (ath_hal_ciphersupported(ah, HAL_CIPHER_MIC))
- ic->ic_caps |= IEEE80211_C_TKIPMIC;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIPMIC);
/*
* If the h/w supports storing tx+rx MIC keys
* in one cache slot automatically enable use.
==== //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#9 (text+ko) ====
@@ -872,20 +872,22 @@
arg = NDIS_80211_WEPSTAT_ENC3ENABLED;
r = ndis_set_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &i);
if (r == 0) {
- ic->ic_caps |= IEEE80211_C_WEP|IEEE80211_C_TKIP|
- IEEE80211_C_AES_CCM;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP);
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIP);
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_AES_CCM);
goto got_crypto;
}
arg = NDIS_80211_WEPSTAT_ENC2ENABLED;
r = ndis_set_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &i);
if (r == 0) {
- ic->ic_caps |= IEEE80211_C_WEP|IEEE80211_C_TKIP;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP);
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIP);
goto got_crypto;
}
arg = NDIS_80211_WEPSTAT_ENC1ENABLED;
r = ndis_set_info(sc, OID_802_11_ENCRYPTION_STATUS, &arg, &i);
if (r == 0)
- ic->ic_caps |= IEEE80211_C_WEP;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP);
got_crypto:
i = sizeof(arg);
r = ndis_get_info(sc, OID_802_11_POWER_MODE, &arg, &i);
@@ -2061,19 +2063,19 @@
len = sizeof(arg);
if (cipher == WPA_CSE_WEP40 || WPA_CSE_WEP104) {
- if (!(ic->ic_caps & IEEE80211_C_WEP))
+ if (!isset(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP))
return(ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC1ENABLED;
}
if (cipher == WPA_CSE_TKIP) {
- if (!(ic->ic_caps & IEEE80211_C_TKIP))
+ if (!isset(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIP))
return(ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC2ENABLED;
}
if (cipher == WPA_CSE_CCMP) {
- if (!(ic->ic_caps & IEEE80211_C_AES_CCM))
+ if (!isset(ic->ic_cryptocaps, IEEE80211_CIPHER_AES_CCM))
return(ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC3ENABLED;
}
==== //depot/projects/vap/sys/dev/mwl/if_mwl.c#2 (text+ko) ====
@@ -440,15 +440,9 @@
| IEEE80211_C_WPA /* capable of WPA1+WPA2 */
| IEEE80211_C_BGSCAN /* capable of bg scanning */
| IEEE80211_C_TXFRAG /* handle tx frags */
- /*
- * XXX no way to query h/w support.
- */
- | IEEE80211_C_WEP /* h/w WEP supported */
- | IEEE80211_C_AES_CCM /* h/w AES supported */
- | IEEE80211_C_TKIP /* h/w TKIP supported */
- | IEEE80211_C_TKIPMIC /* h/w TKIP MIC supported */
| IEEE80211_C_TXPMGT /* capable of txpow mgt */
;
+
ic->ic_htcaps =
IEEE80211_HTCAP_SMPS_ENA /* SM PS mode enabled */
| IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width */
@@ -471,6 +465,15 @@
;
/*
+ * Mark h/w crypto support.
+ * XXX no way to query h/w support.
+ */
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP);
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_AES_CCM);
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIP);
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_TKIPMIC);
+
+ /*
* Transmit requires space in the packet for a special
* format transmit record and optional padding between
* this record and the payload. Ask the net80211 layer
==== //depot/projects/vap/sys/dev/wi/if_wi.c#21 (text+ko) ====
@@ -407,7 +407,7 @@
buflen = sizeof(val);
if (wi_read_rid(sc, WI_RID_WEP_AVAIL, &val, &buflen) == 0 &&
val != htole16(0))
- ic->ic_caps |= IEEE80211_C_WEP;
+ setbit(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP);
/* Find supported rates. */
buflen = sizeof(ratebuf);
@@ -826,7 +826,7 @@
ieee80211_chan2ieee(ic, bss->ni_chan));
/* Configure WEP. */
- if (ic->ic_caps & IEEE80211_C_WEP)
+ if (isset(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP))
wi_write_wep(sc, vap);
else
sc->sc_encryption = 0;
@@ -916,7 +916,7 @@
wi_write_val(sc, WI_RID_PROMISC, 0);
/* Configure WEP. */
- if (ic->ic_caps & IEEE80211_C_WEP)
+ if (isset(ic->ic_cryptocaps, IEEE80211_CIPHER_WEP))
wi_write_wep(sc, vap);
else
sc->sc_encryption = 0;
==== //depot/projects/vap/sys/net80211/ieee80211.c#32 (text+ko) ====
@@ -324,6 +324,13 @@
vap->iv_flags_ext = ic->ic_flags_ext;
vap->iv_flags_ven = ic->ic_flags_ven;
vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
+ vap->iv_cryptocaps[0] = ic->ic_cryptocaps[0];
+#if IEEE80211_CIPHER_MAX > 8
+ vap->iv_cryptocaps[1] = ic->ic_cryptocaps[1];
+#endif
+#if IEEE80211_CIPHER_MAX > 16
+#error "too many crypto capability bits"
+#endif
vap->iv_htcaps = ic->ic_htcaps;
vap->iv_opmode = opmode;
switch (opmode) {
==== //depot/projects/vap/sys/net80211/ieee80211_crypto.c#11 (text+ko) ====
@@ -240,6 +240,7 @@
"wlan_tkip", /* IEEE80211_CIPHER_TKIP */
"wlan_aes_ocb", /* IEEE80211_CIPHER_AES_OCB */
"wlan_ccmp", /* IEEE80211_CIPHER_AES_CCM */
+ "#4", /* reserved */
"wlan_ckip", /* IEEE80211_CIPHER_CKIP */
"wlan_none", /* IEEE80211_CIPHER_NONE */
};
@@ -308,7 +309,7 @@
* If the hardware does not support the cipher then
* fallback to a host-based implementation.
*/
- if ((vap->iv_caps & (1<<cipher)) == 0) {
+ if (!isset(vap->iv_cryptocaps, cipher)) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_CRYPTO,
"%s: no h/w support for cipher %s, falling back to s/w\n",
__func__, cip->ic_name);
@@ -320,7 +321,7 @@
* the cipher modules honor it.
*/
if (cipher == IEEE80211_CIPHER_TKIP &&
- (vap->iv_caps & IEEE80211_C_TKIPMIC) == 0) {
+ !isset(vap->iv_cryptocaps, IEEE80211_CIPHER_TKIPMIC)) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_CRYPTO,
"%s: no h/w support for TKIP MIC, falling back to s/w\n",
__func__);
==== //depot/projects/vap/sys/net80211/ieee80211_crypto.h#11 (text+ko) ====
@@ -96,13 +96,16 @@
/*
* NB: these values are ordered carefully; there are lots of
- * of implications in any reordering. In particular beware
- * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY.
+ * of implications in any reordering. Beware that 4 is used
+ * only to indicate h/w TKIP MIC support in driver capabilities;
+ * there is no separate cipher support (it's rolled into the
+ * TKIP cipher support).
*/
#define IEEE80211_CIPHER_WEP 0
#define IEEE80211_CIPHER_TKIP 1
#define IEEE80211_CIPHER_AES_OCB 2
#define IEEE80211_CIPHER_AES_CCM 3
+#define IEEE80211_CIPHER_TKIPMIC 4 /* TKIP MIC capability */
#define IEEE80211_CIPHER_CKIP 5
#define IEEE80211_CIPHER_NONE 6 /* pseudo value */
==== //depot/projects/vap/sys/net80211/ieee80211_ddb.c#9 (text+ko) ====
@@ -71,11 +71,14 @@
#define IEEE80211_FVEN_BITS "\20"
#define IEEE80211_C_BITS \
- "\20\1WEP\2TKIP\3AES\4AES_CCM\6CKIP\7FF\10TURBOP\11IBSS\12PMGT" \
+ "\20\7FF\10TURBOP\11IBSS\12PMGT" \
"\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
- "\21MONITOR\22TKIPMIC\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
+ "\21MONITOR\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
"\37TXFRAG"
+#define IEEE80211_C_CRYPTO_BITS \
+ "\20\1WEP\2TKIP\3AES\4AES_CCM\5TKIPMIC\6CKIP\12PMGT"
+
#define IEEE80211_C_HTCAP_BITS \
"\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
"\21AMPDU\22AMSDU\23HT"
@@ -327,6 +330,8 @@
db_printf("\tflags_ext=%b\n", vap->iv_flags_ext, IEEE80211_FEXT_BITS);
db_printf("\tflags_ven=%b\n", vap->iv_flags_ven, IEEE80211_FVEN_BITS);
db_printf("\tcaps=%b\n", vap->iv_caps, IEEE80211_C_BITS);
+ db_printf("\tcryptocaps=%b\n",
+ vap->iv_cryptocaps[0], IEEE80211_C_CRYPTO_BITS);
db_printf("\thtcaps=%b\n", vap->iv_htcaps, IEEE80211_C_HTCAP_BITS);
_db_show_stats(&vap->iv_stats);
@@ -484,6 +489,8 @@
db_printf("\tflags_ext=%b\n", ic->ic_flags_ext, IEEE80211_FEXT_BITS);
db_printf("\tflags_ven=%b\n", ic->ic_flags_ven, IEEE80211_FVEN_BITS);
db_printf("\tcaps=%b\n", ic->ic_caps, IEEE80211_C_BITS);
+ db_printf("\tcryptocaps=%b\n",
+ ic->ic_cryptocaps[0], IEEE80211_C_CRYPTO_BITS);
db_printf("\thtcaps=%b\n", ic->ic_htcaps, IEEE80211_HTCAP_BITS);
#if 0
==== //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#49 (text+ko) ====
@@ -700,9 +700,14 @@
sizeof(struct ieee80211_devcaps_req), M_TEMP, M_NOWAIT | M_ZERO);
if (dc == NULL)
return ENOMEM;
- /* XXX temp until crypto caps split out of ic_caps */
- dc->dc_drivercaps = ic->ic_caps &~ IEEE80211_C_CRYPTO;
- dc->dc_cryptocaps = ic->ic_caps & IEEE80211_C_CRYPTO;
+ dc->dc_drivercaps = ic->ic_caps;
+#if IEEE80211_CIPHER_MAX <= 8
+ dc->dc_cryptocaps = ic->ic_cryptocaps[0];
+#elif IEEE80211_CIPHER_MAX <= 16
+ dc->dc_cryptocaps = (ic->ic_cryptocaps[0]<<8) | ic->ic_cryptocaps[1];
+#else
+#error "too many crypto capability bits"
+#endif
dc->dc_htcaps = ic->ic_htcaps;
ci = &dc->dc_chaninfo;
ic->ic_getradiocaps(ic, &ci->ic_nchans, ci->ic_chans);
@@ -877,10 +882,6 @@
case IEEE80211_IOC_COUNTERMEASURES:
ireq->i_val = (vap->iv_flags & IEEE80211_F_COUNTERM) != 0;
break;
- case IEEE80211_IOC_DRIVER_CAPS:
- ireq->i_val = vap->iv_caps>>16;
- ireq->i_len = vap->iv_caps&0xffff;
- break;
case IEEE80211_IOC_WME:
ireq->i_val = (vap->iv_flags & IEEE80211_F_WME) != 0;
break;
@@ -2680,11 +2681,6 @@
else
vap->iv_flags &= ~IEEE80211_F_NOBRIDGE;
break;
- case IEEE80211_IOC_DRIVER_CAPS:
- /* NB: for testing */
- vap->iv_caps = (((uint16_t) ireq->i_val) << 16) |
- ((uint16_t) ireq->i_len);
- break;
case IEEE80211_IOC_BSSID:
if (ireq->i_len != sizeof(tmpbssid))
return EINVAL;
==== //depot/projects/vap/sys/net80211/ieee80211_ioctl.h#17 (text+ko) ====
@@ -544,7 +544,7 @@
#define IEEE80211_IOC_HIDESSID 29 /* hide SSID mode (on, off) */
#define IEEE80211_IOC_APBRIDGE 30 /* AP inter-sta bridging */
/* 31-35,37-38 were for WPA authenticator settings */
-#define IEEE80211_IOC_DRIVER_CAPS 36 /* driver capabilities */
+/* 36 was IEEE80211_IOC_DRIVER_CAPS */
#define IEEE80211_IOC_WPAIE 39 /* WPA information element */
#define IEEE80211_IOC_STA_STATS 40 /* per-station statistics */
#define IEEE80211_IOC_MACCMD 41 /* MAC ACL operation */
==== //depot/projects/vap/sys/net80211/ieee80211_var.h#35 (text+ko) ====
@@ -122,6 +122,7 @@
uint32_t ic_flags_ven; /* vendor state flags */
uint32_t ic_caps; /* capabilities */
uint32_t ic_htcaps; /* HT capabilities */
+ uint8_t ic_cryptocaps[1];/* crypto capabilities */
uint8_t ic_modecaps[2]; /* set of mode capabilities */
uint8_t ic_promisc; /* vap's needing promisc mode */
uint8_t ic_allmulti; /* vap's needing all multicast*/
@@ -292,6 +293,7 @@
uint32_t iv_flags_ven; /* vendor state flags */
uint32_t iv_caps; /* capabilities */
uint32_t iv_htcaps; /* HT capabilities */
+ uint8_t iv_cryptocaps[1];/* crypto capabilities */
enum ieee80211_opmode iv_opmode; /* operation mode */
enum ieee80211_state iv_state; /* state machine state */
void (*iv_newstate_cb)(struct ieee80211vap *,
@@ -490,11 +492,7 @@
#define IEEE80211_FEXT_HTCOMPAT 0x10000000 /* CONF: HT vendor OUI's */
/* ic_caps/iv_caps: device driver capabilities */
-#define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */
-#define IEEE80211_C_TKIP 0x00000002 /* CAPABILITY: TKIP available */
-#define IEEE80211_C_AES 0x00000004 /* CAPABILITY: AES OCB avail */
-#define IEEE80211_C_AES_CCM 0x00000008 /* CAPABILITY: AES CCM avail */
-#define IEEE80211_C_CKIP 0x00000020 /* CAPABILITY: CKIP available */
+/* 0x2f available */
#define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */
#define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/
#define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */
@@ -506,7 +504,7 @@
#define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */
#define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */
#define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */
-#define IEEE80211_C_TKIPMIC 0x00020000 /* CAPABILITY: TKIP MIC avail */
+/* 0x20000 available */
#define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */
#define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */
#define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/
@@ -518,8 +516,6 @@
#define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */
/* XXX protection/barker? */
-#define IEEE80211_C_CRYPTO 0x0000002f /* CAPABILITY: crypto alg's */
-
/*
* ic_htcaps/iv_htcaps: HT-specific device/driver capabilities
*
More information about the p4-projects
mailing list