diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-02-26 06:19:35 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-02-26 06:19:35 +0000 |
commit | b7119c867c07c585323356012502c089c49e9836 (patch) | |
tree | 43f2e9091386f3fdc38ce919f9d80ab37f114c31 /sys/dev | |
parent | c3cb36189425d0c52e9bdd76aa13922f96349b20 (diff) |
Allow configuration of WEP. From FreeBSD; ok aaron@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/an.c | 28 | ||||
-rw-r--r-- | sys/dev/ic/anreg.h | 37 | ||||
-rw-r--r-- | sys/dev/ic/anvar.h | 16 |
3 files changed, 74 insertions, 7 deletions
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index 22bf5997d1c..d7f0dfe6ed4 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.11 2001/02/20 19:39:38 mickey Exp $ */ +/* $OpenBSD: an.c,v 1.12 2001/02/26 06:19:33 tholo Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -826,6 +826,28 @@ an_setdef(sc, areq) sp = (struct an_ltv_gen *)areq; sc->an_tx_rate = sp->an_val; break; + case AN_RID_WEP_VOLATILE: + /* Disable the MAC */ + an_cmd(sc, AN_CMD_DISABLE, 0); + + /* Just write the key, we dont' want to save it */ + an_write_record(sc, (struct an_ltv_gen *)areq); + + /* Turn the MAC back on */ + an_cmd(sc, AN_CMD_ENABLE, 0); + + break; + case AN_RID_WEP_PERMANENT: + /* Disable the MAC */ + an_cmd(sc, AN_CMD_DISABLE, 0); + + /* Just write the key, the card will save it in this mode */ + an_write_record(sc, (struct an_ltv_gen *)areq); + + /* Turn the MAC back on */ + an_cmd(sc, AN_CMD_ENABLE, 0); + + break; default: printf("%s: unknown RID: %x\n", sc->sc_dev.dv_xname, areq->an_type); @@ -931,7 +953,9 @@ an_ioctl(ifp, command, data) sc->an_if_flags & IFF_PROMISC) { an_promisc(sc, 0); } - an_init(sc); + else { + an_init(sc); + } } else { if (ifp->if_flags & IFF_RUNNING) an_stop(sc); diff --git a/sys/dev/ic/anreg.h b/sys/dev/ic/anreg.h index 1432b978dc1..a6f8e4428b3 100644 --- a/sys/dev/ic/anreg.h +++ b/sys/dev/ic/anreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: anreg.h,v 1.3 2001/02/26 06:18:06 tholo Exp $ */ +/* $OpenBSD: anreg.h,v 1.4 2001/02/26 06:19:33 tholo Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -275,7 +275,10 @@ struct an_ltv_genconfig { u_int16_t an_diversity; /* 0x72 */ u_int16_t an_tx_power; /* 0x74 */ u_int16_t an_rss_thresh; /* 0x76 */ - u_int16_t an_rsvd6[4]; /* 0x78 */ + u_int16_t an_modulation_type; /* 0x77 */ + u_int16_t an_short_preamble; /* 0x7A */ + u_int16_t an_home_product; /* 0x7C */ + u_int16_t an_rsvd6; /* 0x7E */ /* Aironet extensions. */ u_int8_t an_nodename[16]; /* 0x80 */ u_int16_t an_arl_thresh; /* 0x90 */ @@ -320,6 +323,8 @@ struct an_ltv_genconfig { #define AN_AUTHTYPE_OPEN 0x0001 #define AN_AUTHTYPE_SHAREDKEY 0x0002 #define AN_AUTHTYPE_EXCLUDE_UNENCRYPTED 0x0004 +#define AN_AUTHTYPE_PRIVACY_IN_USE 0x0100 +#define AN_AUTHTYPE_ALLOW_UNENCRYPTED 0x0200 #define AN_PSAVE_NONE 0x0000 #define AN_PSAVE_CAM 0x0001 @@ -453,6 +458,7 @@ struct an_ltv_caps { u_int16_t an_ifacerev; /* 0x7A */ u_int16_t an_softcaps; /* 0x7C */ u_int16_t an_bootblockrev; /* 0x7E */ + u_int16_t an_req_hw_support; /* 0x80 */ }; /* @@ -494,7 +500,7 @@ struct an_ltv_status { u_int8_t an_macaddr[6]; /* 0x02 */ u_int16_t an_opmode; /* 0x08 */ u_int16_t an_errcode; /* 0x0A */ - u_int16_t an_cur_signal_quality; /* 0x0C */ + u_int16_t an_cur_signal_strength; /* 0x0C */ u_int16_t an_ssidlen; /* 0x0E */ u_int8_t an_ssid[32]; /* 0x10 */ u_int8_t an_ap_name[16]; /* 0x30 */ @@ -512,7 +518,16 @@ struct an_ltv_status { u_int16_t an_ap_total_load; /* 0x66 */ u_int16_t an_our_generated_load; /* 0x68 */ u_int16_t an_accumulated_arl; /* 0x6A */ - u_int16_t an_rsvd0[10]; /* 0x6C */ + u_int16_t an_cur_signal_quality; /* 0x6C */ + u_int16_t an_current_tx_rate; /* 0x6E */ + u_int16_t an_ap_device; /* 0x70 */ + u_int16_t an_normalized_rssi; /* 0x72 */ + u_int16_t an_short_pre_in_use; /* 0x74 */ + u_int8_t an_ap_ip_addr[4]; /* 0x76 */ + u_int16_t an_max_noise_prev_sec; /* 0x7A */ + u_int16_t an_avg_noise_prev_min; /* 0x7C */ + u_int16_t an_max_noise_prev_min; /* 0x7E */ + u_int16_t an_rsvd0[2]; /* 0x80 */ }; #define AN_STATUS_OPMODE_CONFIGURED 0x0001 @@ -643,6 +658,20 @@ struct an_ltv_stats { }; /* + * WEP config + */ +#define AN_RID_WEP_VOLATILE 0xFF15 +#define AN_RID_WEP_PERMANENT 0xFF16 +struct an_wepkey { + u_int16_t an_len; /* 0x00 */ + u_int16_t an_type; /* 0xXX */ + u_int16_t an_key_index; /* 0x02 */ + u_int8_t an_mac_addr[6]; /* 0x04 */ + u_int16_t an_key_len; /* 0x0A */ + u_int8_t an_key[13]; /* 0x0C */ +}; + +/* * Receive frame structure. */ struct an_rxframe { diff --git a/sys/dev/ic/anvar.h b/sys/dev/ic/anvar.h index b1eb2c33424..48f5b68241e 100644 --- a/sys/dev/ic/anvar.h +++ b/sys/dev/ic/anvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: anvar.h,v 1.1 2000/04/03 01:01:59 mickey Exp $ */ +/* $OpenBSD: anvar.h,v 1.2 2001/02/26 06:19:34 tholo Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -162,6 +162,15 @@ struct an_sigcache { #endif #ifndef _KERNEL +struct an_ltv_key { + u_int16_t an_len; + u_int16_t an_type; + u_int16_t kindex; + u_int8_t mac[6]; + u_int16_t klen; + u_int8_t key[16]; +}; + struct an_ltv_stats { u_int16_t an_fudge; u_int16_t an_len; /* 0x00 */ @@ -367,6 +376,9 @@ struct an_ltv_genconfig { #define AN_AUTHTYPE_OPEN 0x0001 #define AN_AUTHTYPE_SHAREDKEY 0x0002 #define AN_AUTHTYPE_EXCLUDE_UNENCRYPTED 0x0004 +#define AN_AUTHTYPE_MASK 0x00FF +#define AN_AUTHTYPE_PRIVACY_IN_USE 0x0100 +#define AN_AUTHTYPE_ALLOW_UNENCRYPTED 0x0200 #define AN_PSAVE_NONE 0x0000 #define AN_PSAVE_CAM 0x0001 @@ -533,6 +545,8 @@ struct an_ltv_status { #define AN_RID_APLIST 0xFF12 /* Valid AP list */ #define AN_RID_DRVNAME 0xFF13 /* ID name of this node for diag */ #define AN_RID_ENCAPPROTO 0xFF14 /* Payload encapsulation type */ +#define AN_RID_WEP_VOLATILE 0xFF15 /* Temporary WEP key configuration */ +#define AN_RID_WEP_PERMANENT 0xFF16 /* Permanent WEP key configuration */ #define AN_RID_ACTUALCFG 0xFF20 /* Current configuration settings */ /* |