aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/wi
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/wi')
-rw-r--r--sys/dev/wi/if_wavelan_ieee.h15
-rw-r--r--sys/dev/wi/if_wi.c30
-rw-r--r--sys/dev/wi/if_wireg.h27
3 files changed, 71 insertions, 1 deletions
diff --git a/sys/dev/wi/if_wavelan_ieee.h b/sys/dev/wi/if_wavelan_ieee.h
index 5e5d2e30c23de..5e1046a6c06f5 100644
--- a/sys/dev/wi/if_wavelan_ieee.h
+++ b/sys/dev/wi/if_wavelan_ieee.h
@@ -210,6 +210,8 @@ struct wi_counters {
#define WI_RID_WDS_ADDR5 0xFC15 /* port 1 MAC of WDS link node */
#define WI_RID_WDS_ADDR6 0xFC16 /* port 1 MAC of WDS link node */
#define WI_RID_MCAST_PM_BUF 0xFC17 /* PM buffering of mcast */
+#define WI_RID_ENCRYPTION 0xFC20 /* enable/disable WEP */
+#define WI_RID_AUTHTYPE 0xFC21 /* specify authentication type */
/*
* Network parameters, dynamic configuration entities
@@ -241,8 +243,21 @@ struct wi_counters {
#define WI_RID_TX_RATE4 0xFCA2
#define WI_RID_TX_RATE5 0xFCA3
#define WI_RID_TX_RATE6 0xFCA4
+#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0
+#define WI_RID_TX_CRYPT_KEY 0xFCB1
#define WI_RID_TICK_TIME 0xFCE0
+struct wi_key {
+ u_int16_t wi_keylen;
+ u_int8_t wi_keydat[14];
+};
+
+struct wi_ltv_keys {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ struct wi_key wi_keys[4];
+};
+
/*
* NIC information
*/
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 6f005f7c887fd..e678b021d7e06 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -310,6 +310,14 @@ static int wi_pccard_attach(device_t dev)
wi_read_record(sc, &gen);
sc->wi_channel = gen.wi_val;
+ /*
+ * Find out if we support WEP on this card.
+ */
+ gen.wi_type = WI_RID_WEP_AVAIL;
+ gen.wi_len = 2;
+ wi_read_record(sc, &gen);
+ sc->wi_has_wep = gen.wi_val;
+
bzero((char *)&sc->wi_stats, sizeof(sc->wi_stats));
wi_init(sc);
@@ -932,6 +940,16 @@ static void wi_setdef(sc, wreq)
case WI_RID_MAX_SLEEP:
sc->wi_max_sleep = wreq->wi_val[0];
break;
+ case WI_RID_ENCRYPTION:
+ sc->wi_use_wep = wreq->wi_val[0];
+ break;
+ case WI_RID_TX_CRYPT_KEY:
+ sc->wi_tx_key = wreq->wi_val[0];
+ break;
+ case WI_RID_DEFLT_CRYPT_KEYS:
+ bcopy((char *)wreq, (char *)&sc->wi_keys,
+ sizeof(struct wi_ltv_keys));
+ break;
default:
break;
}
@@ -999,6 +1017,9 @@ static int wi_ioctl(ifp, command, data)
bcopy((char *)&sc->wi_stats, (char *)&wreq.wi_val,
sizeof(sc->wi_stats));
wreq.wi_len = (sizeof(sc->wi_stats) / 2) + 1;
+ } else if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS) {
+ bcopy((char *)&sc->wi_keys, (char *)&wreq,
+ sizeof(struct wi_ltv_keys));
}
#ifdef WICACHE
else if (wreq.wi_type == WI_RID_ZERO_CACHE) {
@@ -1111,6 +1132,15 @@ static void wi_init(xsc)
(char *)&mac.wi_mac_addr, ETHER_ADDR_LEN);
wi_write_record(sc, (struct wi_ltv_gen *)&mac);
+ /* Configure WEP. */
+ if (sc->wi_has_wep) {
+ WI_SETVAL(WI_RID_ENCRYPTION, sc->wi_use_wep);
+ WI_SETVAL(WI_RID_TX_CRYPT_KEY, sc->wi_tx_key);
+ sc->wi_keys.wi_len = (sizeof(struct wi_ltv_keys) / 2) + 1;
+ sc->wi_keys.wi_type = WI_RID_DEFLT_CRYPT_KEYS;
+ wi_write_record(sc, (struct wi_ltv_gen *)&sc->wi_keys);
+ }
+
/* Initialize promisc mode. */
if (ifp->if_flags & IFF_PROMISC) {
WI_SETVAL(WI_RID_PROMISC, 1);
diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h
index 65cba4d529a25..42e46376c85d2 100644
--- a/sys/dev/wi/if_wireg.h
+++ b/sys/dev/wi/if_wireg.h
@@ -56,6 +56,27 @@ struct wi_counters {
u_int32_t wi_rx_msg_in_bad_msg_frags;
};
+/*
+ * Encryption controls. We can enable or disable encryption as
+ * well as specify up to 4 encryption keys. We can also specify
+ * which of the four keys will be used for transmit encryption.
+ */
+#define WI_RID_ENCRYPTION 0xFC20
+#define WI_RID_AUTHTYPE 0xFC21
+#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0
+#define WI_RID_TX_CRYPT_KEY 0xFCB1
+#define WI_RID_WEP_AVAIL 0xFD4F
+struct wi_key {
+ u_int16_t wi_keylen;
+ u_int8_t wi_keydat[14];
+};
+
+struct wi_ltv_keys {
+ u_int16_t wi_len;
+ u_int16_t wi_type;
+ struct wi_key wi_keys[4];
+};
+
struct wi_softc {
struct arpcom arpcom;
struct ifmedia ifmedia;
@@ -84,8 +105,12 @@ struct wi_softc {
char wi_node_name[32];
char wi_net_name[32];
char wi_ibss_name[32];
- u_int8_t wi_txbuf[1536];
+ u_int8_t wi_txbuf[1596];
struct wi_counters wi_stats;
+ int wi_has_wep;
+ int wi_use_wep;
+ int wi_tx_key;
+ struct wi_ltv_keys wi_keys;
#ifdef WICACHE
int wi_sigitems;
struct wi_sigcache wi_sigcache[MAXWICACHE];