Update for net80211 changes.

This commit is contained in:
Sam Leffler 2004-12-08 17:36:51 +00:00
parent f48445578b
commit db1d51f3c7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138572
6 changed files with 147 additions and 99 deletions

View file

@ -258,7 +258,7 @@ int
awi_attach(struct awi_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &ic->ic_if;
struct ifnet *ifp = &sc->sc_if;
int s, i, error, nrate;
int mword;
enum ieee80211_phymode mode;
@ -300,6 +300,7 @@ awi_attach(struct awi_softc *sc)
device_get_unit(sc->sc_dev));
#endif
ic->ic_ifp = ifp;
ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP;
if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) {
ic->ic_phytype = IEEE80211_T_FH;
@ -322,7 +323,7 @@ awi_attach(struct awi_softc *sc)
#ifdef __NetBSD__
if_attach(ifp);
#endif
ieee80211_ifattach(ifp);
ieee80211_ifattach(ic);
sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = awi_newstate;
@ -333,7 +334,7 @@ awi_attach(struct awi_softc *sc)
sc->sc_send_mgmt = ic->ic_send_mgmt;
ic->ic_send_mgmt = awi_send_mgmt;
ieee80211_media_init(ifp, awi_media_change, awi_media_status);
ieee80211_media_init(ic, awi_media_change, awi_media_status);
/* Melco compatibility mode. */
#define ADD(s, o) ifmedia_add(&ic->ic_media, \
@ -363,13 +364,15 @@ awi_attach(struct awi_softc *sc)
/* ready to accept ioctl */
awi_unlock(sc);
ieee80211_announce(ic);
return 0;
}
int
awi_detach(struct awi_softc *sc)
{
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
int s;
if (!sc->sc_attached)
@ -384,7 +387,7 @@ awi_detach(struct awi_softc *sc)
(void)tsleep(sc, PWAIT, "awidet", 1);
}
sc->sc_attached = 0;
ieee80211_ifdetach(ifp);
ieee80211_ifdetach(&sc->sc_ic);
#ifdef __NetBSD__
if_detach(ifp);
shutdownhook_disestablish(sc->sc_sdhook);
@ -399,7 +402,7 @@ int
awi_activate(struct device *self, enum devact act)
{
struct awi_softc *sc = (struct awi_softc *)self;
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
int s, error = 0;
s = splnet();
@ -420,7 +423,7 @@ void
awi_power(int why, void *arg)
{
struct awi_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
int s;
int ocansleep;
@ -453,7 +456,7 @@ void
awi_shutdown(void *arg)
{
struct awi_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
if (sc->sc_attached)
awi_stop(ifp, 1);
@ -524,7 +527,7 @@ awi_intr(void *arg)
if (status & AWI_INT_SCAN_CMPLT) {
if (sc->sc_ic.ic_state == IEEE80211_S_SCAN &&
sc->sc_substate == AWI_ST_NONE)
ieee80211_next_scan(&sc->sc_ic.ic_if);
ieee80211_next_scan(&sc->sc_ic);
}
}
sc->sc_cansleep = ocansleep;
@ -539,7 +542,7 @@ awi_init0(void *arg)
{
struct awi_softc *sc = arg;
(void)awi_init(&sc->sc_ic.ic_if);
(void)awi_init(&sc->sc_if);
}
#endif
@ -660,7 +663,7 @@ awi_init(struct ifnet *ifp)
ni->ni_intval = ic->ic_lintval;
ni->ni_rssi = 0;
ni->ni_rstamp = 0;
memset(ni->ni_tstamp, 0, sizeof(ni->ni_tstamp));
memset(&ni->ni_tstamp, 0, sizeof(ni->ni_tstamp));
ni->ni_rates =
ic->ic_sup_rates[ieee80211_chan2mode(ic, ni->ni_chan)];
IEEE80211_ADDR_COPY(ni->ni_macaddr, ic->ic_myaddr);
@ -678,7 +681,7 @@ awi_init(struct ifnet *ifp)
memset(ni->ni_bssid, 0, IEEE80211_ADDR_LEN);
ni->ni_esslen = 0;
}
if (ic->ic_flags & IEEE80211_F_WEPON)
if (ic->ic_flags & IEEE80211_F_PRIVACY)
ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY;
if (ic->ic_opmode != IEEE80211_M_AHDEMO)
ic->ic_flags |= IEEE80211_F_SIBSS;
@ -743,6 +746,7 @@ awi_start(struct ifnet *ifp)
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_node *ni;
struct ieee80211_frame *wh;
struct ether_header *eh;
struct mbuf *m, *m0;
int len, dowep;
u_int32_t txd, frame, ntxd;
@ -755,6 +759,7 @@ awi_start(struct ifnet *ifp)
txd = sc->sc_txnext;
IF_POLL(&ic->ic_mgtq, m0);
dowep = 0;
ni = NULL;
if (m0 != NULL) {
len = m0->m_pkthdr.len;
if (awi_next_txd(sc, len, &frame, &ntxd)) {
@ -762,6 +767,8 @@ awi_start(struct ifnet *ifp)
break;
}
IF_DEQUEUE(&ic->ic_mgtq, m0);
ni = (struct ieee80211_node *) m0->m_pkthdr.rcvif;
m0->m_pkthdr.rcvif = NULL;
} else {
if (ic->ic_state != IEEE80211_S_RUN)
break;
@ -776,7 +783,8 @@ awi_start(struct ifnet *ifp)
if (!(ifp->if_flags & IFF_LINK0) && !sc->sc_adhoc_ap)
len += sizeof(struct llc) -
sizeof(struct ether_header);
if (ic->ic_flags & IEEE80211_F_WEPON) {
if (ic->ic_flags & IEEE80211_F_PRIVACY) {
/* XXX other crypto */
dowep = 1;
len += IEEE80211_WEP_IVLEN +
IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN;
@ -786,21 +794,31 @@ awi_start(struct ifnet *ifp)
break;
}
IFQ_DEQUEUE(&ifp->if_snd, m0);
ifp->if_opackets++;
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m0);
#endif
if ((ifp->if_flags & IFF_LINK0) || sc->sc_adhoc_ap)
m0 = awi_ether_encap(sc, m0);
else
m0 = ieee80211_encap(ifp, m0, &ni);
if (m0 == NULL) {
ifp->if_oerrors++;
continue;
else {
if (m0->m_len < sizeof(struct ether_header) &&
((m0 = m_pullup(m0, sizeof(struct ether_header)))) == NULL) {
ifp->if_oerrors++;
continue;
}
eh = mtod(m0, struct ether_header *);
ni = ieee80211_find_txnode(ic, eh->ether_dhost);
if (ni == NULL)
goto bad;
if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) &&
(m0->m_flags & M_PWR_SAV) == 0) {
ieee80211_pwrsave(ic, ni, m0);
continue;
}
m0 = ieee80211_encap(ic, m0, ni);
}
if (ni != NULL && ni != ic->ic_bss)
ieee80211_free_node(ic, ni);
if (m0 == NULL)
goto bad;
wh = mtod(m0, struct ieee80211_frame *);
if (!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
(ic->ic_opmode == IEEE80211_M_HOSTAP ||
@ -809,27 +827,38 @@ awi_start(struct ifnet *ifp)
(ifp->if_flags & IFF_LINK0) == 0 &&
(wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
IEEE80211_FC0_TYPE_DATA && ni == NULL) {
m_freem(m0);
bad:
if (m0 != NULL)
m_freem(m0);
ifp->if_oerrors++;
if (ni != NULL)
ieee80211_free_node(ni);
continue;
}
ifp->if_opackets++;
}
#if NBPFILTER > 0
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m0);
#endif
if (dowep) {
if ((m0 = ieee80211_wep_crypt(ifp, m0, 1)) == NULL) {
ifp->if_oerrors++;
struct ieee80211_key *k;
k = ieee80211_crypto_encap(ic, ni, m0);
if (k == NULL) {
if (ni != NULL)
ieee80211_free_node(ni);
continue;
}
}
#ifdef DIAGNOSTIC
if (m0->m_pkthdr.len != len) {
printf("%s: length %d should be %d\n",
ic->ic_if.if_xname, m0->m_pkthdr.len, len);
if_printf(ifp, "length %d should be %d\n",
m0->m_pkthdr.len, len);
m_freem(m0);
ifp->if_oerrors++;
if (ni != NULL)
ieee80211_free_node(ni);
continue;
}
#endif
@ -900,7 +929,7 @@ awi_watchdog(struct ifnet *ifp)
ifp->if_timer = 1;
}
/* TODO: rate control */
ieee80211_watchdog(ifp);
ieee80211_watchdog(&sc->sc_ic);
out:
sc->sc_cansleep = ocansleep;
}
@ -954,7 +983,7 @@ awi_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
break;
default:
error = ieee80211_ioctl(ifp, cmd, data);
error = ieee80211_ioctl(&sc->sc_ic, cmd, data);
if (error == ENETRESET) {
if (sc->sc_enabled)
error = awi_init(ifp);
@ -1095,7 +1124,7 @@ awi_media_status(struct ifnet *ifp, struct ifmediareq *imr)
static int
awi_mode_init(struct awi_softc *sc)
{
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
int n, error;
#ifdef __FreeBSD__
struct ifmultiaddr *ifma;
@ -1150,7 +1179,7 @@ awi_mode_init(struct awi_softc *sc)
ifp->if_flags |= IFF_ALLMULTI;
#endif
sc->sc_mib_mgt.Wep_Required =
(sc->sc_ic.ic_flags & IEEE80211_F_WEPON) ? AWI_WEP_ON : AWI_WEP_OFF;
(sc->sc_ic.ic_flags & IEEE80211_F_PRIVACY) ? AWI_WEP_ON : AWI_WEP_OFF;
if ((error = awi_mib(sc, AWI_CMD_SET_MIB, AWI_MIB_LOCAL, AWI_WAIT)) ||
(error = awi_mib(sc, AWI_CMD_SET_MIB, AWI_MIB_ADDR, AWI_WAIT)) ||
@ -1167,8 +1196,7 @@ static void
awi_rx_int(struct awi_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &ic->ic_if;
struct ieee80211_frame *wh;
struct ifnet *ifp = &sc->sc_if;
struct ieee80211_node *ni;
u_int8_t state, rate, rssi;
u_int16_t len;
@ -1213,36 +1241,16 @@ awi_rx_int(struct awi_softc *sc)
sc->sc_adhoc_ap)
m = awi_ether_modcap(sc, m);
else
m = m_pullup(m, sizeof(*wh));
m = m_pullup(m,
sizeof(struct ieee80211_frame_min));
if (m == NULL) {
ifp->if_ierrors++;
goto rx_next;
}
wh = mtod(m, struct ieee80211_frame *);
#ifdef __NetBSD__
ni = ieee80211_find_rxnode(ic, wh);
#else
if (ic->ic_opmode != IEEE80211_M_STA) {
ni = ieee80211_find_node(ic,
wh->i_addr2);
if (ni == NULL)
ni = ieee80211_ref_node(
ic->ic_bss);
} else
ni = ieee80211_ref_node(ic->ic_bss);
#endif
ieee80211_input(ifp, m, ni, rssi, rstamp);
/*
* The frame may have caused the
* node to be marked for reclamation
* (e.g. in response to a DEAUTH
* message) so use free_node here
* instead of unref_node.
*/
if (ni == ic->ic_bss)
ieee80211_unref_node(&ni);
else
ieee80211_free_node(ic, ni);
ni = ieee80211_find_rxnode(ic,
mtod(m, struct ieee80211_frame_min *));
ieee80211_input(ic, m, ni, rssi, rstamp);
ieee80211_free_node(ni);
} else
sc->sc_rxpend = m;
rx_next:
@ -1265,7 +1273,7 @@ awi_rx_int(struct awi_softc *sc)
static void
awi_tx_int(struct awi_softc *sc)
{
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
u_int8_t flags;
while (sc->sc_txdone != sc->sc_txnext) {
@ -1287,7 +1295,7 @@ awi_tx_int(struct awi_softc *sc)
static struct mbuf *
awi_devget(struct awi_softc *sc, u_int32_t off, u_int16_t len)
{
struct ifnet *ifp = &sc->sc_ic.ic_if;
struct ifnet *ifp = &sc->sc_if;
struct mbuf *m;
struct mbuf *top, **mp;
u_int tlen;
@ -1388,7 +1396,7 @@ awi_hw_init(struct awi_softc *sc)
return ENXIO;
if (i >= AWI_SELFTEST_TIMEOUT*hz/1000) {
printf("%s: failed to complete selftest (timeout)\n",
sc->sc_ic.ic_if.if_xname);
sc->sc_if.if_xname);
return ENXIO;
}
status = awi_read_1(sc, AWI_SELFTEST);
@ -1404,7 +1412,7 @@ awi_hw_init(struct awi_softc *sc)
}
if (status != AWI_SELFTEST_PASSED) {
printf("%s: failed to complete selftest (code %x)\n",
sc->sc_ic.ic_if.if_xname, status);
sc->sc_if.if_xname, status);
return ENXIO;
}
@ -1412,7 +1420,7 @@ awi_hw_init(struct awi_softc *sc)
awi_read_bytes(sc, AWI_BANNER, sc->sc_banner, AWI_BANNER_LEN);
if (memcmp(sc->sc_banner, "PCnetMobile:", 12) != 0) {
printf("%s: failed to complete selftest (bad banner)\n",
sc->sc_ic.ic_if.if_xname);
sc->sc_if.if_xname);
for (i = 0; i < AWI_BANNER_LEN; i++)
printf("%s%02x", i ? ":" : "\t", sc->sc_banner[i]);
printf("\n");
@ -1437,7 +1445,7 @@ awi_hw_init(struct awi_softc *sc)
error = awi_cmd(sc, AWI_CMD_NOP, AWI_WAIT);
if (error) {
printf("%s: failed to complete selftest",
sc->sc_ic.ic_if.if_xname);
sc->sc_if.if_xname);
if (error == ENXIO)
printf(" (no hardware)\n");
else if (error != EWOULDBLOCK)
@ -1475,7 +1483,7 @@ awi_init_mibs(struct awi_softc *sc)
(error = awi_mib(sc, AWI_CMD_GET_MIB, AWI_MIB_MGT, AWI_WAIT)) ||
(error = awi_mib(sc, AWI_CMD_GET_MIB, AWI_MIB_PHY, AWI_WAIT))) {
printf("%s: failed to get default mib value (error %d)\n",
ic->ic_if.if_xname, error);
sc->sc_if.if_xname, error);
return error;
}
@ -1483,7 +1491,7 @@ awi_init_mibs(struct awi_softc *sc)
for (cs = awi_chanset; ; cs++) {
if (cs->cs_type == 0) {
printf("%s: failed to set available channel\n",
ic->ic_if.if_xname);
sc->sc_if.if_xname);
return ENXIO;
}
if (cs->cs_type == sc->sc_mib_phy.IEEE_PHY_Type &&
@ -1663,7 +1671,7 @@ awi_cmd(struct awi_softc *sc, u_int8_t cmd, int wflag)
return EINVAL;
default:
printf("%s: command %d failed %x\n",
sc->sc_ic.ic_if.if_xname, cmd, status);
sc->sc_if.if_xname, cmd, status);
return ENXIO;
}
return 0;
@ -1680,7 +1688,7 @@ awi_cmd_wait(struct awi_softc *sc)
return ENXIO;
if (awi_read_1(sc, AWI_CMD) != sc->sc_cmd_inprog) {
printf("%s: failed to access hardware\n",
sc->sc_ic.ic_if.if_xname);
sc->sc_if.if_xname);
sc->sc_invalid = 1;
return ENXIO;
}
@ -1725,7 +1733,7 @@ awi_cmd_done(struct awi_softc *sc)
if (status != AWI_STAT_OK) {
printf("%s: command %d failed %x\n",
sc->sc_ic.ic_if.if_xname, cmd, status);
sc->sc_if.if_xname, cmd, status);
sc->sc_substate = AWI_ST_NONE;
return;
}
@ -1840,7 +1848,7 @@ awi_intr_lock(struct awi_softc *sc)
}
if (status != 0) {
printf("%s: failed to lock interrupt\n",
sc->sc_ic.ic_if.if_xname);
sc->sc_if.if_xname);
return ENXIO;
}
return 0;
@ -1856,9 +1864,9 @@ awi_intr_unlock(struct awi_softc *sc)
static int
awi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{
struct awi_softc *sc = ic->ic_softc;
struct ifnet *ifp = ic->ic_ifp;
struct awi_softc *sc = ifp->if_softc;
struct ieee80211_node *ni;
struct ifnet *ifp = &ic->ic_if;
int error;
u_int8_t newmode;
enum ieee80211_state ostate;
@ -1929,7 +1937,7 @@ awi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
case IEEE80211_S_AUTH:
case IEEE80211_S_ASSOC:
case IEEE80211_S_INIT:
ieee80211_begin_scan(ifp);
ieee80211_begin_scan(ic, 0);
break;
case IEEE80211_S_SCAN:
/* scan next */
@ -2044,14 +2052,14 @@ awi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
awi_write_2(sc, AWI_CA_SYNC_DWELL, 0);
}
if (ic->ic_flags & IEEE80211_F_SIBSS) {
memset(ni->ni_tstamp, 0, sizeof(ni->ni_tstamp));
memset(&ni->ni_tstamp, 0, sizeof(ni->ni_tstamp));
ni->ni_rstamp = 0;
awi_write_1(sc, AWI_CA_SYNC_STARTBSS, 1);
} else
awi_write_1(sc, AWI_CA_SYNC_STARTBSS, 0);
awi_write_2(sc, AWI_CA_SYNC_MBZ, 0);
awi_write_bytes(sc, AWI_CA_SYNC_TIMESTAMP,
ni->ni_tstamp, 8);
ni->ni_tstamp.data, 8);
awi_write_4(sc, AWI_CA_SYNC_REFTIME, ni->ni_rstamp);
sc->sc_cur_chan = ieee80211_chan2ieee(ic, ni->ni_chan);
if ((error = awi_cmd(sc, AWI_CMD_SYNC, AWI_NOWAIT))
@ -2101,7 +2109,7 @@ awi_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
struct ieee80211_node *ni,
int subtype, int rssi, u_int32_t rstamp)
{
struct awi_softc *sc = ic->ic_softc;
struct awi_softc *sc = ic->ic_ifp->if_softc;
/* probe request is handled by hardware */
if (subtype == IEEE80211_FC0_SUBTYPE_PROBE_REQ)
@ -2113,7 +2121,7 @@ static int
awi_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
int type, int arg)
{
struct awi_softc *sc = ic->ic_softc;
struct awi_softc *sc = ic->ic_ifp->if_softc;
/* probe request is handled by hardware */
if (type == IEEE80211_FC0_SUBTYPE_PROBE_REQ)
@ -2142,8 +2150,8 @@ awi_ether_encap(struct awi_softc *sc, struct mbuf *m)
wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_DATA;
*(u_int16_t *)wh->i_dur = 0;
*(u_int16_t *)wh->i_seq =
htole16(ni->ni_txseq << IEEE80211_SEQ_SEQ_SHIFT);
ni->ni_txseq++;
htole16(ni->ni_txseqs[0] << IEEE80211_SEQ_SEQ_SHIFT);
ni->ni_txseqs[0]++;
if (ic->ic_opmode == IEEE80211_M_IBSS ||
ic->ic_opmode == IEEE80211_M_AHDEMO) {
wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;

View file

@ -78,6 +78,8 @@ struct awi_softc {
struct device sc_dev;
#endif
#ifdef __FreeBSD__
struct arpcom sc_arp;
#define sc_if sc_arp.ac_if
device_t sc_dev;
#endif
struct am79c930_softc sc_chip;

View file

@ -508,6 +508,7 @@ ndis_attach(dev)
uint32_t arg;
int r;
ic->ic_ifp = ifp;
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_caps = IEEE80211_C_IBSS;
@ -672,8 +673,8 @@ ndis_attach(dev)
if (r == 0)
ic->ic_caps |= IEEE80211_C_PMGT;
bcopy(eaddr, &ic->ic_myaddr, sizeof(eaddr));
ieee80211_ifattach(ifp);
ieee80211_media_init(ifp, ieee80211_media_change,
ieee80211_ifattach(ic);
ieee80211_media_init(ic, ieee80211_media_change,
ndis_media_status);
ic->ic_ibss_chan = IEEE80211_CHAN_ANYC;
ic->ic_bss->ni_chan = ic->ic_ibss_chan;
@ -730,7 +731,7 @@ ndis_detach(dev)
NDIS_UNLOCK(sc);
ndis_stop(sc);
if (sc->ndis_80211)
ieee80211_ifdetach(ifp);
ieee80211_ifdetach(&sc->ic);
else
ether_ifdetach(ifp);
} else
@ -1478,7 +1479,7 @@ ndis_setstate_80211(sc)
struct ifnet *ifp;
ic = &sc->ic;
ifp = &sc->ic.ic_ac.ac_if;
ifp = &sc->arpcom.ac_if;
if (!NDIS_INITIALIZED(sc))
return;
@ -1498,27 +1499,27 @@ ndis_setstate_80211(sc)
/* Set WEP */
#ifdef IEEE80211_F_WEPON
if (ic->ic_flags & IEEE80211_F_WEPON) {
#ifdef IEEE80211_F_PRIVACY
if (ic->ic_flags & IEEE80211_F_PRIVACY) {
#else
if (ic->ic_wep_mode >= IEEE80211_WEP_ON) {
#endif
for (i = 0; i < IEEE80211_WEP_NKID; i++) {
if (ic->ic_nw_keys[i].wk_len) {
if (ic->ic_nw_keys[i].wk_keylen) {
bzero((char *)&wep, sizeof(wep));
wep.nw_keylen = ic->ic_nw_keys[i].wk_len;
wep.nw_keylen = ic->ic_nw_keys[i].wk_keylen;
#ifdef notdef
/* 5 and 13 are the only valid key lengths */
if (ic->ic_nw_keys[i].wk_len < 5)
if (ic->ic_nw_keys[i].wk_keylen < 5)
wep.nw_keylen = 5;
else if (ic->ic_nw_keys[i].wk_len > 5 &&
ic->ic_nw_keys[i].wk_len < 13)
else if (ic->ic_nw_keys[i].wk_keylen > 5 &&
ic->ic_nw_keys[i].wk_keylen < 13)
wep.nw_keylen = 13;
#endif
wep.nw_keyidx = i;
wep.nw_length = (sizeof(uint32_t) * 3)
+ wep.nw_keylen;
if (i == ic->ic_wep_txkey)
if (i == ic->ic_def_txkey)
wep.nw_keyidx |= NDIS_80211_WEPKEY_TX;
bcopy(ic->ic_nw_keys[i].wk_key,
wep.nw_keydata, wep.nw_length);
@ -1777,7 +1778,7 @@ ndis_getstate_80211(sc)
struct ifnet *ifp;
ic = &sc->ic;
ifp = &sc->ic.ic_ac.ac_if;
ifp = &sc->arpcom.ac_if;
if (!NDIS_INITIALIZED(sc))
return;
@ -1952,7 +1953,7 @@ ndis_ioctl(ifp, command, data)
case SIOCGIFMEDIA:
case SIOCSIFMEDIA:
if (sc->ndis_80211) {
error = ieee80211_ioctl(ifp, command, data);
error = ieee80211_ioctl(&sc->ic, command, data);
if (error == ENETRESET) {
ndis_setstate_80211(sc);
/*ndis_init(sc);*/
@ -1983,7 +1984,7 @@ ndis_ioctl(ifp, command, data)
default:
sc->ndis_skip = 1;
if (sc->ndis_80211) {
error = ieee80211_ioctl(ifp, command, data);
error = ieee80211_ioctl(&sc->ic, command, data);
if (error == ENETRESET) {
ndis_setstate_80211(sc);
error = 0;

View file

@ -67,9 +67,8 @@ TAILQ_HEAD(nch, ndis_cfglist);
#define NDIS_INC(x) \
(x)->ndis_txidx = ((x)->ndis_txidx + 1) % (x)->ndis_maxpkts
#define arpcom ic.ic_ac
struct ndis_softc {
struct arpcom arpcom;
struct ieee80211com ic; /* interface info */
#ifdef notdef
struct ieee80211com arpcom; /* interface info */

View file

@ -332,7 +332,7 @@ static void ray_rx_data (struct ray_softc *sc, struct mbuf *m0, u_int8_t siglev
static void ray_rx_mgt (struct ray_softc *sc, struct mbuf *m0);
static void ray_rx_mgt_auth (struct ray_softc *sc, struct mbuf *m0);
static void ray_rx_mgt_beacon (struct ray_softc *sc, struct mbuf *m0);
static void ray_rx_mgt_info (struct ray_softc *sc, struct mbuf *m0, struct ieee80211_information *elements);
static void ray_rx_mgt_info (struct ray_softc *sc, struct mbuf *m0, union ieee80211_information *elements);
static void ray_rx_update_cache (struct ray_softc *sc, u_int8_t *src, u_int8_t siglev, u_int8_t antenna);
static void ray_stop (struct ray_softc *sc, struct ray_comq_entry *com);
static int ray_stop_user (struct ray_softc *sc);
@ -2186,7 +2186,7 @@ ray_rx_mgt_beacon(struct ray_softc *sc, struct mbuf *m0)
{
struct ieee80211_frame *header = mtod(m0, struct ieee80211_frame *);
ieee80211_mgt_beacon_t beacon = (u_int8_t *)(header+1);
struct ieee80211_information elements;
union ieee80211_information elements;
u_int64_t *timestamp;
@ -2203,7 +2203,7 @@ RAY_DPRINTF(sc, RAY_DBG_MGT, "capability\t0x%x", IEEE80211_BEACON_CAPABILITY(bea
}
static void
ray_rx_mgt_info(struct ray_softc *sc, struct mbuf *m0, struct ieee80211_information *elements)
ray_rx_mgt_info(struct ray_softc *sc, struct mbuf *m0, union ieee80211_information *elements)
{
struct ifnet *ifp = &sc->arpcom.ac_if;
struct ieee80211_frame *header = mtod(m0, struct ieee80211_frame *);

View file

@ -323,3 +323,41 @@ static int mib_info[RAY_MIB_MAX+1][3] = RAY_MIB_INFO;
#ifndef RAY_MAP_CM
#define RAY_MAP_CM(sc)
#endif /* RAY_MAP_CM */
/*
* Management information element payloads
*/
union ieee80211_information {
char ssid[IEEE80211_NWID_LEN+1];
struct rates {
u_int8_t *p;
} rates;
struct fh {
u_int16_t dwell;
u_int8_t set;
u_int8_t pattern;
u_int8_t index;
} fh;
struct ds {
u_int8_t channel;
} ds;
struct cf {
u_int8_t count;
u_int8_t period;
u_int8_t maxdur[2];
u_int8_t dur[2];
} cf;
struct tim {
u_int8_t count;
u_int8_t period;
u_int8_t bitctl;
/* u_int8_t pvt[251]; The driver needs to use this. */
} tim;
struct ibss {
u_int16_t atim;
} ibss;
struct challenge {
u_int8_t *p;
u_int8_t len;
} challenge;
};