diff options
author | wpaul <wpaul@FreeBSD.org> | 2000-11-13 23:04:16 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2000-11-13 23:04:16 +0000 |
commit | 85c836b2c070d3a80771393496f94ea2f827eef3 (patch) | |
tree | e6d5897412fe72e7cda4aff4db0192a54a00707a /sys/dev/an | |
parent | 7df19d145567bd8d1f27e401d308a3592bd0fc93 (diff) | |
download | FreeBSD-src-85c836b2c070d3a80771393496f94ea2f827eef3.zip FreeBSD-src-85c836b2c070d3a80771393496f94ea2f827eef3.tar.gz |
Close PR# 21843 and PR# 21864. This adds support for WEP and updates some
of the data structures to include new members that weren't defined in the
manual I have.
I opted to use Doug Ambrisko's WEP patches since David Cornejo's patches
did not include the necessary changes to ancontrol(8) to actually enable
and use WEP.
NOTE: I don't currently have access to an Aironet card, so I can't test
any of this. Everything compiles and close scrutiny doesn't reveal any
obvious problems, but Murphy's Law applies. This means I will probably
leave these changes in -current for a bit longer than usual until I'm
sure they work right.
Diffstat (limited to 'sys/dev/an')
-rw-r--r-- | sys/dev/an/if_aironet_ieee.h | 42 | ||||
-rw-r--r-- | sys/dev/an/if_an.c | 46 | ||||
-rw-r--r-- | sys/dev/an/if_anreg.h | 45 |
3 files changed, 121 insertions, 12 deletions
diff --git a/sys/dev/an/if_aironet_ieee.h b/sys/dev/an/if_aironet_ieee.h index aa86978..680a676 100644 --- a/sys/dev/an/if_aironet_ieee.h +++ b/sys/dev/an/if_aironet_ieee.h @@ -151,6 +151,15 @@ struct an_sigcache { }; #endif +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]; /* 40-bit keys */ +}; + #ifndef _KERNEL struct an_ltv_stats { u_int16_t an_fudge; @@ -312,7 +321,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; /* 0x78 */ + 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 */ @@ -357,6 +369,8 @@ 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_ENABLE 0x0100 #define AN_PSAVE_NONE 0x0000 #define AN_PSAVE_CAM 0x0001 @@ -459,6 +473,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 */ }; struct an_ltv_apinfo { @@ -480,7 +495,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 */ @@ -498,7 +513,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; /* 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_spare[2]; }; #define AN_STATUS_OPMODE_CONFIGURED 0x0001 @@ -508,6 +532,14 @@ struct an_ltv_status { #define AN_STATUS_OPMODE_ASSOCIATED 0x0020 #define AN_STATUS_OPMODE_ERROR 0x8000 +struct an_ltv_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 */ +}; /* * These are all the LTV record types that we can read or write @@ -523,7 +555,11 @@ 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_TEMP 0xFF15 /* Temporary Key */ +#define AN_RID_WEP_PERM 0xFF16 /* Perminant Key */ #define AN_RID_ACTUALCFG 0xFF20 /* Current configuration settings */ +#define AN_RID_WEP_VOLATILE 0xFF15 /* Volatile WEP Key */ +#define AN_RID_WEP_PERSISTENT 0xFF16 /* Persistent WEP Key */ /* * Reporting (read only) diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 6eadbf8..f881a03 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -208,7 +208,7 @@ int an_probe(dev) if (an_read_record(sc, (struct an_ltv_gen *)&ssid)) return(0); - /* See if the ssid matches what we expect. */ + /* See if the ssid matches what we expect ... but doesn't have to */ if (strcmp(ssid.an_ssid1, AN_DEF_SSID)) return(0); @@ -483,6 +483,10 @@ static void an_txeof(sc, status) struct ifnet *ifp; int id; + /* TX DONE enable lan monitor DJA + an_enable_sniff(); + */ + ifp = &sc->arpcom.ac_if; ifp->if_timer = 0; @@ -726,7 +730,7 @@ static int an_read_record(sc, ltv) /* Now read the data. */ ptr = <v->an_val; - for (i = 0; i < (ltv->an_len - 1) >> 1; i++) + for (i = 0; i < (ltv->an_len - 2) >> 1; i++) ptr[i] = CSR_READ_2(sc, AN_DATA1); return(0); @@ -748,10 +752,10 @@ static int an_write_record(sc, ltv) if (an_seek(sc, ltv->an_type, 0, AN_BAP1)) return(EIO); - CSR_WRITE_2(sc, AN_DATA1, ltv->an_len); - + CSR_WRITE_2(sc, AN_DATA1, ltv->an_len-2); + ptr = <v->an_val; - for (i = 0; i < (ltv->an_len - 1) >> 1; i++) + for (i = 0; i < (ltv->an_len - 4) >> 1; i++) CSR_WRITE_2(sc, AN_DATA1, ptr[i]); if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_WRITE, ltv->an_type)) @@ -927,6 +931,29 @@ static void an_setdef(sc, areq) sp = (struct an_ltv_gen *)areq; sc->an_tx_rate = sp->an_val; break; + case AN_RID_WEP_TEMP: + /* Disable the MAC. */ + an_cmd(sc, AN_CMD_DISABLE, 0); + + /* Just write the Key, we don't 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_PERM: + + /* 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("an%d: unknown RID: %x\n", sc->an_unit, areq->an_type); return; @@ -958,8 +985,10 @@ static void an_promisc(sc, promisc) !(sc->an_config.an_rxmode & AN_RXMODE_LAN_MONITOR_CURBSS) ) { sc->an_rxmode = sc->an_config.an_rxmode; + /* kills card DJA, if in sniff mode can't TX packets sc->an_config.an_rxmode |= AN_RXMODE_LAN_MONITOR_CURBSS; + */ } else { sc->an_config.an_rxmode = sc->an_rxmode; } @@ -1136,8 +1165,10 @@ static void an_init(xsc) sc->an_config.an_rxmode = AN_RXMODE_BC_MC_ADDR; /* Initialize promisc mode. */ - if (ifp->if_flags & IFF_PROMISC) + /* Kills card DJA can't TX packet in sniff mode + if (ifp->if_flags & IFF_PROMISC) sc->an_config.an_rxmode |= AN_RXMODE_LAN_MONITOR_CURBSS; + */ sc->an_rxmode = sc->an_config.an_rxmode; @@ -1255,6 +1286,9 @@ static void an_start(ifp) m_freem(m0); m0 = NULL; + /* TX START disable lan monitor ? DJA + an_disable_sniff(): + */ sc->an_rdata.an_tx_ring[idx] = id; if (an_cmd(sc, AN_CMD_TX, id)) printf("an%d: xmit failed\n", sc->an_unit); diff --git a/sys/dev/an/if_anreg.h b/sys/dev/an/if_anreg.h index be88f6c..1bfc284 100644 --- a/sys/dev/an/if_anreg.h +++ b/sys/dev/an/if_anreg.h @@ -273,7 +273,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; /* 0x78 */ + 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 */ @@ -416,6 +419,9 @@ struct an_rid_encap { #define AN_TXENCAP_RFC1024 0x0000 #define AN_TXENCAP_80211 0x0002 +#define AN_RID_WEP_TEMP 0xFF15 +#define AN_RID_WEP_PERM 0xFF16 + /* * Actual config, same structure as general config (read only). */ @@ -451,6 +457,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 */ }; /* @@ -492,7 +499,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 */ @@ -510,7 +517,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_spare[2]; }; #define AN_STATUS_OPMODE_CONFIGURED 0x0001 @@ -641,6 +657,25 @@ struct an_ltv_stats { }; /* + * Volatile WEP Key + */ +#define AN_RID_WEP_VOLATILE 0xFF15 /* Volatile WEP Key */ +struct an_ltv_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 */ +}; + +/* + * Persistent WEP Key + */ +#define AN_RID_WEP_PERSISTENT 0xFF16 /* Persistent WEP Key */ + + +/* * Receive frame structure. */ struct an_rxframe { @@ -786,6 +821,8 @@ struct an_softc { struct an_ltv_caps an_caps; struct an_ltv_ssidlist an_ssidlist; struct an_ltv_aplist an_aplist; + struct an_ltv_key an_temp_keys; + struct an_ltv_key an_perm_keys; int an_tx_rate; int an_rxmode; int an_gone; @@ -854,3 +891,5 @@ driver_intr_t an_intr; #define AN_SNAP_WORD0 (AN_SNAP_K1 | (AN_SNAP_K1 << 8)) #define AN_SNAP_WORD1 (AN_SNAP_K2 | (AN_SNAP_CONTROL << 8)) #define AN_SNAPHDR_LEN 0x6 + + |