summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2005-10-31 05:37:12 +0000
committerjsg <jsg@openbsd.org>2005-10-31 05:37:12 +0000
commit55f29f42c7363b08323fd08205e7126f4b7f1dc3 (patch)
treee77165b120a63e06a12c4ac967398a3326065388
parentshow the speed status in hw.cpuspeed; ok drahn (diff)
downloadwireguard-openbsd-55f29f42c7363b08323fd08205e7126f4b7f1dc3.tar.xz
wireguard-openbsd-55f29f42c7363b08323fd08205e7126f4b7f1dc3.zip
Move from arpcom to ieee80211com in wi softc. This will be
required for net80211 support. Updated version of a diff from dlg@ similiar diff ok fgsch@, ok dlg@
-rw-r--r--sys/arch/macppc/dev/if_wi_obio.c8
-rw-r--r--sys/dev/ic/if_wi.c87
-rw-r--r--sys/dev/ic/if_wi_hostap.c73
-rw-r--r--sys/dev/ic/if_wivar.h6
-rw-r--r--sys/dev/pci/if_wi_pci.c8
-rw-r--r--sys/dev/pcmcia/if_wi_pcmcia.c8
-rw-r--r--sys/dev/usb/if_wi_usb.c12
-rw-r--r--sys/dev/usb/if_wi_usb.h4
8 files changed, 107 insertions, 99 deletions
diff --git a/sys/arch/macppc/dev/if_wi_obio.c b/sys/arch/macppc/dev/if_wi_obio.c
index 2987e0e4a20..75c78c72957 100644
--- a/sys/arch/macppc/dev/if_wi_obio.c
+++ b/sys/arch/macppc/dev/if_wi_obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_obio.c,v 1.13 2004/11/24 07:47:22 deraadt Exp $ */
+/* $OpenBSD: if_wi_obio.c,v 1.14 2005/10/31 05:37:13 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -50,6 +50,7 @@
#include <sys/timeout.h>
#include <sys/socket.h>
#include <sys/device.h>
+#include <sys/tree.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -62,6 +63,7 @@
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_var.h>
#include <machine/bus.h>
#include <machine/autoconf.h>
@@ -141,7 +143,7 @@ wi_obio_detach(dev, flags)
{
struct wi_obio_softc *psc = (struct wi_obio_softc *)dev;
struct wi_softc *sc = &psc->sc_wi;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
/*
obio_io_unmap(psc->sc_pf, psc->sc_io_window);
@@ -162,7 +164,7 @@ wi_obio_activate(dev, act)
{
struct wi_obio_softc *psc = (struct wi_obio_softc *)dev;
struct wi_softc *sc = &psc->sc_wi;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
int s;
s = splnet();
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index a6c4d675320..3e25286d2a5 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.122 2005/10/19 20:04:43 fgsch Exp $ */
+/* $OpenBSD: if_wi.c,v 1.123 2005/10/31 05:37:12 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -89,6 +89,7 @@
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_var.h>
#if NBPFILTER > 0
#include <net/bpf.h>
@@ -127,7 +128,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.122 2005/10/19 20:04:43 fgsch Exp $";
+ "$OpenBSD: if_wi.c,v 1.123 2005/10/31 05:37:12 jsg Exp $";
#endif /* lint */
#ifdef foo
@@ -209,12 +210,16 @@ struct wi_funcs wi_func_io = {
int
wi_attach(struct wi_softc *sc, struct wi_funcs *funcs)
{
+ struct ieee80211com *ic;
+ struct ifnet *ifp;
struct wi_ltv_macaddr mac;
struct wi_ltv_rates rates;
struct wi_ltv_gen gen;
- struct ifnet *ifp;
int error;
+ ic = &sc->sc_ic;
+ ifp = &ic->ic_if;
+
sc->sc_funcs = funcs;
sc->wi_cmd_count = 500;
@@ -228,13 +233,12 @@ wi_attach(struct wi_softc *sc, struct wi_funcs *funcs)
printf(": unable to read station address\n");
return (error);
}
- bcopy((char *)&mac.wi_mac_addr, (char *)&sc->sc_arpcom.ac_enaddr,
- ETHER_ADDR_LEN);
+ bcopy((char *)&mac.wi_mac_addr, (char *)&ic->ic_myaddr,
+ IEEE80211_ADDR_LEN);
wi_get_id(sc);
- printf("address %s", ether_sprintf(sc->sc_arpcom.ac_enaddr));
+ printf("address %s", ether_sprintf(ic->ic_myaddr));
- ifp = &sc->sc_arpcom.ac_if;
bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
@@ -427,14 +431,13 @@ wi_attach(struct wi_softc *sc, struct wi_funcs *funcs)
* Call MI attach routines.
*/
if_attach(ifp);
- ether_ifattach(ifp);
+ ieee80211_ifattach(ifp);
printf("\n");
sc->wi_flags |= WI_FLAGS_ATTACHED;
#if NBPFILTER > 0
- BPFATTACH(&sc->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB,
- sizeof(struct ether_header));
+ BPFATTACH(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
sc->sc_sdhook = shutdownhook_establish(wi_shutdown, sc);
@@ -468,7 +471,7 @@ wi_intr(void *vsc)
DPRINTF(WID_INTR, ("wi_intr: sc %p\n", sc));
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
if (!(sc->wi_flags & WI_FLAGS_ATTACHED) || !(ifp->if_flags & IFF_UP)) {
CSR_WRITE_2(sc, WI_INT_EN, 0);
@@ -541,7 +544,7 @@ wi_rxeof(struct wi_softc *sc)
int maxlen;
int id;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
id = wi_get_fid(sc, WI_RX_FID);
@@ -692,7 +695,7 @@ wi_rxeof(struct wi_softc *sc)
mtod(m, caddr_t) + WI_802_11_OFFSET_RAW,
rxlen + 2)) {
m_freem(m);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap: failed to copy header\n");
ifp->if_ierrors++;
return;
@@ -782,7 +785,7 @@ wi_rxeof(struct wi_softc *sc)
sizeof(struct ether_header);
if (wi_do_hostdecrypt(sc, sc->wi_rxbuf +
sizeof(struct ether_header), len)) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf(WI_PRT_FMT ": Error decrypting incoming packet.\n", WI_PRT_ARG(sc));
m_freem(m);
ifp->if_ierrors++;
@@ -841,7 +844,7 @@ wi_txeof(struct wi_softc *sc, int status)
{
struct ifnet *ifp;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
ifp->if_timer = 0;
ifp->if_flags &= ~IFF_OACTIVE;
@@ -862,7 +865,7 @@ wi_inquire(void *xsc)
int s, rv;
sc = xsc;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
timeout_add(&sc->sc_timo, hz * 60);
@@ -890,7 +893,7 @@ wi_update_stats(struct wi_softc *sc)
int len, i;
u_int16_t t;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
id = wi_get_fid(sc, WI_INFO_FID);
@@ -941,7 +944,7 @@ wi_cmd_io(struct wi_softc *sc, int cmd, int val0, int val1, int val2)
break;
}
if (i < 0) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf(WI_PRT_FMT ": wi_cmd_io: busy bit won't clear\n",
WI_PRT_ARG(sc));
return(ETIMEDOUT);
@@ -969,7 +972,7 @@ wi_cmd_io(struct wi_softc *sc, int cmd, int val0, int val1, int val2)
}
if (i < 0) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf(WI_PRT_FMT
": timeout in wi_cmd 0x%04x; event status 0x%04x\n",
WI_PRT_ARG(sc), cmd, s);
@@ -1394,7 +1397,7 @@ wi_setmulti(struct wi_softc *sc)
struct ether_multistep step;
struct ether_multi *enm;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
bzero((char *)&mcast, sizeof(mcast));
@@ -1407,7 +1410,7 @@ allmulti:
return;
}
- ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm);
+ ETHER_FIRST_MULTI(step, &sc->sc_ic.ic_ac, enm);
while (enm != NULL) {
if (i >= 16) {
bzero((char *)&mcast, sizeof(mcast));
@@ -1436,13 +1439,13 @@ wi_setdef(struct wi_softc *sc, struct wi_req *wreq)
struct ifnet *ifp;
int error = 0;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
switch(wreq->wi_type) {
case WI_RID_MAC_NODE:
bcopy((char *)&wreq->wi_val, LLADDR(ifp->if_sadl),
ETHER_ADDR_LEN);
- bcopy((char *)&wreq->wi_val, (char *)&sc->sc_arpcom.ac_enaddr,
+ bcopy((char *)&wreq->wi_val, (char *)&sc->sc_ic.ic_myaddr,
ETHER_ADDR_LEN);
break;
case WI_RID_PORTTYPE:
@@ -1558,7 +1561,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
DPRINTF (WID_IOCTL, ("wi_ioctl: command %lu data %p\n",
command, data));
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, command, data)) > 0) {
+ if ((error = ether_ioctl(ifp, &sc->sc_ic.ic_ac, command, data)) > 0) {
splx(s);
return error;
}
@@ -1570,7 +1573,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#ifdef INET
case AF_INET:
wi_init(sc);
- arp_ifinit(&sc->sc_arpcom, ifa);
+ arp_ifinit(&sc->sc_ic.ic_ac, ifa);
break;
#endif /* INET */
default:
@@ -1610,8 +1613,8 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
case SIOCDELMULTI:
/* Update our multicast list. */
error = (command == SIOCADDMULTI) ?
- ether_addmulti(ifr, &sc->sc_arpcom) :
- ether_delmulti(ifr, &sc->sc_arpcom);
+ ether_addmulti(ifr, &sc->sc_ic.ic_ac) :
+ ether_delmulti(ifr, &sc->sc_ic.ic_ac);
if (error == ENETRESET) {
/*
@@ -1872,7 +1875,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
STATIC void
wi_init_io(struct wi_softc *sc)
{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &sc->sc_ic.ic_ac.ac_if;
int s;
struct wi_ltv_macaddr mac;
int id = 0;
@@ -1944,7 +1947,7 @@ wi_init_io(struct wi_softc *sc)
/* Set our MAC address. */
mac.wi_len = 4;
mac.wi_type = WI_RID_MAC_NODE;
- bcopy((char *)&sc->sc_arpcom.ac_enaddr,
+ bcopy((char *)&sc->sc_ic.ic_myaddr,
(char *)&mac.wi_mac_addr, ETHER_ADDR_LEN);
wi_write_record(sc, (struct wi_ltv_gen *)&mac);
@@ -2191,7 +2194,7 @@ wi_do_hostdecrypt(struct wi_softc *sc, caddr_t buf, int len)
if ((dat[0] != crc) && (dat[1] != crc >> 8) &&
(dat[2] != crc >> 16) && (dat[3] != crc >> 24)) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf(WI_PRT_FMT ": wi_do_hostdecrypt: iv mismatch: "
"0x%02x%02x%02x%02x vs. 0x%x\n", WI_PRT_ARG(sc),
dat[3], dat[2], dat[1], dat[0], crc);
@@ -2256,7 +2259,7 @@ nextpkt:
if (sc->wi_ptype == WI_PORTTYPE_HOSTAP) {
tx_frame.wi_tx_ctl = htole16(WI_ENC_TX_MGMT); /* XXX */
tx_frame.wi_frame_ctl |= htole16(WI_FCTL_FROMDS);
- bcopy((char *)&sc->sc_arpcom.ac_enaddr,
+ bcopy((char *)&sc->sc_ic.ic_myaddr,
(char *)&tx_frame.wi_addr2, ETHER_ADDR_LEN);
bcopy((char *)&eh->ether_shost,
(char *)&tx_frame.wi_addr3, ETHER_ADDR_LEN);
@@ -2266,7 +2269,7 @@ nextpkt:
sc->wi_crypto_algorithm != WI_CRYPTO_FIRMWARE_WEP) {
tx_frame.wi_tx_ctl = htole16(WI_ENC_TX_MGMT); /* XXX */
tx_frame.wi_frame_ctl |= htole16(WI_FCTL_TODS);
- bcopy((char *)&sc->sc_arpcom.ac_enaddr,
+ bcopy((char *)&sc->sc_ic.ic_myaddr,
(char *)&tx_frame.wi_addr2, ETHER_ADDR_LEN);
bcopy((char *)&eh->ether_dhost,
(char *)&tx_frame.wi_addr3, ETHER_ADDR_LEN);
@@ -2417,7 +2420,7 @@ wi_stop(struct wi_softc *sc)
timeout_del(&sc->sc_timo);
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
wi_intr_enable(sc, 0);
wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0, 0, 0);
@@ -2450,7 +2453,7 @@ void
wi_detach(struct wi_softc *sc)
{
struct ifnet *ifp;
- ifp = &sc->sc_arpcom.ac_if;
+ ifp = &sc->sc_ic.ic_if;
if (ifp->if_flags & IFF_RUNNING)
wi_stop(sc);
@@ -2671,7 +2674,7 @@ wi_media_change(struct ifnet *ifp)
break;
}
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP) {
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP) {
if (otype != sc->wi_ptype || orate != sc->wi_tx_rate ||
ocreate_ibss != sc->wi_create_ibss)
wi_init(sc);
@@ -2688,7 +2691,7 @@ wi_media_status(struct ifnet *ifp, struct ifmediareq *imr)
struct wi_softc *sc = ifp->if_softc;
struct wi_req wreq;
- if (!(sc->sc_arpcom.ac_if.if_flags & IFF_UP)) {
+ if (!(sc->sc_ic.ic_if.if_flags & IFF_UP)) {
imr->ifm_active = IFM_IEEE80211|IFM_NONE;
imr->ifm_status = 0;
return;
@@ -2768,7 +2771,7 @@ wi_set_nwkey(struct wi_softc *sc, struct ieee80211_nwkey *nwkey)
wk->wi_len = (sizeof(*wk) / 2) + 1;
wk->wi_type = WI_RID_DEFLT_CRYPT_KEYS;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP) {
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP) {
error = wi_write_record(sc, (struct wi_ltv_gen *)&wreq);
if (error)
return error;
@@ -2779,7 +2782,7 @@ wi_set_nwkey(struct wi_softc *sc, struct ieee80211_nwkey *nwkey)
wreq.wi_len = 2;
wreq.wi_type = WI_RID_TX_CRYPT_KEY;
wreq.wi_val[0] = htole16(nwkey->i_defkid - 1);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP) {
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP) {
error = wi_write_record(sc, (struct wi_ltv_gen *)&wreq);
if (error)
return error;
@@ -2789,7 +2792,7 @@ wi_set_nwkey(struct wi_softc *sc, struct ieee80211_nwkey *nwkey)
wreq.wi_type = WI_RID_ENCRYPTION;
wreq.wi_val[0] = htole16(nwkey->i_wepon);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP) {
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP) {
error = wi_write_record(sc, (struct wi_ltv_gen *)&wreq);
if (error)
return error;
@@ -2797,7 +2800,7 @@ wi_set_nwkey(struct wi_softc *sc, struct ieee80211_nwkey *nwkey)
if ((error = wi_setdef(sc, &wreq)))
return (error);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP)
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP)
wi_init(sc);
return 0;
}
@@ -2840,7 +2843,7 @@ wi_set_pm(struct wi_softc *sc, struct ieee80211_power *power)
sc->wi_pm_enabled = power->i_enabled;
sc->wi_max_sleep = power->i_maxsleep;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP)
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP)
wi_init(sc);
return (0);
@@ -2908,7 +2911,7 @@ wi_set_txpower(struct wi_softc *sc, struct ieee80211_txpower *txpower)
WI_HFA384X_CR_MANUAL_TX_POWER, power, 0)) != 0)
return (error);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("%s: %u (%d dBm)\n", sc->sc_dev.dv_xname, power,
sc->wi_txpower);
diff --git a/sys/dev/ic/if_wi_hostap.c b/sys/dev/ic/if_wi_hostap.c
index c30d04c7616..a18b2b4039a 100644
--- a/sys/dev/ic/if_wi_hostap.c
+++ b/sys/dev/ic/if_wi_hostap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_hostap.c,v 1.31 2005/01/04 18:13:03 millert Exp $ */
+/* $OpenBSD: if_wi_hostap.c,v 1.32 2005/10/31 05:37:13 jsg Exp $ */
/*
* Copyright (c) 2002
@@ -70,6 +70,7 @@
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_var.h>
#include <dev/rndvar.h>
@@ -190,7 +191,7 @@ wihap_init(struct wi_softc *sc)
int i;
struct wihap_info *whi = &sc->wi_hostap_info;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_init: sc=0x%x whi=0x%x\n", sc, whi);
bzero(whi, sizeof(struct wihap_info));
@@ -218,7 +219,7 @@ wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
struct wi_80211_hdr *resp_hdr;
caddr_t pkt;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("Sending disassoc to sta %s\n", ether_sprintf(sta_addr));
/* Send disassoc packet. */
@@ -228,8 +229,8 @@ wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
bcopy(sta_addr, resp_hdr->addr1, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr2, IEEE80211_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr3, IEEE80211_ADDR_LEN);
put_hword(&pkt, reason);
@@ -247,7 +248,7 @@ wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
struct wi_80211_hdr *resp_hdr;
caddr_t pkt;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("Sending deauth to sta %s\n", ether_sprintf(sta_addr));
/* Send deauth packet. */
@@ -257,8 +258,8 @@ wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
bcopy(sta_addr, resp_hdr->addr1, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr2, IEEE80211_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr3, IEEE80211_ADDR_LEN);
put_hword(&pkt, reason);
@@ -277,7 +278,7 @@ wihap_shutdown(struct wi_softc *sc)
struct wihap_sta_info *sta, *next;
int i, s;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_shutdown: sc=0x%x whi=0x%x\n", sc, whi);
if (!(whi->apflags & WIHAPFL_ACTIVE))
@@ -293,7 +294,7 @@ wihap_shutdown(struct wi_softc *sc)
for (sta = TAILQ_FIRST(&whi->sta_list);
sta != TAILQ_END(&whi->sta_list); sta = next) {
timeout_del(&sta->tmo);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_shutdown: FREE(sta=0x%x)\n", sta);
next = TAILQ_NEXT(sta, list);
if (sta->challenge)
@@ -361,7 +362,7 @@ wihap_timeout(void *v)
/* Became alive again, move to end of list. */
wihap_sta_movetail(whi, sta);
} else if (sta->flags & WI_SIFLAGS_ASSOC) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_timeout: disassoc due to inactivity: %s\n",
ether_sprintf(sta->addr));
@@ -378,7 +379,7 @@ wihap_timeout(void *v)
wihap_sta_movetail(whi, sta);
timeout_add(&sta->tmo, hz * whi->inactivity_time);
} else if (sta->flags & WI_SIFLAGS_AUTHEN) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_timeout: deauth due to inactivity: %s\n",
ether_sprintf(sta->addr));
@@ -563,7 +564,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
struct wi_80211_hdr *resp_hdr;
if (len < 6) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_auth_req: station %s short request\n",
ether_sprintf(rxfrm->wi_addr2));
return;
@@ -573,7 +574,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
algo = take_hword(&pkt, &len);
seq = take_hword(&pkt, &len);
status = take_hword(&pkt, &len);
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_auth_req: station %s algo=0x%x seq=0x%x\n",
ether_sprintf(rxfrm->wi_addr2), algo, seq);
@@ -606,7 +607,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
goto fail;
}
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_auth_req: new station\n");
/* Create new station. */
@@ -655,7 +656,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
challenge[i] = sta->challenge[i] =
arc4random();
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("\tchallenge: 0x%x 0x%x ...\n",
challenge[0], challenge[1]);
challenge_len = 128;
@@ -684,7 +685,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
} /* switch (seq) */
break;
default:
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_auth_req: algorithm unsupported: 0x%x\n",
algo);
status = IEEE80211_STATUS_ALG;
@@ -694,7 +695,7 @@ wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
status = IEEE80211_STATUS_SUCCESS;
fail:
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_auth_req: returns status=0x%x\n", status);
/* Send response. */
@@ -702,8 +703,8 @@ fail:
bzero(resp_hdr, sizeof(struct wi_80211_hdr));
resp_hdr->frame_ctl = htole16(WI_FTYPE_MGMT | WI_STYPE_MGMT_AUTH);
bcopy(rxfrm->wi_addr2, resp_hdr->addr1, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr2, IEEE80211_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr3, IEEE80211_ADDR_LEN);
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
put_hword(&pkt, algo);
@@ -763,7 +764,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
rates, sizeof(rates))) < 0)
return;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: from station %s\n",
ether_sprintf(rxfrm->wi_addr2));
@@ -771,7 +772,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
if (sc->wi_net_name.i_len != ssid.i_len ||
memcmp(sc->wi_net_name.i_nwid, ssid.i_nwid, ssid.i_len)) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: bad ssid: '%.*s' != '%.*s'\n",
ssid.i_len, ssid.i_nwid, sc->wi_net_name.i_len,
sc->wi_net_name.i_nwid);
@@ -788,7 +789,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
/* Check supported rates against ours. */
if (wihap_check_rates(sta, rates, rates_len) < 0) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: rates mismatch.\n");
status = IEEE80211_STATUS_BASIC_RATE;
goto fail;
@@ -803,7 +804,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
status = IEEE80211_STATUS_CAPINFO;
if ((capinfo & (IEEE80211_CAPINFO_ESS | IEEE80211_CAPINFO_IBSS)) !=
IEEE80211_CAPINFO_ESS) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: capinfo: not ESS: "
"capinfo=0x%x\n", capinfo);
goto fail;
@@ -811,14 +812,14 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
}
if ((sc->wi_use_wep && !(capinfo & IEEE80211_CAPINFO_PRIVACY)) ||
(!sc->wi_use_wep && (capinfo & IEEE80211_CAPINFO_PRIVACY))) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: WEP flag mismatch: "
"capinfo=0x%x\n", capinfo);
goto fail;
}
if ((capinfo & (IEEE80211_CAPINFO_CF_POLLABLE |
IEEE80211_CAPINFO_CF_POLLREQ)) == IEEE80211_CAPINFO_CF_POLLABLE) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: polling not supported: "
"capinfo=0x%x\n", capinfo);
goto fail;
@@ -828,7 +829,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
asid = sta->asid;
if (sta->flags & WI_SIFLAGS_ASSOC) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: already assoc'ed?\n");
}
@@ -837,7 +838,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
status = IEEE80211_STATUS_SUCCESS;
fail:
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_assoc_req: returns status=0x%x\n", status);
/* Send response. */
@@ -847,8 +848,8 @@ fail:
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
bcopy(rxfrm->wi_addr2, resp_hdr->addr1, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr2, ETHER_ADDR_LEN);
- bcopy(sc->sc_arpcom.ac_enaddr, resp_hdr->addr3, ETHER_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr2, IEEE80211_ADDR_LEN);
+ bcopy(sc->sc_ic.ic_myaddr, resp_hdr->addr3, IEEE80211_ADDR_LEN);
put_hword(&pkt, capinfo);
put_hword(&pkt, status);
@@ -878,7 +879,7 @@ wihap_deauth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
sta = wihap_sta_find(whi, rxfrm->wi_addr2);
if (sta == NULL) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_deauth_req: unknown station: %s\n",
ether_sprintf(rxfrm->wi_addr2));
}
@@ -907,7 +908,7 @@ wihap_disassoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
sta = wihap_sta_find(whi, rxfrm->wi_addr2);
if (sta == NULL) {
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
printf("wihap_disassoc_req: unknown station: %s\n",
ether_sprintf(rxfrm->wi_addr2));
}
@@ -997,7 +998,7 @@ wihap_mgmt_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
caddr_t pkt;
int s, len;
- if (sc->sc_arpcom.ac_if.if_flags & IFF_DEBUG)
+ if (sc->sc_ic.ic_if.if_flags & IFF_DEBUG)
wihap_debug_frame_type(rxfrm);
pkt = mtod(m, caddr_t) + WI_802_11_OFFSET_RAW;
@@ -1107,7 +1108,7 @@ wihap_check_tx(struct wihap_info *whi, u_int8_t addr[], u_int8_t *txrate)
int
wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
struct wihap_info *whi = &sc->wi_hostap_info;
struct wihap_sta_info *sta;
int mcast, s;
@@ -1129,7 +1130,7 @@ wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
}
/* Check BSSID. (Is this necessary?) */
- if (!addr_cmp(rxfrm->wi_addr1, sc->sc_arpcom.ac_enaddr)) {
+ if (!addr_cmp(rxfrm->wi_addr1, sc->sc_ic.ic_myaddr)) {
if (ifp->if_flags & IFF_DEBUG)
printf("wihap_data_input: incorrect bss: %s\n",
ether_sprintf(rxfrm->wi_addr1));
@@ -1208,7 +1209,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data)
struct hostap_sta stabuf;
int s, error = 0, n, flag;
- if (!(sc->sc_arpcom.ac_if.if_flags & IFF_RUNNING))
+ if (!(sc->sc_ic.ic_if.if_flags & IFF_RUNNING))
return ENODEV;
switch (command) {
diff --git a/sys/dev/ic/if_wivar.h b/sys/dev/ic/if_wivar.h
index fb9c62fc1ee..3baa12fa28c 100644
--- a/sys/dev/ic/if_wivar.h
+++ b/sys/dev/ic/if_wivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wivar.h,v 1.26 2005/07/31 23:08:58 pascoe Exp $ */
+/* $OpenBSD: if_wivar.h,v 1.27 2005/10/31 05:37:13 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -37,10 +37,8 @@
#include <dev/ic/if_wi_hostap.h>
struct wi_softc {
-#ifndef __FreeBSD__
struct device sc_dev;
-#endif /* !__FreeBSD__ */
- struct arpcom sc_arpcom;
+ struct ieee80211com sc_ic;
struct ifmedia sc_media;
bus_space_handle_t wi_bhandle;
bus_space_tag_t wi_btag;
diff --git a/sys/dev/pci/if_wi_pci.c b/sys/dev/pci/if_wi_pci.c
index 86f07d31582..847fd97fbd2 100644
--- a/sys/dev/pci/if_wi_pci.c
+++ b/sys/dev/pci/if_wi_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_pci.c,v 1.41 2005/09/11 18:17:08 mickey Exp $ */
+/* $OpenBSD: if_wi_pci.c,v 1.42 2005/10/31 05:37:13 jsg Exp $ */
/*
* Copyright (c) 2001-2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -45,6 +45,7 @@
#include <sys/device.h>
#include <sys/timeout.h>
#include <sys/socket.h>
+#include <sys/tree.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -57,6 +58,7 @@
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_var.h>
#include <machine/bus.h>
@@ -159,11 +161,9 @@ void
wi_pci_power(int why, void *arg)
{
struct wi_softc *sc = (struct wi_softc *)arg;
- struct ifnet *ifp;
if (why == PWR_RESUME) {
- ifp = &sc->sc_arpcom.ac_if;
- if (ifp->if_flags & IFF_UP)
+ if (sc->sc_ic.ic_if.if_flags & IFF_UP)
wi_init(sc);
}
}
diff --git a/sys/dev/pcmcia/if_wi_pcmcia.c b/sys/dev/pcmcia/if_wi_pcmcia.c
index 281154b0dd7..5355ea86bda 100644
--- a/sys/dev/pcmcia/if_wi_pcmcia.c
+++ b/sys/dev/pcmcia/if_wi_pcmcia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_pcmcia.c,v 1.63 2005/09/18 09:24:04 jsg Exp $ */
+/* $OpenBSD: if_wi_pcmcia.c,v 1.64 2005/10/31 05:37:13 jsg Exp $ */
/* $NetBSD: if_wi_pcmcia.c,v 1.14 2001/11/26 04:34:56 ichiro Exp $ */
/*
@@ -48,6 +48,7 @@
#include <sys/timeout.h>
#include <sys/socket.h>
#include <sys/device.h>
+#include <sys/tree.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -60,6 +61,7 @@
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_var.h>
#include <machine/bus.h>
@@ -446,7 +448,7 @@ wi_pcmcia_detach(struct device *dev, int flags)
{
struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)dev;
struct wi_softc *sc = &psc->sc_wi;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
if (!(sc->wi_flags & WI_FLAGS_ATTACHED))
return (0);
@@ -469,7 +471,7 @@ wi_pcmcia_activate(struct device *dev, enum devact act)
{
struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)dev;
struct wi_softc *sc = &psc->sc_wi;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
int s;
s = splnet();
diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c
index eda0ac19339..a8f9e6675e6 100644
--- a/sys/dev/usb/if_wi_usb.c
+++ b/sys/dev/usb/if_wi_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_usb.c,v 1.22 2005/10/20 21:46:07 fgsch Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.23 2005/10/31 05:37:13 jsg Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
@@ -39,6 +39,7 @@
#include <sys/socket.h>
#include <sys/device.h>
#include <sys/kthread.h>
+#include <sys/tree.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -62,6 +63,7 @@
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211_var.h>
#if NBPFILTER > 0
#include <net/bpf.h>
@@ -1138,7 +1140,7 @@ wi_usb_txeof_frm(usbd_xfer_handle xfer, usbd_private_handle priv,
struct wi_usb_chain *c = priv;
struct wi_usb_softc *sc = c->wi_usb_sc;
struct wi_softc *wsc = &sc->sc_wi;
- struct ifnet *ifp = &wsc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &wsc->sc_ic.ic_if;
int s;
int err = 0;
@@ -1639,7 +1641,7 @@ wi_usb_txfrm(struct wi_usb_softc *sc, wi_usb_usbin *uin, int total_len)
u_int16_t status;
int s;
struct wi_softc *wsc = &sc->sc_wi;
- struct ifnet *ifp = &wsc->sc_arpcom.ac_if;
+ struct ifnet *ifp = &wsc->sc_ic.ic_if;
s = splnet();
status = letoh16(uin->type); /* XXX -- type == status */
@@ -1850,7 +1852,7 @@ wi_usb_thread(void *arg)
if (wi_thread_info->status & WI_START) {
wi_thread_info->status &= ~WI_START;
wi_usb_tx_lock(sc);
- wi_func_io.f_start(&sc->sc_wi.sc_arpcom.ac_if);
+ wi_func_io.f_start(&sc->sc_wi.sc_ic.ic_if);
/*
* tx_unlock is explictly missing here
* is is done in txeof_frm
@@ -1860,7 +1862,7 @@ wi_usb_thread(void *arg)
wi_func_io.f_inquire(&sc->sc_wi);
} else if (wi_thread_info->status & WI_WATCHDOG) {
wi_thread_info->status &= ~WI_WATCHDOG;
- wi_func_io.f_watchdog( &sc->sc_wi.sc_arpcom.ac_if);
+ wi_func_io.f_watchdog( &sc->sc_wi.sc_ic.ic_if);
}
splx(s);
diff --git a/sys/dev/usb/if_wi_usb.h b/sys/dev/usb/if_wi_usb.h
index 41ca871b350..ebac126eda2 100644
--- a/sys/dev/usb/if_wi_usb.h
+++ b/sys/dev/usb/if_wi_usb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_usb.h,v 1.1 2003/10/26 15:34:16 drahn Exp $ */
+/* $OpenBSD: if_wi_usb.h,v 1.2 2005/10/31 05:37:13 jsg Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
@@ -141,7 +141,7 @@ typedef union {
#define WI_USB_BUFAVAIL 0x8006
#define WI_USB_ERROR 0x8007
-#define WI_GET_IFP(sc) &(sc)->sc_wi.sc_arpcom.ac_if
+#define WI_GET_IFP(sc) &(sc)->sc_wi.sc_ic.ic_if
/* USB */
int wi_cmd_usb(struct wi_softc *sc, int cmd, int val0, int val1, int val2);