diff options
author | wpaul <wpaul@FreeBSD.org> | 2000-02-02 17:59:13 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2000-02-02 17:59:13 +0000 |
commit | 648f1c0043b77da223e3c4418ee52d4d86c48f92 (patch) | |
tree | 4565ff7da1c5bedcc9c7b406a9c9112264a665d3 /sys/i386/isa/if_wi.c | |
parent | 9ec448d8ca74d7b5cd8a49b34bf919870bd0a75c (diff) | |
download | FreeBSD-src-648f1c0043b77da223e3c4418ee52d4d86c48f92.zip FreeBSD-src-648f1c0043b77da223e3c4418ee52d4d86c48f92.tar.gz |
Add support for WEP (encryption) for silver and gold WaveLAN/IEEE turbo cards.
Also update wicontrol to enable/disable encryption, set WEP keys and set the
TX key index. Silver cards only have 40-bit keys. This is something of a quick
hack, but it works well enough for me to commit this from the LinuxWorld
exhibit floor.
The WEP support only shows up if you have a card that supports it.
Would have been approved by: jkh, if he hadn't wandered off somewhere
Approved in his place by: msmith, who's standing right here
Diffstat (limited to 'sys/i386/isa/if_wi.c')
-rw-r--r-- | sys/i386/isa/if_wi.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c index 6f005f7..e678b02 100644 --- a/sys/i386/isa/if_wi.c +++ b/sys/i386/isa/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); |