remove IBSS and HostAP support from net80211 and 802.11 drivers.
it can be used to shrink RAMDISK kernels for instance (like what
was done for wi(4)).
it also has the benefit of highlighting what is specific to IBSS
and HostAP modes in the code.
the cost is that we now have two code paths to maintain.
-/* $OpenBSD: acx.c,v 1.86 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: acx.c,v 1.87 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
int acx_set_null_tmplt(struct acx_softc *);
int acx_set_probe_req_tmplt(struct acx_softc *, const char *, int);
+#ifndef IEEE80211_STA_ONLY
int acx_set_probe_resp_tmplt(struct acx_softc *, struct ieee80211_node *);
int acx_beacon_locate(struct mbuf *, u_int8_t);
int acx_set_beacon_tmplt(struct acx_softc *, struct ieee80211_node *);
+#endif
int acx_read_eeprom(struct acx_softc *, uint32_t, uint8_t *);
int acx_read_phyreg(struct acx_softc *, uint32_t, uint8_t *);
*/
ic->ic_caps =
IEEE80211_C_WEP | /* WEP */
- IEEE80211_C_IBSS | /* IBSS mode */
IEEE80211_C_MONITOR | /* Monitor mode */
+#ifndef IEEE80211_STA_ONLY
+ IEEE80211_C_IBSS | /* IBSS mode */
IEEE80211_C_HOSTAP | /* Access Point */
+#endif
IEEE80211_C_SHPREAMBLE; /* Short preamble */
/* Get station id */
}
break;
case IEEE80211_S_RUN:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS ||
ic->ic_opmode == IEEE80211_M_HOSTAP) {
struct ieee80211_node *ni;
DPRINTF(("%s: join IBSS\n", sc->sc_dev.dv_xname));
error = 0;
}
-
+#endif
/* fake a join to init the tx rate */
if (ic->ic_opmode == IEEE80211_M_STA)
acx_newassoc(ic, ic->ic_bss, 1);
ACX_TMPLT_PROBE_REQ_SIZ(len)));
}
+#ifndef IEEE80211_STA_ONLY
struct mbuf *ieee80211_get_probe_resp(struct ieee80211com *,
struct ieee80211_node *);
return (acx_set_tmplt(sc, ACXCMD_TMPLT_TIM, &tim, len));
}
+#endif /* IEEE80211_STA_ONLY */
void
acx_init_cmd_reg(struct acx_softc *sc)
bj->beacon_intvl = htole16(acx_beacon_intvl);
/* TODO tunable */
- dtim_intvl = sc->sc_ic.ic_opmode == IEEE80211_M_IBSS ? 1 : 10;
+#ifndef IEEE80211_STA_ONLY
+ if (sc->sc_ic.ic_opmode == IEEE80211_M_IBSS)
+ dtim_intvl = 1;
+ else
+#endif
+ dtim_intvl = 10;
sc->chip_set_bss_join_param(sc, bj->chip_spec, dtim_intvl);
bj->ndata_txrate = ACX_NDATA_TXRATE_1;
-/* $OpenBSD: an.c,v 1.55 2008/07/21 18:43:19 damien Exp $ */
+/* $OpenBSD: an.c,v 1.56 2008/08/27 09:05:03 damien Exp $ */
/* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
- ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_PMGT | IEEE80211_C_IBSS |
- IEEE80211_C_MONITOR;
+ ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_PMGT | IEEE80211_C_MONITOR;
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_caps |= IEEE80211_C_IBSS;
+#endif
ic->ic_state = IEEE80211_S_INIT;
IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_caps.an_oemaddr);
DPRINTF(("an_linkstat_intr: status 0x%x\n", status));
if (status == AN_LINKSTAT_ASSOCIATED) {
- if (ic->ic_state != IEEE80211_S_RUN ||
- ic->ic_opmode == IEEE80211_M_IBSS)
+ if (ic->ic_state != IEEE80211_S_RUN
+#ifndef IEEE80211_STA_ONLY
+ || ic->ic_opmode == IEEE80211_M_IBSS
+#endif
+ )
ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
} else {
if (ic->ic_opmode == IEEE80211_M_STA)
AN_OPMODE_INFRASTRUCTURE_STATION;
sc->sc_config.an_rxmode = AN_RXMODE_BC_MC_ADDR;
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
sc->sc_config.an_opmode = AN_OPMODE_IBSS_ADHOC;
sc->sc_config.an_rxmode = AN_RXMODE_BC_MC_ADDR;
break;
+#endif
case IEEE80211_M_MONITOR:
sc->sc_config.an_opmode =
AN_OPMODE_INFRASTRUCTURE_STATION;
error = ENETRESET;
}
+#ifndef IEEE80211_STA_ONLY
if (ime->ifm_media & IFM_IEEE80211_ADHOC)
newmode = IEEE80211_M_IBSS;
else if (ime->ifm_media & IFM_IEEE80211_HOSTAP)
newmode = IEEE80211_M_HOSTAP;
- else if (ime->ifm_media & IFM_IEEE80211_MONITOR)
+ else
+#endif
+ if (ime->ifm_media & IFM_IEEE80211_MONITOR)
newmode = IEEE80211_M_MONITOR;
else
newmode = IEEE80211_M_STA;
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
imr->ifm_active |= IFM_IEEE80211_ADHOC;
break;
case IEEE80211_M_HOSTAP:
imr->ifm_active |= IFM_IEEE80211_HOSTAP;
break;
+#endif
case IEEE80211_M_MONITOR:
imr->ifm_active |= IFM_IEEE80211_MONITOR;
break;
-/* $OpenBSD: ar5210.c,v 1.41 2007/11/01 20:32:16 reyk Exp $ */
+/* $OpenBSD: ar5210.c,v 1.42 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
AR5K_AR5210_STA_ID1_PWR_SV;
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
pcu_reg |= AR5K_AR5210_STA_ID1_ADHOC |
AR5K_AR5210_STA_ID1_NO_PSPOLL |
AR5K_AR5210_STA_ID1_DESC_ANTENNA;
beacon_reg |= AR5K_AR5210_BCR_AP;
break;
+#endif
case IEEE80211_M_MONITOR:
pcu_reg |= AR5K_AR5210_STA_ID1_NO_PSPOLL;
-/* $OpenBSD: ar5211.c,v 1.37 2008/07/30 07:15:39 reyk Exp $ */
+/* $OpenBSD: ar5211.c,v 1.38 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
pcu_reg = 0;
switch (hal->ah_op_mode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
pcu_reg |= AR5K_AR5211_STA_ID1_ADHOC |
AR5K_AR5211_STA_ID1_DESC_ANTENNA;
pcu_reg |= AR5K_AR5211_STA_ID1_AP |
AR5K_AR5211_STA_ID1_RTS_DEFAULT_ANTENNA;
break;
+#endif
case IEEE80211_M_STA:
case IEEE80211_M_MONITOR:
-/* $OpenBSD: ar5212.c,v 1.45 2008/07/30 07:43:01 reyk Exp $ */
+/* $OpenBSD: ar5212.c,v 1.46 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
pcu_reg = 0;
switch (hal->ah_op_mode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
pcu_reg |= AR5K_AR5212_STA_ID1_ADHOC |
AR5K_AR5212_STA_ID1_DESC_ANTENNA;
pcu_reg |= AR5K_AR5212_STA_ID1_AP |
AR5K_AR5212_STA_ID1_RTS_DEFAULT_ANTENNA;
break;
+#endif
case IEEE80211_M_STA:
case IEEE80211_M_MONITOR:
-/* $OpenBSD: ath.c,v 1.74 2008/08/25 20:43:49 jmc Exp $ */
+/* $OpenBSD: ath.c,v 1.75 2008/08/27 09:05:03 damien Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
void ath_mcastfilter_compute(struct ath_softc *, u_int32_t (*)[2]);
u_int32_t ath_calcrxfilter(struct ath_softc *);
void ath_mode_init(struct ath_softc *);
+#ifndef IEEE80211_STA_ONLY
int ath_beacon_alloc(struct ath_softc *, struct ieee80211_node *);
void ath_beacon_proc(void *, int);
void ath_beacon_free(struct ath_softc *);
+#endif
void ath_beacon_config(struct ath_softc *);
int ath_desc_alloc(struct ath_softc *);
void ath_desc_free(struct ath_softc *);
void ath_setcurmode(struct ath_softc *, enum ieee80211_phymode);
void ath_rssadapt_updatenode(void *, struct ieee80211_node *);
void ath_rssadapt_updatestats(void *);
+#ifndef IEEE80211_STA_ONLY
void ath_recv_mgmt(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *, int);
+#endif
void ath_disable(struct ath_softc *);
void ath_power(int, void *);
ATH_TASK_INIT(&sc->sc_rxorntask, ath_rxorn_proc, sc);
ATH_TASK_INIT(&sc->sc_fataltask, ath_fatal_proc, sc);
ATH_TASK_INIT(&sc->sc_bmisstask, ath_bmiss_proc, sc);
+#ifndef IEEE80211_STA_ONLY
ATH_TASK_INIT(&sc->sc_swbatask, ath_beacon_proc, sc);
+#endif
/*
* For now just pre-allocate one data queue and one
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_caps = IEEE80211_C_WEP /* wep supported */
| IEEE80211_C_PMGT /* power management */
+#ifndef IEEE80211_STA_ONLY
| IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
| IEEE80211_C_HOSTAP /* hostap mode */
+#endif
| IEEE80211_C_MONITOR /* monitor mode */
| IEEE80211_C_SHSLOT /* short slot time supported */
| IEEE80211_C_SHPREAMBLE; /* short preamble supported */
ic->ic_node_getrssi = ath_node_getrssi;
sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = ath_newstate;
+#ifndef IEEE80211_STA_ONLY
sc->sc_recv_mgmt = ic->ic_recv_mgmt;
ic->ic_recv_mgmt = ath_recv_mgmt;
+#endif
ic->ic_max_rssi = AR5K_MAX_RSSI;
bcopy(etherbroadcastaddr, sc->sc_broadcast_addr, IEEE80211_ADDR_LEN);
sc->sc_imask = HAL_INT_RX | HAL_INT_TX
| HAL_INT_RXEOL | HAL_INT_RXORN
| HAL_INT_FATAL | HAL_INT_GLOBAL;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
sc->sc_imask |= HAL_INT_MIB;
+#endif
ath_hal_set_intr(ah, sc->sc_imask);
ifp->if_flags |= IFF_RUNNING;
sc->sc_rxlink = NULL;
}
IFQ_PURGE(&ifp->if_snd);
+#ifndef IEEE80211_STA_ONLY
ath_beacon_free(sc);
+#endif
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
if (!sc->sc_invalid) {
ath_hal_set_power(ah, HAL_PM_FULL_SLEEP, 0);
| HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
if (ic->ic_opmode != IEEE80211_M_STA)
rfilt |= HAL_RX_FILTER_PROBEREQ;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_AHDEMO)
+#endif
rfilt |= HAL_RX_FILTER_BEACON;
if (ifp->if_flags & IFF_PROMISC)
rfilt |= HAL_RX_FILTER_PROM;
return m;
}
+#ifndef IEEE80211_STA_ONLY
int
ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_node *ni)
{
bf->bf_node = NULL;
}
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Configure the beacon and sleep timers.
ath_hal_set_beacon_timers(ah, &bs, 0/*XXX*/, 0, 0);
sc->sc_imask |= HAL_INT_BMISS;
ath_hal_set_intr(ah, sc->sc_imask);
- } else {
+ }
+#ifndef IEEE80211_STA_ONLY
+ else {
ath_hal_set_intr(ah, 0);
if (nexttbtt == intval)
intval |= HAL_BEACON_RESET_TSF;
if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_veol)
ath_beacon_proc(sc, 0);
}
+#endif
}
int
ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf)
{
struct ath_hal *ah = sc->sc_ah;
- struct ieee80211com *ic = &sc->sc_ic;
int error;
struct mbuf *m;
struct ath_desc *ds;
*/
ds = bf->bf_desc;
bzero(ds, sizeof(struct ath_desc));
- if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#ifndef IEEE80211_STA_ONLY
+ if (sc->sc_ic.ic_opmode != IEEE80211_M_HOSTAP)
ds->ds_link = bf->bf_daddr; /* link to self */
+#endif
ds->ds_data = bf->bf_segs[0].ds_addr;
ath_hal_setup_rx_desc(ah, ds
, m->m_len /* buffer size */
/*
* Allocate and setup the beacon frame for AP or adhoc mode.
*/
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS) {
error = ath_beacon_alloc(sc, ni);
if (error != 0)
goto bad;
}
-
+#endif
/*
* Configure the beacon and sleep timers.
*/
return error;
}
+#ifndef IEEE80211_STA_ONLY
void
ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m,
struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int subtype)
}
return;
}
+#endif
/*
* Setup driver-specific state for a newly associated node.
-/* $OpenBSD: atw.c,v 1.60 2008/07/21 18:43:19 damien Exp $ */
+/* $OpenBSD: atw.c,v 1.61 2008/08/27 09:05:03 damien Exp $ */
/* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */
/*-
/* 802.11 state machine */
int atw_newstate(struct ieee80211com *, enum ieee80211_state, int);
int atw_tune(struct atw_softc *);
+#ifndef IEEE80211_STA_ONLY
void atw_recv_mgmt(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *, int);
+#endif
void atw_next_scan(void *);
/* Device initialization */
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
- ic->ic_caps = IEEE80211_C_PMGT | IEEE80211_C_IBSS |
- IEEE80211_C_HOSTAP | IEEE80211_C_MONITOR | IEEE80211_C_WEP;
-
+ ic->ic_caps = IEEE80211_C_PMGT | IEEE80211_C_MONITOR | IEEE80211_C_WEP;
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_caps |= IEEE80211_C_IBSS | IEEE80211_C_HOSTAP;
+#endif
ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b;
/*
sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = atw_newstate;
+#ifndef IEEE80211_STA_ONLY
sc->sc_recv_mgmt = ic->ic_recv_mgmt;
ic->ic_recv_mgmt = atw_recv_mgmt;
+#endif
sc->sc_node_free = ic->ic_node_free;
ic->ic_node_free = atw_node_free;
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_AHDEMO: /* XXX */
case IEEE80211_M_IBSS:
ic->ic_flags |= IEEE80211_F_IBSSON;
/*FALLTHROUGH*/
case IEEE80211_M_HOSTAP: /* XXX */
break;
- case IEEE80211_M_MONITOR: /* XXX */
+#endif
+ default: /* XXX */
break;
}
+#ifndef IEEE80211_STA_ONLY
switch (ic->ic_opmode) {
case IEEE80211_M_AHDEMO:
case IEEE80211_M_HOSTAP:
default: /* XXX */
break;
}
-
+#endif
sc->sc_wepctl = 0;
atw_write_ssid(sc);
atw_start_beacon(sc, 1);
}
+#ifndef IEEE80211_STA_ONLY
void
atw_recv_mgmt(struct ieee80211com *ic, struct mbuf *m,
struct ieee80211_node *ni, struct ieee80211_rxinfo *rxi, int subtype)
}
return;
}
+#endif
/* Write the SSID in the ieee80211com to the SRAM on the ADM8211.
* In ad hoc mode, the SSID is written to the beacons sent by the
atw_start_beacon(struct atw_softc *sc, int start)
{
struct ieee80211com *ic = &sc->sc_ic;
+#ifndef IEEE80211_STA_ONLY
uint16_t chan;
- uint32_t bcnt, bpli, cap0, cap1, capinfo;
+ uint32_t bpli;
+#endif
+ uint32_t bcnt, cap0, cap1, capinfo;
size_t len;
if (ATW_IS_ENABLED(sc) == 0)
if (ic->ic_flags & IEEE80211_F_WEPON)
capinfo |= IEEE80211_CAPINFO_PRIVACY;
+#ifndef IEEE80211_STA_ONLY
switch (ic->ic_opmode) {
case IEEE80211_M_IBSS:
len += 4; /* IBSS parameters */
sc->sc_dev.dv_xname, bcnt));
DPRINTF(sc, ("%s: atw_start_beacon reg[ATW_CAP1] = %08x\n",
sc->sc_dev.dv_xname, cap1));
+#endif
}
/* Return the 32 lsb of the last TSFT divisible by ival. */
uint8_t tstamp[8];
} u;
+#ifndef IEEE80211_STA_ONLY
if ((ic->ic_opmode == IEEE80211_M_HOSTAP) ||
((ic->ic_opmode == IEEE80211_M_IBSS) &&
(ic->ic_flags & IEEE80211_F_SIBSS))) {
u.word = htole64(tsft);
(void)memcpy(&ic->ic_bss->ni_tstamp[0], &u.tstamp[0],
sizeof(ic->ic_bss->ni_tstamp));
- } else {
+ } else
+#endif
+ {
(void)memcpy(&u, &ic->ic_bss->ni_tstamp[0], sizeof(u));
tsft = letoh64(u.word);
}
atw_write_ssid(sc);
atw_write_sup_rates(sc);
- if (ic->ic_opmode == IEEE80211_M_AHDEMO ||
+ if (
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_opmode == IEEE80211_M_AHDEMO ||
+#endif
ic->ic_opmode == IEEE80211_M_MONITOR)
break;
if (nstate != IEEE80211_S_SCAN)
timeout_del(&sc->sc_scan_to);
+#ifndef IEEE80211_STA_ONLY
if (nstate == IEEE80211_S_RUN &&
(ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS))
atw_start_beacon(sc, 1);
else
+#endif
atw_start_beacon(sc, 0);
error = (*sc->sc_newstate)(ic, nstate, arg);
-/* $OpenBSD: bwi.c,v 1.78 2008/08/22 19:58:21 deraadt Exp $ */
+/* $OpenBSD: bwi.c,v 1.79 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
mac_status |= BWI_MAC_STATUS_PROMISC;
switch (ic->ic_opmode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
mac_status &= ~BWI_MAC_STATUS_INFRA;
break;
case IEEE80211_M_HOSTAP:
mac_status |= BWI_MAC_STATUS_OPMODE_HOSTAP;
break;
+#endif
case IEEE80211_M_MONITOR:
#if 0
/* Do you want data from your microwave oven? */
CSR_WRITE_4(sc, BWI_MAC_STATUS, mac_status);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_IBSS &&
ic->ic_opmode != IEEE80211_M_HOSTAP) {
+#endif
if (sc->sc_bbp_id == BWI_BBPID_BCM4306 && sc->sc_bbp_rev == 3)
pre_tbtt = 100;
else
pre_tbtt = 50;
+#ifndef IEEE80211_STA_ONLY
} else
pre_tbtt = 2;
+#endif
CSR_WRITE_2(sc, BWI_MAC_PRE_TBTT, pre_tbtt);
}
bwi_mac_lock(struct bwi_mac *mac)
{
struct bwi_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
KASSERT((mac->mac_flags & BWI_MAC_F_LOCKED) == 0);
if (mac->mac_rev < 3)
bwi_mac_stop(mac);
- else if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+ else
+#ifndef IEEE80211_STA_ONLY
+ if (sc->sc_ic.ic_opmode != IEEE80211_M_HOSTAP)
+#endif
bwi_mac_config_ps(mac);
CSR_SETBITS_4(sc, BWI_MAC_STATUS, BWI_MAC_STATUS_RFLOCK);
bwi_mac_unlock(struct bwi_mac *mac)
{
struct bwi_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
KASSERT(mac->mac_flags & BWI_MAC_F_LOCKED);
if (mac->mac_rev < 3)
bwi_mac_start(mac);
- else if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+ else
+#ifndef IEEE80211_STA_ONLY
+ if (sc->sc_ic.ic_opmode != IEEE80211_M_HOSTAP)
+#endif
bwi_mac_config_ps(mac);
mac->mac_flags &= ~BWI_MAC_F_LOCKED;
if (ic->ic_opmode == IEEE80211_M_STA)
bwi_iter_func(sc, ic->ic_bss);
+#ifndef IEEE80211_STA_ONLY
else
ieee80211_iterate_nodes(ic, bwi_iter_func, sc);
+#endif
timeout_add(&sc->sc_amrr_ch, hz / 2);
}
-/* $OpenBSD: malo.c,v 1.85 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: malo.c,v 1.86 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
imr->ifm_active |= IFM_IEEE80211_ADHOC;
break;
- case IEEE80211_M_MONITOR:
- imr->ifm_active |= IFM_IEEE80211_MONITOR;
- break;
case IEEE80211_M_AHDEMO:
break;
case IEEE80211_M_HOSTAP:
break;
+#endif
+ case IEEE80211_M_MONITOR:
+ imr->ifm_active |= IFM_IEEE80211_MONITOR;
+ break;
+ default:
+ break;
}
switch (ic->ic_curmode) {
malo_set_slot(sc);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/* TODO */
}
+#endif
}
#ifdef MALO_DEBUG
bzero(body, sizeof(*body));
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/* TODO */
- } else {
+ } else
+#endif
+ {
body->aprates[0] = 2;
body->aprates[1] = 4;
body->aprates[2] = 11;
-/* $OpenBSD: pgt.c,v 1.50 2008/07/21 18:43:19 damien Exp $ */
+/* $OpenBSD: pgt.c,v 1.51 2008/08/27 09:05:03 damien Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
if (ni != NULL) {
if (ic->ic_opmode == IEEE80211_M_STA) {
*ni = ieee80211_ref_node(ic->ic_bss);
- } else {
+ }
+#ifndef IEEE80211_STA_ONLY
+ else {
*ni = ieee80211_find_node(ic, eh->ether_shost);
/*
* Make up associations for ad-hoc mode. To support
return (NULL);
}
}
+#endif
(*ni)->ni_inact = 0;
}
snap->llc_dsap = snap->llc_ssap = LLC_SNAP_LSAP;
IEEE80211_ADDR_COPY(frame->i_addr2, ic->ic_bss->ni_bssid);
IEEE80211_ADDR_COPY(frame->i_addr3, eh->ether_shost);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
frame->i_fc[1] = IEEE80211_FC1_DIR_NODS;
IEEE80211_ADDR_COPY(frame->i_addr2, eh->ether_shost);
IEEE80211_ADDR_COPY(frame->i_addr3, eh->ether_dhost);
break;
+#endif
default:
break;
}
}
}
- ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_IBSS | IEEE80211_C_PMGT |
- IEEE80211_C_HOSTAP | IEEE80211_C_TXPMGT | IEEE80211_C_SHSLOT |
- IEEE80211_C_SHPREAMBLE | IEEE80211_C_MONITOR;
-
+ ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_PMGT | IEEE80211_C_TXPMGT |
+ IEEE80211_C_SHSLOT | IEEE80211_C_SHPREAMBLE | IEEE80211_C_MONITOR;
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_caps |= IEEE80211_C_IBSS | IEEE80211_C_HOSTAP;
+#endif
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_state = IEEE80211_S_INIT;
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
imr->ifm_active |= IFM_IEEE80211_ADHOC;
break;
case IEEE80211_M_HOSTAP:
imr->ifm_active |= IFM_IEEE80211_HOSTAP;
break;
+#endif
case IEEE80211_M_MONITOR:
imr->ifm_active |= IFM_IEEE80211_MONITOR;
break;
sc->sc_ic.ic_opmode != IEEE80211_M_MONITOR)
pgt_async_update(sc);
+#ifndef IEEE80211_STA_ONLY
/*
* As a firmware-based HostAP, we should not time out
* nodes inside the driver additionally to the timeout
default:
break;
}
+#endif
ieee80211_watchdog(ifp);
ifp->if_timer = 1;
}
bsstype = PGT_BSS_TYPE_STA;
dot1x = PGT_DOT1X_AUTH_ENABLED;
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
if (ifp->if_flags & IFF_PROMISC)
mode = PGT_MODE_CLIENT; /* what to do? */
if (sc->sc_wds)
config |= PGT_CONFIG_WDS;
break;
+#endif
case IEEE80211_M_MONITOR:
mode = PGT_MODE_PROMISCUOUS;
bsstype = PGT_BSS_TYPE_ANY;
letoh16(mlme->pom_id),
letoh16(mlme->pom_state),
letoh16(mlme->pom_code)));
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
pgt_hostap_handle_mlme(sc, oid, mlme);
+#endif
break;
}
return;
else
ieee80211_free_allnodes(ic);
+#ifndef IEEE80211_STA_ONLY
/* Just use any old channel; we override it anyway. */
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
ieee80211_create_ibss(ic, ic->ic_ibss_chan);
+#endif
break;
case IEEE80211_S_RUN:
ic->ic_if.if_timer = 1;
-/* $OpenBSD: rt2560.c,v 1.38 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: rt2560.c,v 1.39 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2005, 2006
void rt2560_prio_intr(struct rt2560_softc *);
void rt2560_decryption_intr(struct rt2560_softc *);
void rt2560_rx_intr(struct rt2560_softc *);
+#ifndef IEEE80211_STA_ONLY
void rt2560_beacon_expire(struct rt2560_softc *);
+#endif
void rt2560_wakeup_expire(struct rt2560_softc *);
#if NBPFILTER > 0
uint8_t rt2560_rxrate(const struct rt2560_rx_desc *);
void rt2560_setup_tx_desc(struct rt2560_softc *,
struct rt2560_tx_desc *, uint32_t, int, int, int,
bus_addr_t);
+#ifndef IEEE80211_STA_ONLY
int rt2560_tx_bcn(struct rt2560_softc *, struct mbuf *,
struct ieee80211_node *);
+#endif
int rt2560_tx_mgt(struct rt2560_softc *, struct mbuf *,
struct ieee80211_node *);
int rt2560_tx_data(struct rt2560_softc *, struct mbuf *,
/* set device capabilities */
ic->ic_caps =
- IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_MONITOR | /* monitor mode supported */
+#ifndef IEEE80211_STA_ONLY
+ IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_HOSTAP | /* HostAp mode supported */
+#endif
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT | /* short slot time supported */
s = splnet();
if (ic->ic_opmode == IEEE80211_M_STA)
rt2560_iter_func(sc, ic->ic_bss);
+#ifndef IEEE80211_STA_ONLY
else
ieee80211_iterate_nodes(ic, rt2560_iter_func, sc);
+#endif
splx(s);
timeout_add(&sc->amrr_to, hz / 2);
struct rt2560_softc *sc = ic->ic_if.if_softc;
enum ieee80211_state ostate;
struct ieee80211_node *ni;
- struct mbuf *m;
int error = 0;
ostate = ic->ic_state;
rt2560_set_bssid(sc, ni->ni_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS) {
- m = ieee80211_beacon_alloc(ic, ni);
+ struct mbuf *m = ieee80211_beacon_alloc(ic, ni);
if (m == NULL) {
printf("%s: could not allocate beacon\n",
sc->sc_dev.dv_xname);
if (error != 0)
break;
}
+#endif
/* turn assocation led on */
rt2560_update_led(sc, 1, 0);
RAL_WRITE(sc, RT2560_SECCSR0, RT2560_KICK_DECRYPT);
}
+#ifndef IEEE80211_STA_ONLY
/*
* This function is called in HostAP or IBSS modes when it's time to send a
* new beacon (every ni_intval milliseconds).
DPRINTFN(15, ("beacon expired\n"));
}
+#endif
void
rt2560_wakeup_expire(struct rt2560_softc *sc)
if (!(ifp->if_flags & IFF_RUNNING))
return 0;
+#ifndef IEEE80211_STA_ONLY
if (r & RT2560_BEACON_EXPIRE)
rt2560_beacon_expire(sc);
+#endif
if (r & RT2560_WAKEUP_EXPIRE)
rt2560_wakeup_expire(sc);
}
}
+#ifndef IEEE80211_STA_ONLY
int
rt2560_tx_bcn(struct rt2560_softc *sc, struct mbuf *m0,
struct ieee80211_node *ni)
return 0;
}
+#endif
int
rt2560_tx_mgt(struct rt2560_softc *sc, struct mbuf *m0,
RAL_SIFS;
*(uint16_t *)wh->i_dur = htole16(dur);
+#ifndef IEEE80211_STA_ONLY
/* tell hardware to set timestamp for probe responses */
if ((wh->i_fc[0] &
(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
flags |= RT2560_TX_TIMESTAMP;
+#endif
}
rt2560_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate, 0,
tmp = RT2560_ENABLE_TSF | RT2560_ENABLE_TBCN;
if (ic->ic_opmode == IEEE80211_M_STA)
tmp |= RT2560_ENABLE_TSF_SYNC(1);
+#ifndef IEEE80211_STA_ONLY
else
tmp |= RT2560_ENABLE_TSF_SYNC(2) |
RT2560_ENABLE_BEACON_GENERATOR;
+#endif
RAL_WRITE(sc, RT2560_CSR14, tmp);
DPRINTF(("enabling TSF synchronization\n"));
{
struct rt2560_softc *sc = ic->ic_if.if_softc;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/*
* In HostAP mode, we defer setting of new slot time until
*/
sc->sc_flags |= RT2560_UPDATE_SLOT;
} else
+#endif
rt2560_set_slottime(sc);
}
tmp = RT2560_DROP_PHY_ERROR | RT2560_DROP_CRC_ERROR;
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
tmp |= RT2560_DROP_CTL | RT2560_DROP_VERSION_ERROR;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
tmp |= RT2560_DROP_TODS;
if (!(ifp->if_flags & IFF_PROMISC))
tmp |= RT2560_DROP_NOT_TO_ME;
-/* $OpenBSD: rt2661.c,v 1.43 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: rt2661.c,v 1.44 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2006
void rt2661_tx_dma_intr(struct rt2661_softc *,
struct rt2661_tx_ring *);
void rt2661_rx_intr(struct rt2661_softc *);
+#ifndef IEEE80211_STA_ONLY
void rt2661_mcu_beacon_expire(struct rt2661_softc *);
+#endif
void rt2661_mcu_wakeup(struct rt2661_softc *);
void rt2661_mcu_cmd_intr(struct rt2661_softc *);
int rt2661_intr(void *);
void rt2661_radar_start(struct rt2661_softc *);
int rt2661_radar_stop(struct rt2661_softc *);
#endif
+#ifndef IEEE80211_STA_ONLY
int rt2661_prepare_beacon(struct rt2661_softc *);
+#endif
void rt2661_enable_tsf_sync(struct rt2661_softc *);
int rt2661_get_rssi(struct rt2661_softc *, uint8_t);
void rt2661_power(int, void *);
/* set device capabilities */
ic->ic_caps =
- IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_MONITOR | /* monitor mode supported */
+#ifndef IEEE80211_STA_ONLY
+ IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_HOSTAP | /* HostAP mode supported */
+#endif
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT | /* short slot time supported */
rt2661_set_bssid(sc, ni->ni_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS)
rt2661_prepare_beacon(sc);
+#endif
if (ic->ic_opmode == IEEE80211_M_STA) {
/* fake a join to init the tx rate */
}
}
+#ifndef IEEE80211_STA_ONLY
/*
* This function is called in HostAP or IBSS modes when it's time to send a
* new beacon (every ni_intval milliseconds).
DPRINTFN(15, ("beacon expired\n"));
}
+#endif
void
rt2661_mcu_wakeup(struct rt2661_softc *sc)
if (r2 & RT2661_MCU_CMD_DONE)
rt2661_mcu_cmd_intr(sc);
+#ifndef IEEE80211_STA_ONLY
if (r2 & RT2661_MCU_BEACON_EXPIRE)
rt2661_mcu_beacon_expire(sc);
+#endif
if (r2 & RT2661_MCU_WAKEUP)
rt2661_mcu_wakeup(sc);
sc->sifs;
*(uint16_t *)wh->i_dur = htole16(dur);
+#ifndef IEEE80211_STA_ONLY
/* tell hardware to set timestamp in probe responses */
if ((wh->i_fc[0] &
(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
flags |= RT2661_TX_TIMESTAMP;
+#endif
}
rt2661_setup_tx_desc(sc, desc, flags, 0 /* XXX HWSEQ */,
{
struct rt2661_softc *sc = ic->ic_if.if_softc;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/*
* In HostAP mode, we defer setting of new slot time until
*/
sc->sc_flags |= RT2661_UPDATE_SLOT;
} else
+#endif
rt2661_set_slottime(sc);
}
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
tmp |= RT2661_DROP_CTL | RT2661_DROP_VER_ERROR |
RT2661_DROP_ACKCTS;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
tmp |= RT2661_DROP_TODS;
if (!(ifp->if_flags & IFF_PROMISC))
tmp |= RT2661_DROP_NOT_TO_ME;
}
#endif
+#ifndef IEEE80211_STA_ONLY
int
rt2661_prepare_beacon(struct rt2661_softc *sc)
{
return 0;
}
+#endif
/*
* Enable TSF synchronization and tell h/w to start sending beacons for IBSS
struct ieee80211com *ic = &sc->sc_ic;
uint32_t tmp;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_STA) {
/*
* Change default 16ms TBTT adjustment to 8ms.
*/
RAL_WRITE(sc, RT2661_TXRX_CSR10, 1 << 12 | 8);
}
-
+#endif
tmp = RAL_READ(sc, RT2661_TXRX_CSR9) & 0xff000000;
/* set beacon interval (in 1/16ms unit) */
tmp |= RT2661_TSF_TICKING | RT2661_ENABLE_TBTT;
if (ic->ic_opmode == IEEE80211_M_STA)
tmp |= RT2661_TSF_MODE(1);
+#ifndef IEEE80211_STA_ONLY
else
tmp |= RT2661_TSF_MODE(2) | RT2661_GENERATE_BEACON;
-
+#endif
RAL_WRITE(sc, RT2661_TXRX_CSR9, tmp);
}
-/* $OpenBSD: rt2860.c,v 1.18 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: rt2860.c,v 1.19 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2007,2008
void rt2860_stop(struct ifnet *, int);
int rt2860_load_microcode(struct rt2860_softc *);
void rt2860_calib(struct rt2860_softc *);
+#ifndef IEEE80211_STA_ONLY
int rt2860_setup_beacon(struct rt2860_softc *);
+#endif
void rt2860_enable_tsf_sync(struct rt2860_softc *);
void rt2860_power(int, void *);
/* set device capabilities */
ic->ic_caps =
- IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_MONITOR | /* monitor mode supported */
+#ifndef IEEE80211_STA_ONLY
+ IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_HOSTAP | /* HostAP mode supported */
+#endif
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT | /* short slot time supported */
{
struct rt2860_softc *sc = arg;
struct ieee80211com *ic = &sc->sc_ic;
- uint32_t tmp;
int s;
+#ifndef IEEE80211_STA_ONLY
/*
* In IBSS or HostAP modes (when the hardware sends beacons), the
* MAC can run into a livelock and start sending CTS-to-self frames
*/
if (ic->ic_curmode != IEEE80211_M_STA) {
/* check if we're in a livelock situation.. */
- tmp = RAL_READ(sc, RT2860_DEBUG);
+ uint32_t tmp = RAL_READ(sc, RT2860_DEBUG);
if ((tmp & (1 << 29)) && (tmp & (1 << 7 | 1 << 5))) {
/* ..and reset MAC/BBP for a while.. */
DPRINTF(("CTS-to-self livelock detected\n"));
RT2860_MAC_RX_EN | RT2860_MAC_TX_EN);
}
}
+#endif
s = splnet();
if (ic->ic_opmode == IEEE80211_M_STA)
rt2860_iter_func(sc, ic->ic_bss);
+#ifndef IEEE80211_STA_ONLY
else
ieee80211_iterate_nodes(ic, rt2860_iter_func, arg);
+#endif
splx(s);
timeout_add(&sc->amrr_to, hz / 2);
rt2860_set_bssid(sc, ic->ic_bss->ni_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS)
rt2860_setup_beacon(sc);
+#endif
if (ic->ic_opmode == IEEE80211_M_STA) {
/* fake a join to init the tx rate */
if (r & RT2860_TX_DONE_INT0)
rt2860_tx_intr(sc, 0);
+#ifndef IEEE80211_STA_ONLY
if (r & RT2860_MAC_INT_1) { /* pre-TBTT */
if ((sc->sc_flags & RT2860_UPD_BEACON) &&
rt2860_setup_beacon(sc) == 0)
sc->sc_flags &= ~RT2860_UPD_BEACON;
}
+#endif
if (r & RT2860_MAC_INT_0) { /* TBTT */
struct ieee80211com *ic = &sc->sc_ic;
/* check if protection mode has changed */
ic->ic_flags) + sc->sifs;
*(uint16_t *)wh->i_dur = htole16(dur);
}
+#ifndef IEEE80211_STA_ONLY
/* ask MAC to insert timestamp into probe responses */
if ((wh->i_fc[0] &
(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
/* NOTE: beacons do not pass through tx_data() */
txwi->flags |= RT2860_TX_TS;
+#endif
#if NBPFILTER > 0
if (sc->sc_drvbpf != NULL) {
struct rt2860_softc *sc = ic->ic_softc;
uint32_t tmp;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
sc->sc_flags |= RT2860_UPD_BEACON;
+#endif
tmp = RAL_READ(sc, RT2860_BKOFF_SLOT_CFG);
tmp &= ~0xff;
base = RT2860_SKEY(0, k->k_id);
if (k->k_cipher == IEEE80211_CIPHER_TKIP) {
RAL_WRITE_REGION_1(sc, base, k->k_key, 16);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
RAL_WRITE_REGION_1(sc, base + 16,
&k->k_key[16], 8);
RAL_WRITE_REGION_1(sc, base + 24,
&k->k_key[24], 8);
- } else {
+ } else
+#endif
+ {
RAL_WRITE_REGION_1(sc, base + 16,
&k->k_key[24], 8);
RAL_WRITE_REGION_1(sc, base + 24,
base = RT2860_PKEY(wcid);
if (k->k_cipher == IEEE80211_CIPHER_TKIP) {
RAL_WRITE_REGION_1(sc, base, k->k_key, 16);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
RAL_WRITE_REGION_1(sc, base + 16,
&k->k_key[16], 8);
RAL_WRITE_REGION_1(sc, base + 24,
&k->k_key[24], 8);
- } else {
+ } else
+#endif
+ {
RAL_WRITE_REGION_1(sc, base + 16,
&k->k_key[24], 8);
RAL_WRITE_REGION_1(sc, base + 24,
}
}
+#ifndef IEEE80211_STA_ONLY
int
rt2860_setup_beacon(struct rt2860_softc *sc)
{
return 0;
}
+#endif
void
rt2860_enable_tsf_sync(struct rt2860_softc *sc)
* reception.
*/
tmp |= 1 << RT2860_TSF_SYNC_MODE_SHIFT;
- } else if (ic->ic_opmode == IEEE80211_M_IBSS) {
+ }
+#ifndef IEEE80211_STA_ONLY
+ else if (ic->ic_opmode == IEEE80211_M_IBSS) {
tmp |= RT2860_BCN_TX_EN;
/*
* Local TSF is updated with remote TSF on beacon reception
/* SYNC with nobody */
tmp |= 3 << RT2860_TSF_SYNC_MODE_SHIFT;
}
+#endif
RAL_WRITE(sc, RT2860_BCN_TIME_CFG, tmp);
}
-/* $OpenBSD: rtw.c,v 1.68 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: rtw.c,v 1.69 2008/08/27 09:05:03 damien Exp $ */
/* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */
/*-
void rtw_rxring_fixup(struct rtw_softc *);
void rtw_io_enable(struct rtw_regs *, u_int8_t, int);
void rtw_intr_rx(struct rtw_softc *, u_int16_t);
+#ifndef IEEE80211_STA_ONLY
void rtw_intr_beacon(struct rtw_softc *, u_int16_t);
void rtw_intr_atim(struct rtw_softc *);
+#endif
void rtw_transmit_config(struct rtw_softc *);
void rtw_pktfilt_load(struct rtw_softc *);
void rtw_start(struct ifnet *);
void rtw_watchdog(struct ifnet *);
void rtw_next_scan(void *);
+#ifndef IEEE80211_STA_ONLY
void rtw_recv_mgmt(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *, int);
+#endif
struct ieee80211_node *rtw_node_alloc(struct ieee80211com *);
void rtw_node_free(struct ieee80211com *, struct ieee80211_node *);
void rtw_media_status(struct ifnet *, struct ifmediareq *);
struct rtw_txsoft_blk **, struct rtw_txdesc_blk **,
struct ieee80211_node **, short *);
uint64_t rtw_tsf_extend(struct rtw_regs *, u_int32_t);
+#ifndef IEEE80211_STA_ONLY
void rtw_ibss_merge(struct rtw_softc *, struct ieee80211_node *,
u_int32_t);
+#endif
void rtw_idle(struct rtw_regs *);
void rtw_led_attach(struct rtw_led_state *, void *);
void rtw_led_init(struct rtw_regs *);
rtw_start(&sc->sc_if);
}
+#ifndef IEEE80211_STA_ONLY
void
rtw_intr_beacon(struct rtw_softc *sc, u_int16_t isr)
{
/* TBD */
return;
}
+#endif /* IEEE80211_STA_ONLY */
#ifdef RTW_DEBUG
void
rtw_intr_rx(sc, isr & RTW_INTR_RX);
if ((isr & RTW_INTR_TX) != 0)
rtw_intr_tx(sc, isr & RTW_INTR_TX);
+#ifndef IEEE80211_STA_ONLY
if ((isr & RTW_INTR_BEACON) != 0)
rtw_intr_beacon(sc, isr & RTW_INTR_BEACON);
if ((isr & RTW_INTR_ATIMINT) != 0)
rtw_intr_atim(sc);
+#endif
if ((isr & RTW_INTR_IOERROR) != 0)
rtw_intr_ioerror(sc, isr & RTW_INTR_IOERROR);
if ((isr & RTW_INTR_TIMEOUT) != 0)
msr = RTW_READ8(&sc->sc_regs, RTW_MSR) & ~RTW_MSR_NETYPE_MASK;
switch (opmode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_AHDEMO:
case IEEE80211_M_IBSS:
msr |= RTW_MSR_NETYPE_ADHOC_OK;
case IEEE80211_M_HOSTAP:
msr |= RTW_MSR_NETYPE_AP_OK;
break;
+#endif
case IEEE80211_M_MONITOR:
/* XXX */
msr |= RTW_MSR_NETYPE_NOLINK;
case IEEE80211_M_STA:
msr |= RTW_MSR_NETYPE_INFRA_OK;
break;
+ default:
+ break;
}
RTW_WRITE8(&sc->sc_regs, RTW_MSR, msr);
case IEEE80211_M_MONITOR:
sc->sc_rcr |= RTW_RCR_MONITOR;
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_AHDEMO:
case IEEE80211_M_IBSS:
/* receive broadcasts in our BSS */
sc->sc_rcr |= RTW_RCR_ADD3;
break;
+#endif
default:
break;
}
break;
case IEEE80211_S_RUN:
switch (ic->ic_opmode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
case IEEE80211_M_IBSS:
rtw_set_nettype(sc, IEEE80211_M_MONITOR);
/*FALLTHROUGH*/
case IEEE80211_M_AHDEMO:
+#endif
case IEEE80211_M_STA:
rtw_join_bss(sc, ic->ic_bss->ni_bssid,
ic->ic_bss->ni_intval);
break;
- case IEEE80211_M_MONITOR:
+ default:
break;
}
rtw_set_nettype(sc, ic->ic_opmode);
return ((u_int64_t)tsfth << 32) | rstamp;
}
+#ifndef IEEE80211_STA_ONLY
void
rtw_ibss_merge(struct rtw_softc *sc, struct ieee80211_node *ni,
u_int32_t rstamp)
}
return;
}
+#endif /* IEEE80211_STA_ONLY */
struct ieee80211_node *
rtw_node_alloc(struct ieee80211com *ic)
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
- ic->ic_caps = IEEE80211_C_PMGT | IEEE80211_C_IBSS |
- IEEE80211_C_HOSTAP | IEEE80211_C_MONITOR | IEEE80211_C_WEP;
-
+ ic->ic_caps = IEEE80211_C_PMGT | IEEE80211_C_MONITOR | IEEE80211_C_WEP;
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_caps |= IEEE80211_C_HOSTAP | IEEE80211_C_IBSS;
+#endif
ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b;
rtw_led_attach(&sc->sc_led_state, (void *)sc);
mtbl->mt_newstate = ic->ic_newstate;
ic->ic_newstate = rtw_newstate;
+#ifndef IEEE80211_STA_ONLY
mtbl->mt_recv_mgmt = ic->ic_recv_mgmt;
ic->ic_recv_mgmt = rtw_recv_mgmt;
+#endif
mtbl->mt_node_free = ic->ic_node_free;
ic->ic_node_free = rtw_node_free;
-/* $OpenBSD: if_ipw.c,v 1.73 2008/07/21 18:43:18 damien Exp $ */
+/* $OpenBSD: if_ipw.c,v 1.74 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2004-2008
/* set device capabilities */
ic->ic_caps =
+#ifndef IEEE80211_STA_ONLY
IEEE80211_C_IBSS | /* IBSS mode supported */
+#endif
IEEE80211_C_MONITOR | /* monitor mode supported */
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
imr->ifm_active |= IFM_IEEE80211_IBSS;
break;
+#endif
case IEEE80211_M_MONITOR:
imr->ifm_active |= IFM_IEEE80211_MONITOR;
break;
- case IEEE80211_M_AHDEMO:
- case IEEE80211_M_HOSTAP:
+ default:
/* should not get there */
break;
}
case IEEE80211_M_STA:
name = "ipw-bss";
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
name = "ipw-ibss";
break;
+#endif
case IEEE80211_M_MONITOR:
name = "ipw-monitor";
break;
case IEEE80211_M_STA:
data = htole32(IPW_MODE_BSS);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
data = htole32(IPW_MODE_IBSS);
break;
+#endif
case IEEE80211_M_MONITOR:
data = htole32(IPW_MODE_MONITOR);
break;
if (error != 0)
return error;
- if (ic->ic_opmode == IEEE80211_M_IBSS ||
+ if (
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_opmode == IEEE80211_M_IBSS ||
+#endif
ic->ic_opmode == IEEE80211_M_MONITOR) {
data = htole32(ieee80211_chan2ieee(ic, ic->ic_ibss_chan));
DPRINTF(("Setting channel to %u\n", letoh32(data)));
config.flags = htole32(IPW_CFG_BSS_MASK | IPW_CFG_IBSS_MASK |
IPW_CFG_PREAMBLE_AUTO | IPW_CFG_802_1x_ENABLE);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS)
config.flags |= htole32(IPW_CFG_IBSS_AUTO_START);
+#endif
if (ifp->if_flags & IFF_PROMISC)
config.flags |= htole32(IPW_CFG_PROMISCUOUS);
config.bss_chan = htole32(0x3fff); /* channels 1-14 */
if (error != 0)
return error;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS) {
data = htole32(32); /* default value */
DPRINTF(("Setting tx power index to %u\n", letoh32(data)));
if (error != 0)
return error;
}
+#endif
data = htole32(ic->ic_rtsthreshold);
DPRINTF(("Setting RTS threshold to %u\n", letoh32(data)));
if (error != 0)
return error;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS ||
ic->ic_opmode == IEEE80211_M_HOSTAP) {
data = htole32(ic->ic_lintval);
if (error != 0)
return error;
}
+#endif
options.flags = htole32(0);
options.channels = htole32(0x3fff); /* scan channels 1-14 */
-/* $OpenBSD: if_iwi.c,v 1.87 2008/07/21 18:43:18 damien Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.88 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2004-2006
/* set device capabilities */
ic->ic_caps =
+#ifndef IEEE80211_STA_ONLY
IEEE80211_C_IBSS | /* IBSS mode supported */
+#endif
IEEE80211_C_MONITOR | /* monitor mode supported */
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
imr->ifm_active |= IFM_IEEE80211_ADHOC;
break;
+#endif
case IEEE80211_M_MONITOR:
imr->ifm_active |= IFM_IEEE80211_MONITOR;
break;
- case IEEE80211_M_AHDEMO:
- case IEEE80211_M_HOSTAP:
+ default:
/* should not get there */
break;
}
}
+#ifndef IEEE80211_STA_ONLY
/*
* This is only used for IBSS mode where the firmware expect an index to an
* internal node table instead of a destination address.
return i;
}
+#endif
int
iwi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
break;
case IEEE80211_S_RUN:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS) {
sc->nsta = 0; /* flush IBSS nodes */
ieee80211_new_state(ic, IEEE80211_S_AUTH, -1);
- } else if (ic->ic_opmode == IEEE80211_M_MONITOR)
+ } else
+#endif
+ if (ic->ic_opmode == IEEE80211_M_MONITOR)
iwi_set_chan(sc, ic->ic_ibss_chan);
/* assoc led on */
wh = mtod(m, struct ieee80211_frame *);
rxi.rxi_flags = 0;
- if ((wh->i_fc[1] & IEEE80211_FC1_WEP) &&
- ic->ic_opmode != IEEE80211_M_MONITOR) {
+ if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
/*
* Hardware decrypts the frame itself but leaves the WEP bit
* set in the 802.11 header and doesn't remove the IV and CRC
m_copydata(m0, 0, sizeof (struct ieee80211_frame), (caddr_t)&desc->wh);
m_adj(m0, sizeof (struct ieee80211_frame));
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS) {
station = iwi_find_txnode(sc, desc->wh.i_addr1);
if (station == -1) {
return 0;
}
}
+#endif
error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m0,
BUS_DMA_NOWAIT);
config.multicast_enabled = 1;
config.silence_threshold = 30;
config.report_noise = 1;
- config.answer_pbreq = (ic->ic_opmode == IEEE80211_M_IBSS) ? 1 : 0;
+ config.answer_pbreq =
+#ifndef IEEE80211_STA_ONLY
+ (ic->ic_opmode == IEEE80211_M_IBSS) ? 1 :
+#endif
+ 0;
DPRINTF(("Configuring adapter\n"));
error = iwi_cmd(sc, IWI_CMD_SET_CONFIG, &config, sizeof config, 0);
if (error != 0)
config.multicast_enabled = 1;
config.silence_threshold = 30;
config.report_noise = 1;
- config.answer_pbreq = (ic->ic_opmode == IEEE80211_M_IBSS) ? 1 : 0;
+ config.answer_pbreq =
+#ifndef IEEE80211_STA_ONLY
+ (ic->ic_opmode == IEEE80211_M_IBSS) ? 1 :
+#endif
+ 0;
if (ic->ic_curmode == IEEE80211_MODE_11G)
config.bg_autodetection = 1;
DPRINTF(("Configuring adapter\n"));
return error;
bzero(&assoc, sizeof assoc);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_flags & IEEE80211_F_SIBSS)
assoc.type = IWI_ASSOC_SIBSS;
else
+#endif
assoc.type = IWI_ASSOC_ASSOCIATE;
if (ic->ic_curmode == IEEE80211_MODE_11A)
assoc.mode = IWI_MODE_11A;
assoc.lintval = htole16(ic->ic_lintval);
assoc.intval = htole16(ni->ni_intval);
IEEE80211_ADDR_COPY(assoc.bssid, ni->ni_bssid);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS)
IEEE80211_ADDR_COPY(assoc.dst, etherbroadcastaddr);
else
+#endif
IEEE80211_ADDR_COPY(assoc.dst, ni->ni_bssid);
DPRINTF(("Trying to associate to %s channel %u auth %u\n",
switch (sc->sc_ic.ic_opmode) {
case IEEE80211_M_STA:
- case IEEE80211_M_HOSTAP:
name = "iwi-bss";
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
name = "iwi-ibss";
break;
+#endif
case IEEE80211_M_MONITOR:
name = "iwi-monitor";
break;
default:
- name = NULL; /* should not get there */
+ /* should not get there */
+ error = EINVAL;
+ goto fail1;
}
if ((error = loadfirmware(name, &data, &size)) != 0) {
-/* $OpenBSD: if_iwn.c,v 1.22 2008/07/31 20:14:17 damien Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.23 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2007,2008
sc->config.mode = IWN_MODE_STA;
sc->config.filter |= htole32(IWN_FILTER_MULTICAST);
break;
+#ifndef IEEE80211_STA_ONLY
+#ifdef notyet
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
sc->config.mode = IWN_MODE_IBSS;
case IEEE80211_M_HOSTAP:
sc->config.mode = IWN_MODE_HOSTAP;
break;
+#endif
+#endif
case IEEE80211_M_MONITOR:
sc->config.mode = IWN_MODE_MONITOR;
sc->config.filter |= htole32(IWN_FILTER_MULTICAST |
IWN_FILTER_CTL | IWN_FILTER_PROMISC);
break;
+ default:
+ /* should not get there */
+ break;
}
sc->config.cck_mask = 0x0f; /* not yet negotiated */
sc->config.ofdm_mask = 0xff; /* not yet negotiated */
-/* $OpenBSD: if_wpi.c,v 1.63 2008/07/31 20:14:17 damien Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.64 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2006, 2007
sc->config.mode = WPI_MODE_STA;
sc->config.filter |= htole32(WPI_FILTER_MULTICAST);
break;
+#ifndef IEEE80211_STA_ONLY
+#ifdef notyet
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
sc->config.mode = WPI_MODE_IBSS;
case IEEE80211_M_HOSTAP:
sc->config.mode = WPI_MODE_HOSTAP;
break;
+#endif
+#endif
case IEEE80211_M_MONITOR:
sc->config.mode = WPI_MODE_MONITOR;
sc->config.filter |= htole32(WPI_FILTER_MULTICAST |
WPI_FILTER_CTL | WPI_FILTER_PROMISC);
break;
+ default:
+ /* should not get there */
+ break;
}
sc->config.cck_mask = 0x0f; /* not yet negotiated */
sc->config.ofdm_mask = 0xff; /* not yet negotiated */
-/* $OpenBSD: if_ral.c,v 1.106 2008/08/14 16:02:24 damien Exp $ */
+/* $OpenBSD: if_ral.c,v 1.107 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2005, 2006
uint8_t ural_plcp_signal(int);
void ural_setup_tx_desc(struct ural_softc *, struct ural_tx_desc *,
uint32_t, int, int);
+#ifndef IEEE80211_STA_ONLY
int ural_tx_bcn(struct ural_softc *, struct mbuf *,
struct ieee80211_node *);
+#endif
int ural_tx_data(struct ural_softc *, struct mbuf *,
struct ieee80211_node *);
void ural_start(struct ifnet *);
/* set device capabilities */
ic->ic_caps =
- IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_MONITOR | /* monitor mode supported */
+#ifndef IEEE80211_STA_ONLY
+ IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_HOSTAP | /* HostAp mode supported */
+#endif
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT | /* short slot time supported */
struct ieee80211com *ic = &sc->sc_ic;
enum ieee80211_state ostate;
struct ieee80211_node *ni;
- struct mbuf *m;
ostate = ic->ic_state;
ural_set_bssid(sc, ni->ni_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS) {
- m = ieee80211_beacon_alloc(ic, ni);
+ struct mbuf *m = ieee80211_beacon_alloc(ic, ni);
if (m == NULL) {
printf("%s: could not allocate beacon\n",
sc->sc_dev.dv_xname);
/* beacon is no longer needed */
m_freem(m);
}
+#endif
/* make tx led blink on tx (controlled by ASIC) */
ural_write(sc, RAL_MAC_CSR20, 1);
#define RAL_TX_TIMEOUT 5000
+#ifndef IEEE80211_STA_ONLY
int
ural_tx_bcn(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
{
return error;
}
+#endif
int
ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
ic->ic_flags) + RAL_SIFS;
*(uint16_t *)wh->i_dur = htole16(dur);
+#ifndef IEEE80211_STA_ONLY
/* tell hardware to set timestamp in probe responses */
if ((wh->i_fc[0] &
(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
flags |= RAL_TX_TIMESTAMP;
+#endif
}
#if NBPFILTER > 0
tmp = (16 * ic->ic_bss->ni_intval) << 4;
ural_write(sc, RAL_TXRX_CSR18, tmp);
- logcwmin = (ic->ic_opmode == IEEE80211_M_IBSS) ? 2 : 0;
- preload = (ic->ic_opmode == IEEE80211_M_IBSS) ? 320 : 6;
+#ifndef IEEE80211_STA_ONLY
+ if (ic->ic_opmode == IEEE80211_M_IBSS) {
+ logcwmin = 2;
+ preload = 320;
+ } else
+#endif
+ {
+ logcwmin = 0;
+ preload = 6;
+ }
tmp = logcwmin << 12 | preload;
ural_write(sc, RAL_TXRX_CSR20, tmp);
tmp = RAL_ENABLE_TSF | RAL_ENABLE_TBCN;
if (ic->ic_opmode == IEEE80211_M_STA)
tmp |= RAL_ENABLE_TSF_SYNC(1);
+#ifndef IEEE80211_STA_ONLY
else
tmp |= RAL_ENABLE_TSF_SYNC(2) | RAL_ENABLE_BEACON_GENERATOR;
+#endif
ural_write(sc, RAL_TXRX_CSR19, tmp);
DPRINTF(("enabling TSF synchronization\n"));
tmp = RAL_DROP_PHY_ERROR | RAL_DROP_CRC_ERROR;
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
tmp |= RAL_DROP_CTL | RAL_DROP_VERSION_ERROR;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
tmp |= RAL_DROP_TODS;
if (!(ifp->if_flags & IFF_PROMISC))
tmp |= RAL_DROP_NOT_TO_ME;
-/* $OpenBSD: if_rum.c,v 1.77 2008/08/19 02:34:04 deraadt Exp $ */
+/* $OpenBSD: if_rum.c,v 1.78 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
int rum_init(struct ifnet *);
void rum_stop(struct ifnet *, int);
int rum_load_microcode(struct rum_softc *, const u_char *, size_t);
+#ifndef IEEE80211_STA_ONLY
int rum_prepare_beacon(struct rum_softc *);
+#endif
void rum_newassoc(struct ieee80211com *, struct ieee80211_node *,
int);
void rum_amrr_start(struct rum_softc *, struct ieee80211_node *);
/* set device capabilities */
ic->ic_caps =
- IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_MONITOR | /* monitor mode supported */
+#ifndef IEEE80211_STA_ONLY
+ IEEE80211_C_IBSS | /* IBSS mode supported */
IEEE80211_C_HOSTAP | /* HostAp mode supported */
+#endif
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT | /* short slot time supported */
rum_set_bssid(sc, ni->ni_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS)
rum_prepare_beacon(sc);
+#endif
if (ic->ic_opmode != IEEE80211_M_MONITOR)
rum_enable_tsf_sync(sc);
ic->ic_flags) + sc->sifs;
*(uint16_t *)wh->i_dur = htole16(dur);
+#ifndef IEEE80211_STA_ONLY
/* tell hardware to set timestamp in probe responses */
if ((wh->i_fc[0] &
(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
flags |= RT2573_TX_TIMESTAMP;
+#endif
}
#if NBPFILTER > 0
struct ieee80211com *ic = &sc->sc_ic;
uint32_t tmp;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_STA) {
/*
* Change default 16ms TBTT adjustment to 8ms.
*/
rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8);
}
+#endif
tmp = rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000;
tmp |= RT2573_TSF_TICKING | RT2573_ENABLE_TBTT;
if (ic->ic_opmode == IEEE80211_M_STA)
tmp |= RT2573_TSF_MODE(1);
+#ifndef IEEE80211_STA_ONLY
else
tmp |= RT2573_TSF_MODE(2) | RT2573_GENERATE_BEACON;
-
+#endif
rum_write(sc, RT2573_TXRX_CSR9, tmp);
}
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
tmp |= RT2573_DROP_CTL | RT2573_DROP_VER_ERROR |
RT2573_DROP_ACKCTS;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
tmp |= RT2573_DROP_TODS;
if (!(ifp->if_flags & IFF_PROMISC))
tmp |= RT2573_DROP_NOT_TO_ME;
return error;
}
+#ifndef IEEE80211_STA_ONLY
int
rum_prepare_beacon(struct rum_softc *sc)
{
return 0;
}
+#endif
void
rum_newassoc(struct ieee80211com *ic, struct ieee80211_node *ni, int isnew)
-/* $OpenBSD: if_zyd.c,v 1.69 2008/07/21 18:43:19 damien Exp $ */
+/* $OpenBSD: if_zyd.c,v 1.70 2008/08/27 09:05:03 damien Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
case IEEE80211_M_STA:
rxfilter = ZYD_FILTER_BSS;
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
case IEEE80211_M_HOSTAP:
rxfilter = ZYD_FILTER_HOSTAP;
break;
+#endif
case IEEE80211_M_MONITOR:
rxfilter = ZYD_FILTER_MONITOR;
break;
-/* $OpenBSD: ieee80211.c,v 1.33 2008/07/27 14:21:15 damien Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.34 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
continue;
mopt = mopts[mode];
ADD(ic, IFM_AUTO, mopt); /* e.g. 11a auto */
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_caps & IEEE80211_C_IBSS)
ADD(ic, IFM_AUTO, mopt | IFM_IEEE80211_IBSS);
if (ic->ic_caps & IEEE80211_C_HOSTAP)
ADD(ic, IFM_AUTO, mopt | IFM_IEEE80211_HOSTAP);
if (ic->ic_caps & IEEE80211_C_AHDEMO)
ADD(ic, IFM_AUTO, mopt | IFM_IEEE80211_ADHOC);
+#endif
if (ic->ic_caps & IEEE80211_C_MONITOR)
ADD(ic, IFM_AUTO, mopt | IFM_IEEE80211_MONITOR);
if (mode == IEEE80211_MODE_AUTO)
if (mword == 0)
continue;
ADD(ic, mword, mopt);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_caps & IEEE80211_C_IBSS)
ADD(ic, mword, mopt | IFM_IEEE80211_IBSS);
if (ic->ic_caps & IEEE80211_C_HOSTAP)
ADD(ic, mword, mopt | IFM_IEEE80211_HOSTAP);
if (ic->ic_caps & IEEE80211_C_AHDEMO)
ADD(ic, mword, mopt | IFM_IEEE80211_ADHOC);
+#endif
if (ic->ic_caps & IEEE80211_C_MONITOR)
ADD(ic, mword, mopt | IFM_IEEE80211_MONITOR);
/*
continue;
mword = IFM_SUBTYPE(mword); /* remove media options */
ADD(ic, mword, 0);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_caps & IEEE80211_C_IBSS)
ADD(ic, mword, IFM_IEEE80211_IBSS);
if (ic->ic_caps & IEEE80211_C_HOSTAP)
ADD(ic, mword, IFM_IEEE80211_HOSTAP);
if (ic->ic_caps & IEEE80211_C_AHDEMO)
ADD(ic, mword, IFM_IEEE80211_ADHOC);
+#endif
if (ic->ic_caps & IEEE80211_C_MONITOR)
ADD(ic, mword, IFM_IEEE80211_MONITOR);
}
/*
* Deduce new operating mode but don't install it just yet.
*/
+#ifndef IEEE80211_STA_ONLY
if (ime->ifm_media & IFM_IEEE80211_ADHOC)
newopmode = IEEE80211_M_AHDEMO;
else if (ime->ifm_media & IFM_IEEE80211_HOSTAP)
newopmode = IEEE80211_M_HOSTAP;
else if (ime->ifm_media & IFM_IEEE80211_IBSS)
newopmode = IEEE80211_M_IBSS;
- else if (ime->ifm_media & IFM_IEEE80211_MONITOR)
+ else
+#endif
+ if (ime->ifm_media & IFM_IEEE80211_MONITOR)
newopmode = IEEE80211_M_MONITOR;
else
newopmode = IEEE80211_M_STA;
+#ifndef IEEE80211_STA_ONLY
/*
* Autoselect doesn't make sense when operating as an AP.
* If no phy mode has been selected, pick one and lock it
break;
}
}
+#endif
/*
* Handle phy mode change.
*/
if (ic->ic_opmode != newopmode) {
ic->ic_opmode = newopmode;
+#ifndef IEEE80211_STA_ONLY
switch (newopmode) {
case IEEE80211_M_AHDEMO:
case IEEE80211_M_HOSTAP:
ic->ic_flags |= IEEE80211_F_IBSSON;
break;
}
+#endif
/*
* Yech, slot time may change depending on the
* operating mode so reset it to be sure everything
imr->ifm_active |= ieee80211_rate2media(ic,
ni->ni_rates.rs_rates[ni->ni_txrate], ic->ic_curmode);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
imr->ifm_active |= IFM_IEEE80211_IBSS;
break;
case IEEE80211_M_HOSTAP:
imr->ifm_active |= IFM_IEEE80211_HOSTAP;
break;
+#endif
case IEEE80211_M_MONITOR:
imr->ifm_active |= IFM_IEEE80211_MONITOR;
break;
+ default:
+ break;
}
switch (ic->ic_curmode) {
case IEEE80211_MODE_11A:
-/* $OpenBSD: ieee80211_crypto.c,v 1.54 2008/08/14 16:14:53 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto.c,v 1.55 2008/08/27 09:05:04 damien Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
return memcmp(key->mic, mic, EAPOL_KEY_MIC_LEN) != 0;
}
+#ifndef IEEE80211_STA_ONLY
/*
* Encrypt the Key Data field of an EAPOL-Key frame using the specified Key
* Encryption Key (KEK). The encryption algorithm can be either ARC4 or
break;
}
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Decrypt the Key Data field of an EAPOL-Key frame using the specified Key
-/* $OpenBSD: ieee80211_crypto.h,v 1.19 2008/08/12 19:29:07 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto.h,v 1.20 2008/08/27 09:05:04 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
const u_int8_t *);
int ieee80211_eapol_key_check_mic(struct ieee80211_eapol_key *,
const u_int8_t *);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_eapol_key_encrypt(struct ieee80211com *,
struct ieee80211_eapol_key *, const u_int8_t *);
+#endif
int ieee80211_eapol_key_decrypt(struct ieee80211_eapol_key *,
const u_int8_t *);
-/* $OpenBSD: ieee80211_crypto_tkip.c,v 1.7 2008/08/12 16:45:44 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto_tkip.c,v 1.8 2008/08/27 09:05:04 damien Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
* Use bits 128-191 as the Michael key for AA->SPA and bits
* 192-255 as the Michael key for SPA->AA.
*/
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
ctx->txmic = &k->k_key[16];
ctx->rxmic = &k->k_key[24];
- } else {
+ } else
+#endif
+ {
ctx->rxmic = &k->k_key[16];
ctx->txmic = &k->k_key[24];
}
return NULL;
}
+#ifndef IEEE80211_STA_ONLY
/*
* This function is called in HostAP mode to deauthenticate all STAs using
* TKIP as their pairwise or group cipher (as part of TKIP countermeasures).
ieee80211_node_leave(ic, ni);
}
}
+#endif /* IEEE80211_STA_ONLY */
/*
* This function can be called by the software TKIP crypto code or by the
}
ic->ic_tkip_micfail = ticks;
- if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
+ switch (ic->ic_opmode) {
+#ifndef IEEE80211_STA_ONLY
+ case IEEE80211_M_HOSTAP:
/* refuse new TKIP associations for the next 60 seconds */
ic->ic_flags |= IEEE80211_F_COUNTERM;
/* deauthenticate all currently associated STAs using TKIP */
ieee80211_iterate_nodes(ic, ieee80211_tkip_deauth, ic);
-
- } else if (ic->ic_opmode == IEEE80211_M_STA) {
+ break;
+#endif
+ case IEEE80211_M_STA:
/* deauthenticate from the AP.. */
IEEE80211_SEND_MGMT(ic, ic->ic_bss,
IEEE80211_FC0_SUBTYPE_DEAUTH,
IEEE80211_REASON_MIC_FAILURE);
/* ..and find another one */
(void)ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
+ break;
+ default:
+ break;
}
}
-/* $OpenBSD: ieee80211_input.c,v 1.100 2008/08/14 16:07:58 damien Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.101 2008/08/27 09:05:04 damien Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
int ieee80211_parse_rsn_body(struct ieee80211com *, const u_int8_t *,
u_int, struct ieee80211_rsnparams *);
int ieee80211_save_ie(const u_int8_t *, u_int8_t **);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_recv_pspoll(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *);
+#endif
void ieee80211_recv_probe_resp(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *, int);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_recv_probe_req(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *);
+#endif
void ieee80211_recv_auth(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_recv_assoc_req(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, struct ieee80211_rxinfo *, int);
+#endif
void ieee80211_recv_assoc_resp(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, int);
void ieee80211_recv_deauth(struct ieee80211com *, struct mbuf *,
ni->ni_inact = 0;
}
+#ifndef IEEE80211_STA_ONLY
if ((ic->ic_caps & IEEE80211_C_PMGT) &&
ic->ic_opmode == IEEE80211_M_HOSTAP &&
ni->ni_state == IEEE80211_STA_ASSOC) {
}
}
}
-
+#endif
switch (type) {
case IEEE80211_FC0_TYPE_DATA:
switch (ic->ic_opmode) {
goto out;
}
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
if (dir != IEEE80211_FC1_DIR_NODS) {
goto err;
}
break;
- case IEEE80211_M_MONITOR:
+#endif /* IEEE80211_STA_ONLY */
+ default:
/* can't get there */
goto out;
}
ic->ic_stats.is_rx_wrongdir++;
goto err;
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_AHDEMO) {
ic->ic_stats.is_rx_ahdemo_mgt++;
goto out;
}
+#endif
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
/* drop frames without interest */
if (ic->ic_state == IEEE80211_S_SCAN)
doprint = 1;
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
if (ic->ic_opmode == IEEE80211_M_IBSS)
doprint = 1;
break;
+#endif
default:
doprint = 1;
break;
ic->ic_stats.is_rx_ctl++;
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
switch (subtype) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_FC0_SUBTYPE_PS_POLL:
ieee80211_recv_pspoll(ic, m, ni);
break;
+#endif
case IEEE80211_FC0_SUBTYPE_BAR:
/* NYI */
break;
struct ieee80211_node *ni)
{
struct ifnet *ifp = &ic->ic_if;
- struct ieee80211_node *ni1;
struct ether_header *eh;
struct mbuf *m1;
- int error, len;
eh = mtod(m, struct ether_header *);
* bridge EAPOL frames as suggested in C.1.1 of IEEE Std 802.1X.
*/
m1 = NULL;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
!(ic->ic_flags & IEEE80211_F_NOBRIDGE) &&
eh->ether_type != htons(ETHERTYPE_PAE)) {
+ struct ieee80211_node *ni1;
+ int error, len;
+
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
m1 = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
if (m1 == NULL)
}
}
}
+#endif
if (m != NULL) {
#if NBPFILTER > 0
/*
*/
#ifdef DIAGNOSTIC
if (ic->ic_opmode != IEEE80211_M_STA &&
+#ifndef IEEE80211_STA_ONLY
ic->ic_opmode != IEEE80211_M_IBSS &&
ic->ic_opmode != IEEE80211_M_HOSTAP &&
+#endif
ic->ic_state != IEEE80211_S_SCAN) {
panic("%s: impossible operating mode", __func__);
}
DPRINTF(("invalid SSID element\n"));
return;
}
+
if (
#if IEEE80211_CHAN_MAX < 255
chan > IEEE80211_CHAN_MAX ||
}
if (ic->ic_state == IEEE80211_S_SCAN &&
+#ifndef IEEE80211_STA_ONLY
ic->ic_opmode != IEEE80211_M_HOSTAP &&
+#endif
(ic->ic_flags & IEEE80211_F_RSNON)) {
struct ieee80211_rsnparams rsn;
const u_int8_t *saveie = NULL;
* Anything else can be discarded (XXX and should be handled
* above so we don't do so much work).
*/
- if (ic->ic_opmode == IEEE80211_M_IBSS || (is_new && isprobe)) {
+ if (
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_opmode == IEEE80211_M_IBSS ||
+#endif
+ (is_new && isprobe)) {
/*
* Fake an association so the driver can setup it's
* private state. The rate set has been setup above;
}
}
+#ifndef IEEE80211_STA_ONLY
/*-
* Probe request frame format:
* [tlv] SSID
}
IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
}
+#endif /* IEEE80211_STA_ONLY */
/*-
* Authentication frame format:
DPRINTF(("unsupported auth algorithm %d from %s\n",
algo, ether_sprintf((u_int8_t *)wh->i_addr2)));
ic->ic_stats.is_rx_auth_unsupported++;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/* XXX hack to workaround calling convention */
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_AUTH,
(seq+1) | (IEEE80211_STATUS_ALG<<16));
}
+#endif
return;
}
ieee80211_auth_open(ic, wh, ni, rxi, seq, status);
}
+#ifndef IEEE80211_STA_ONLY
/*-
* (Re)Association request frame format:
* [2] Capability information
} else
ieee80211_node_join(ic, ni, resp);
}
+#endif /* IEEE80211_STA_ONLY */
/*-
* (Re)Association response frame format:
ieee80211_recv_deauth(struct ieee80211com *ic, struct mbuf *m0,
struct ieee80211_node *ni)
{
- struct ifnet *ifp = &ic->ic_if;
const struct ieee80211_frame *wh;
const u_int8_t *frm;
u_int16_t reason;
ieee80211_new_state(ic, IEEE80211_S_AUTH,
IEEE80211_FC0_SUBTYPE_DEAUTH);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
if (ni != ic->ic_bss) {
- if (ifp->if_flags & IFF_DEBUG)
+ if (ic->ic_if.if_flags & IFF_DEBUG)
printf("%s: station %s deauthenticated "
"by peer (reason %d)\n",
- ifp->if_xname,
+ ic->ic_if.if_xname,
ether_sprintf(ni->ni_macaddr),
reason);
ieee80211_node_leave(ic, ni);
}
break;
+#endif
default:
break;
}
ieee80211_recv_disassoc(struct ieee80211com *ic, struct mbuf *m0,
struct ieee80211_node *ni)
{
- struct ifnet *ifp = &ic->ic_if;
const struct ieee80211_frame *wh;
const u_int8_t *frm;
u_int16_t reason;
ieee80211_new_state(ic, IEEE80211_S_ASSOC,
IEEE80211_FC0_SUBTYPE_DISASSOC);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
if (ni != ic->ic_bss) {
- if (ifp->if_flags & IFF_DEBUG)
+ if (ic->ic_if.if_flags & IFF_DEBUG)
printf("%s: station %s disassociated "
"by peer (reason %d)\n",
- ifp->if_xname,
+ ic->ic_if.if_xname,
ether_sprintf(ni->ni_macaddr),
reason);
ieee80211_node_leave(ic, ni);
}
break;
+#endif
default:
break;
}
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
ieee80211_recv_probe_resp(ic, m0, ni, rxi, 1);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
ieee80211_recv_probe_req(ic, m0, ni, rxi);
break;
+#endif
case IEEE80211_FC0_SUBTYPE_AUTH:
ieee80211_recv_auth(ic, m0, ni, rxi);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
ieee80211_recv_assoc_req(ic, m0, ni, rxi, 0);
break;
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
ieee80211_recv_assoc_req(ic, m0, ni, rxi, 1);
break;
+#endif
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
ieee80211_recv_assoc_resp(ic, m0, ni, 0);
break;
}
}
+#ifndef IEEE80211_STA_ONLY
/*
* Process an incoming PS-Poll control frame (see 11.2).
*/
IF_ENQUEUE(&ic->ic_pwrsaveq, m);
(*ifp->if_start)(ifp);
}
+#endif /* IEEE80211_STA_ONLY */
-/* $OpenBSD: ieee80211_ioctl.c,v 1.22 2008/08/12 19:29:07 damien Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.23 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
ic->ic_flags |= IEEE80211_F_DESBSSID;
IEEE80211_ADDR_COPY(ic->ic_des_bssid, bssid->i_bssid);
}
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
break;
+#endif
switch (ic->ic_state) {
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
switch (ic->ic_state) {
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
IEEE80211_ADDR_COPY(bssid->i_bssid,
ic->ic_myaddr);
- else if (ic->ic_flags & IEEE80211_F_DESBSSID)
+ else
+#endif
+ if (ic->ic_flags & IEEE80211_F_DESBSSID)
IEEE80211_ADDR_COPY(bssid->i_bssid,
ic->ic_des_bssid);
else
case SIOCS80211SCAN:
if ((error = suser(curproc, 0)) != 0)
break;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
break;
+#endif
if ((ifp->if_flags & IFF_UP) == 0) {
error = ENETDOWN;
break;
case SIOCS80211NODE:
if ((error = suser(curproc, 0)) != 0)
break;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
error = EINVAL;
break;
}
+#endif
nr = (struct ieee80211_nodereq *)data;
ni = ieee80211_find_node(ic, nr->nr_macaddr);
break;
case SIOCG80211FLAGS:
flags = ic->ic_flags;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
flags &= ~IEEE80211_F_HOSTAPMASK;
ifr->ifr_flags = flags >> IEEE80211_F_USERSHIFT;
break;
if ((error = suser(curproc, 0)) != 0)
break;
flags = (u_int32_t)ifr->ifr_flags << IEEE80211_F_USERSHIFT;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
(flags & IEEE80211_F_HOSTAPMASK)) {
error = EINVAL;
break;
}
+#endif
ic->ic_flags = (ic->ic_flags & ~IEEE80211_F_USERMASK) | flags;
error = ENETRESET;
break;
-/* $OpenBSD: ieee80211_node.c,v 1.43 2008/08/12 19:29:07 damien Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.44 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
void ieee80211_free_node(struct ieee80211com *, struct ieee80211_node *);
struct ieee80211_node *ieee80211_alloc_node_helper(struct ieee80211com *);
void ieee80211_node_cleanup(struct ieee80211com *, struct ieee80211_node *);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_node_join_rsn(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_node_join_11g(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_node_leave_rsn(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_node_leave_11g(struct ieee80211com *, struct ieee80211_node *);
void ieee80211_set_tim(struct ieee80211com *, int, int);
+#endif
#define M_80211_NODE M_DEVBUF
ieee80211_node_attach(struct ifnet *ifp)
{
struct ieee80211com *ic = (void *)ifp;
+#ifndef IEEE80211_STA_ONLY
int size;
+#endif
RB_INIT(&ic->ic_tree);
ic->ic_node_alloc = ieee80211_node_alloc;
ic->ic_max_aid = IEEE80211_AID_DEF;
else if (ic->ic_max_aid > IEEE80211_AID_MAX)
ic->ic_max_aid = IEEE80211_AID_MAX;
+#ifndef IEEE80211_STA_ONLY
size = howmany(ic->ic_max_aid, 32) * sizeof(u_int32_t);
ic->ic_aid_bitmap = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO);
if (ic->ic_aid_bitmap == NULL) {
timeout_set(&ic->ic_rsn_timeout,
ieee80211_gtk_rekey_timeout, ic);
}
+#endif
}
struct ieee80211_node *
* In all but hostap mode scanning starts off in
* an active mode before switching to passive.
*/
- if (ic->ic_opmode != IEEE80211_M_HOSTAP) {
+#ifndef IEEE80211_STA_ONLY
+ if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+#endif
+ {
ic->ic_flags |= IEEE80211_F_ASCAN;
ic->ic_stats.is_scan_active++;
- } else
+ }
+#ifndef IEEE80211_STA_ONLY
+ else
ic->ic_stats.is_scan_passive++;
+#endif
if (ifp->if_flags & IFF_DEBUG)
printf("%s: begin %s scan\n", ifp->if_xname,
(ic->ic_flags & IEEE80211_F_ASCAN) ?
ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
}
+#ifndef IEEE80211_STA_ONLY
void
ieee80211_create_ibss(struct ieee80211com* ic, struct ieee80211_channel *chan)
{
}
ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
}
+#endif /* IEEE80211_STA_ONLY */
int
ieee80211_match_bss(struct ieee80211com *ic, struct ieee80211_node *ni)
if (ic->ic_des_chan != IEEE80211_CHAN_ANYC &&
ni->ni_chan != ic->ic_des_chan)
fail |= 0x01;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS) {
if ((ni->ni_capinfo & IEEE80211_CAPINFO_IBSS) == 0)
fail |= 0x02;
- } else {
+ } else
+#endif
+ {
if ((ni->ni_capinfo & IEEE80211_CAPINFO_ESS) == 0)
fail |= 0x02;
}
{
struct ieee80211com *ic = (void *)ifp;
struct ieee80211_node *ni, *nextbs, *selbs;
- int i, fail;
if (ifp->if_flags & IFF_DEBUG)
printf("%s: end %s scan\n", ifp->if_xname,
ni = RB_MIN(ieee80211_tree, &ic->ic_tree);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/* XXX off stack? */
u_char occupied[howmany(IEEE80211_CHAN_MAX, NBBY)];
+ int i, fail;
+
/*
* The passive scan to look for existing AP's completed,
* select a channel to camp on. Identify the channels
ieee80211_create_ibss(ic, &ic->ic_channels[i]);
goto wakeup;
}
+#endif
if (ni == NULL) {
DPRINTF(("no scan candidate\n"));
notfound:
+
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS &&
(ic->ic_flags & IEEE80211_F_IBSSON) &&
ic->ic_des_esslen != 0) {
ieee80211_create_ibss(ic, ic->ic_ibss_chan);
goto wakeup;
}
-
+#endif
/*
* Scan the next mode if nothing has been found. This
* is necessary if the device supports different
ni->ni_rsncipher = IEEE80211_CIPHER_USEGROUP;
ieee80211_node_newstate(selbs, IEEE80211_STA_BSS);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS) {
ieee80211_fix_rate(ic, ni, IEEE80211_F_DOFRATE |
IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
if (ni->ni_rates.rs_nrates == 0)
goto notfound;
ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
- } else {
+ } else
+#endif
ieee80211_new_state(ic, IEEE80211_S_AUTH, -1);
- }
wakeup:
if (ic->ic_scan_lock & IEEE80211_SCAN_REQUEST) {
struct ieee80211_node *
ieee80211_find_txnode(struct ieee80211com *ic, const u_int8_t *macaddr)
{
+#ifndef IEEE80211_STA_ONLY
struct ieee80211_node *ni;
int s;
+#endif
/*
* The destination address should be in the node table
if (ic->ic_opmode == IEEE80211_M_STA || IEEE80211_IS_MULTICAST(macaddr))
return ieee80211_ref_node(ic->ic_bss);
+#ifndef IEEE80211_STA_ONLY
s = splnet();
ni = ieee80211_find_node(ic, macaddr);
splx(s);
(*ic->ic_newassoc)(ic, ni, 1);
}
return ieee80211_ref_node(ni);
+#else
+ return NULL; /* can't get there */
+#endif /* IEEE80211_STA_ONLY */
}
/*
ieee80211_needs_rxnode(struct ieee80211com *ic,
const struct ieee80211_frame *wh, const u_int8_t **bssid)
{
- struct ieee80211_node *bss = ic->ic_bss;
int monitor, rc = 0;
monitor = (ic->ic_opmode == IEEE80211_M_MONITOR);
rc = 1;
break;
default:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_STA)
break;
- rc = IEEE80211_ADDR_EQ(*bssid, bss->ni_bssid) ||
+ rc = IEEE80211_ADDR_EQ(*bssid, ic->ic_bss->ni_bssid) ||
IEEE80211_ADDR_EQ(*bssid, etherbroadcastaddr);
+#endif
break;
}
break;
switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) {
case IEEE80211_FC1_DIR_NODS:
*bssid = wh->i_addr3;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS ||
ic->ic_opmode == IEEE80211_M_AHDEMO)
- rc = IEEE80211_ADDR_EQ(*bssid, bss->ni_bssid);
+ rc = IEEE80211_ADDR_EQ(*bssid,
+ ic->ic_bss->ni_bssid);
+#endif
break;
case IEEE80211_FC1_DIR_TODS:
*bssid = wh->i_addr1;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
- rc = IEEE80211_ADDR_EQ(*bssid, bss->ni_bssid);
+ rc = IEEE80211_ADDR_EQ(*bssid,
+ ic->ic_bss->ni_bssid);
+#endif
break;
case IEEE80211_FC1_DIR_FROMDS:
case IEEE80211_FC1_DIR_DSTODS:
*bssid = wh->i_addr2;
+#ifndef IEEE80211_STA_ONLY
rc = (ic->ic_opmode == IEEE80211_M_HOSTAP);
+#endif
break;
}
break;
if (ni != NULL)
return ieee80211_ref_node(ni);
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
return ieee80211_ref_node(ic->ic_bss);
-
+#endif
/* XXX see remarks in ieee80211_find_txnode */
/* XXX no rate negotiation; just dup */
if ((ni = ieee80211_dup_bss(ic, wh->i_addr2)) == NULL)
/*
* Send a deauthenticate frame.
*/
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
splx(s);
IEEE80211_SEND_MGMT(ic, ni,
s = splnet();
ieee80211_node_leave(ic, ni);
} else
+#endif
ieee80211_free_node(ic, ni);
ic->ic_stats.is_node_timeout++;
}
return ieee80211_fix_rate(ic, ni, flags);
}
+#ifndef IEEE80211_STA_ONLY
/*
* Check if the specified node supports ERP.
*/
else
clrbit(ic->ic_tim_bitmap, aid & ~0xc000);
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Compare nodes in the tree by lladdr
-/* $OpenBSD: ieee80211_output.c,v 1.71 2008/08/15 08:15:27 damien Exp $ */
+/* $OpenBSD: ieee80211_output.c,v 1.72 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
struct mbuf *ieee80211_getmgmt(int, int, u_int);
struct mbuf *ieee80211_get_probe_req(struct ieee80211com *,
struct ieee80211_node *);
+#ifndef IEEE80211_STA_ONLY
struct mbuf *ieee80211_get_probe_resp(struct ieee80211com *,
struct ieee80211_node *);
+#endif
struct mbuf *ieee80211_get_auth(struct ieee80211com *,
struct ieee80211_node *, u_int16_t, u_int16_t);
struct mbuf *ieee80211_get_deauth(struct ieee80211com *,
struct ieee80211_node *, u_int16_t);
struct mbuf *ieee80211_get_assoc_req(struct ieee80211com *,
struct ieee80211_node *, int);
+#ifndef IEEE80211_STA_ONLY
struct mbuf *ieee80211_get_assoc_resp(struct ieee80211com *,
struct ieee80211_node *, u_int16_t);
+#endif
struct mbuf *ieee80211_get_disassoc(struct ieee80211com *,
struct ieee80211_node *, u_int16_t);
if (ifp->if_flags & IFF_DEBUG) {
/* avoid to print too many frames */
- if (ic->ic_opmode == IEEE80211_M_IBSS ||
+ if (
+#ifndef IEEE80211_STA_ONLY
+ ic->ic_opmode == IEEE80211_M_IBSS ||
+#endif
#ifdef IEEE80211_DEBUG
ieee80211_debug > 1 ||
#endif
}
};
+#ifndef IEEE80211_STA_ONLY
static const struct ieee80211_edca_ac_params
ieee80211_qap_edca_table[IEEE80211_MODE_MAX][EDCA_NUM_AC] = {
[IEEE80211_MODE_FH] = {
[EDCA_AC_VO] = { 2, 2, 1, 47 }
}
};
+#endif /* IEEE80211_STA_ONLY */
/*
* Return the EDCA Access Category to be used for transmitting a frame with
ac = (up <= 7) ? up_to_ac[up] : EDCA_AC_BE;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
return ac;
-
+#endif
/*
* We do not support the admission control procedure defined in
* IEEE Std 802.11e-2005 section 9.9.3.1.2. The spec says that
IEEE80211_ADDR_COPY(wh->i_addr2, eh.ether_shost);
IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
IEEE80211_ADDR_COPY(wh->i_addr2, ni->ni_bssid);
IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost);
break;
- case IEEE80211_M_MONITOR:
+#endif
+ default:
+ /* should not get there */
goto bad;
}
{
u_int16_t capinfo;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_IBSS)
capinfo = IEEE80211_CAPINFO_IBSS;
else if (ic->ic_opmode == IEEE80211_M_HOSTAP)
capinfo = IEEE80211_CAPINFO_ESS;
else
+#endif
capinfo = 0;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
(ic->ic_flags & (IEEE80211_F_WEPON | IEEE80211_F_RSNON)))
capinfo |= IEEE80211_CAPINFO_PRIVACY;
+#endif
/* NB: some 11a AP's reject the request when short preamble is set */
if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
IEEE80211_IS_CHAN_2GHZ(ni->ni_chan))
return frm + nrates;
}
+#ifndef IEEE80211_STA_ONLY
/*
* Add a FH Parameter Set element to a frame (see 7.3.2.3).
*/
*frm++ = erp;
return frm;
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Add a QoS Capability element to a frame (see 7.3.2.35).
return m;
}
+#ifndef IEEE80211_STA_ONLY
/*-
* Probe response frame format:
* [8] Timestamp
return m;
}
+#endif /* IEEE80211_STA_ONLY */
/*-
* Authentication frame format:
return m;
}
+#ifndef IEEE80211_STA_ONLY
/*-
* (Re)Association response frame format:
* [2] Capability information
return m;
}
+#endif /* IEEE80211_STA_ONLY */
/*-
* Disassociation frame format:
timer = IEEE80211_TRANS_WAIT;
break;
-
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
if ((m = ieee80211_get_probe_resp(ic, ni)) == NULL)
senderr(ENOMEM, is_tx_nombuf);
break;
-
+#endif
case IEEE80211_FC0_SUBTYPE_AUTH:
m = ieee80211_get_auth(ic, ni, arg >> 16, arg & 0xffff);
if (m == NULL)
timer = IEEE80211_TRANS_WAIT;
break;
-
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
if ((m = ieee80211_get_assoc_resp(ic, ni, arg)) == NULL)
senderr(ENOMEM, is_tx_nombuf);
break;
-
+#endif
case IEEE80211_FC0_SUBTYPE_DISASSOC:
if ((m = ieee80211_get_disassoc(ic, ni, arg)) == NULL)
senderr(ENOMEM, is_tx_nombuf);
return m;
}
+#ifndef IEEE80211_STA_ONLY
/*-
* Beacon frame format:
* [8] Timestamp
m->m_pkthdr.rcvif = (void *)ni;
}
}
+#endif /* IEEE80211_STA_ONLY */
-/* $OpenBSD: ieee80211_pae_input.c,v 1.11 2008/08/13 17:38:02 damien Exp $ */
+/* $OpenBSD: ieee80211_pae_input.c,v 1.12 2008/08/27 09:05:04 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
void ieee80211_recv_4way_msg1(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_recv_4way_msg2(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *,
const u_int8_t *);
+#endif
void ieee80211_recv_4way_msg3(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_recv_4way_msg4(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
void ieee80211_recv_4way_msg2or4(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
+#endif
void ieee80211_recv_rsn_group_msg1(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
void ieee80211_recv_wpa_group_msg1(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
+#ifndef IEEE80211_STA_ONLY
void ieee80211_recv_group_msg2(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
void ieee80211_recv_eapol_key_req(struct ieee80211com *,
struct ieee80211_eapol_key *, struct ieee80211_node *);
+#endif
/*
* Process an incoming EAPOL frame. Notice that we are only interested in
/* determine message type (see 8.5.3.7) */
if (info & EAPOL_KEY_REQUEST) {
+#ifndef IEEE80211_STA_ONLY
/* EAPOL-Key Request frame */
ieee80211_recv_eapol_key_req(ic, key, ni);
-
+#endif
} else if (info & EAPOL_KEY_PAIRWISE) {
/* 4-Way Handshake */
if (info & EAPOL_KEY_KEYMIC) {
if (info & EAPOL_KEY_KEYACK)
ieee80211_recv_4way_msg3(ic, key, ni);
+#ifndef IEEE80211_STA_ONLY
else
ieee80211_recv_4way_msg2or4(ic, key, ni);
+#endif
} else if (info & EAPOL_KEY_KEYACK)
ieee80211_recv_4way_msg1(ic, key, ni);
} else {
ieee80211_recv_wpa_group_msg1(ic, key, ni);
else
ieee80211_recv_rsn_group_msg1(ic, key, ni);
- } else
+ }
+#ifndef IEEE80211_STA_ONLY
+ else
ieee80211_recv_group_msg2(ic, key, ni);
+#endif
}
done:
if (m0 != NULL)
const u_int8_t *pmkid;
const u_int8_t *pmk;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_STA &&
ic->ic_opmode != IEEE80211_M_IBSS)
return;
-
+#endif
if (ni->ni_replaycnt_ok &&
BE_READ_8(key->replaycnt) <= ni->ni_replaycnt) {
ic->ic_stats.is_rx_eapol_replay++;
(void)ieee80211_send_4way_msg2(ic, ni, key->replaycnt, &tptk);
}
+#ifndef IEEE80211_STA_ONLY
/*
* Process Message 2 of the 4-Way Handshake (sent by Supplicant).
*/
/* send message 3 to supplicant */
(void)ieee80211_send_4way_msg3(ic, ni);
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Process Message 3 of the 4-Way Handshake (sent by Authenticator).
u_int16_t info, reason = 0;
int keylen;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_STA &&
ic->ic_opmode != IEEE80211_M_IBSS)
return;
-
+#endif
if (ni->ni_replaycnt_ok &&
BE_READ_8(key->replaycnt) <= ni->ni_replaycnt) {
ic->ic_stats.is_rx_eapol_replay++;
if (info & EAPOL_KEY_SECURE) {
ni->ni_flags |= IEEE80211_NODE_TXRXPROT;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_IBSS ||
- ++ni->ni_key_count == 2) {
+ ++ni->ni_key_count == 2)
+#endif
+ {
DPRINTF(("marking port %s valid\n",
ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
}
}
+#ifndef IEEE80211_STA_ONLY
/*
* Process Message 4 of the 4-Way Handshake (sent by Supplicant).
*/
else
ieee80211_recv_4way_msg4(ic, key, ni);
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Process Message 1 of the RSN Group Key Handshake (sent by Authenticator).
u_int16_t info, kid, reason = 0;
int keylen;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_STA &&
ic->ic_opmode != IEEE80211_M_IBSS)
return;
-
+#endif
if (BE_READ_8(key->replaycnt) <= ni->ni_replaycnt) {
ic->ic_stats.is_rx_eapol_replay++;
return;
}
}
if (info & EAPOL_KEY_SECURE) {
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_IBSS ||
- ++ni->ni_key_count == 2) {
+ ++ni->ni_key_count == 2)
+#endif
+ {
DPRINTF(("marking port %s valid\n",
ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
u_int8_t kid;
int keylen;
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_STA &&
ic->ic_opmode != IEEE80211_M_IBSS)
return;
-
+#endif
if (BE_READ_8(key->replaycnt) <= ni->ni_replaycnt) {
ic->ic_stats.is_rx_eapol_replay++;
return;
return;
}
if (info & EAPOL_KEY_SECURE) {
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode != IEEE80211_M_IBSS ||
- ++ni->ni_key_count == 2) {
+ ++ni->ni_key_count == 2)
+#endif
+ {
DPRINTF(("marking port %s valid\n",
ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
(void)ieee80211_send_group_msg2(ic, ni, k);
}
+#ifndef IEEE80211_STA_ONLY
/*
* Process Message 2 of the Group Key Handshake (sent by Supplicant).
*/
*/
}
}
+#endif /* IEEE80211_STA_ONLY */
-/* $OpenBSD: ieee80211_pae_output.c,v 1.12 2008/08/15 08:15:27 damien Exp $ */
+/* $OpenBSD: ieee80211_pae_output.c,v 1.13 2008/08/27 09:05:04 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
int ieee80211_send_eapol_key(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, const struct ieee80211_ptk *);
+#ifndef IEEE80211_STA_ONLY
u_int8_t *ieee80211_add_gtk_kde(u_int8_t *, struct ieee80211_node *,
const struct ieee80211_key *);
u_int8_t *ieee80211_add_pmkid_kde(u_int8_t *, const u_int8_t *);
u_int8_t *ieee80211_add_igtk_kde(u_int8_t *,
const struct ieee80211_key *);
+#endif
struct mbuf *ieee80211_get_eapol_key(int, int, u_int);
/*
BE_WRITE_2(key->paylen, len - sizeof(*key));
BE_WRITE_2(key->len, len - 4);
+#ifndef IEEE80211_STA_ONLY
if (info & EAPOL_KEY_ENCRYPTED) {
if (ni->ni_rsnprotos == IEEE80211_PROTO_WPA) {
/* clear "Encrypted" bit for WPA */
sizeof(*eh) + 4 + BE_READ_2(key->len);
}
}
+#endif
if (info & EAPOL_KEY_KEYMIC)
ieee80211_eapol_key_mic(key, ptk->kck);
len = m->m_pkthdr.len;
s = splnet();
+#ifndef IEEE80211_STA_ONLY
/* start a 100ms timeout if an answer is expected from supplicant */
if (info & EAPOL_KEY_KEYACK)
timeout_add(&ni->ni_rsn_timeout, hz / 10);
+#endif
IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
if (error == 0) {
ifp->if_obytes += len;
return error;
}
+#ifndef IEEE80211_STA_ONLY
/*
* Handle EAPOL-Key timeouts (no answer from supplicant).
*/
memcpy(frm, k->k_key, 16);
return frm + 16;
}
+#endif /* IEEE80211_STA_ONLY */
struct mbuf *
ieee80211_get_eapol_key(int flags, int type, u_int pktlen)
return m;
}
+#ifndef IEEE80211_STA_ONLY
/*
* Send 4-Way Handshake Message 1 to the supplicant.
*/
return ieee80211_send_eapol_key(ic, m, ni, NULL);
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Send 4-Way Handshake Message 2 to the authenticator.
return ieee80211_send_eapol_key(ic, m, ni, tptk);
}
+#ifndef IEEE80211_STA_ONLY
/*
* Send 4-Way Handshake Message 3 to the supplicant.
*/
return ieee80211_send_eapol_key(ic, m, ni, &ni->ni_ptk);
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Send 4-Way Handshake Message 4 to the authenticator.
return ieee80211_send_eapol_key(ic, m, ni, &ni->ni_ptk);
}
+#ifndef IEEE80211_STA_ONLY
/*
* Send Group Key Handshake Message 1 to the supplicant.
*/
return ieee80211_send_eapol_key(ic, m, ni, &ni->ni_ptk);
}
+#endif /* IEEE80211_STA_ONLY */
/*
* Send Group Key Handshake Message 2 to the authenticator.
-/* $OpenBSD: ieee80211_proto.c,v 1.33 2008/08/14 15:51:43 damien Exp $ */
+/* $OpenBSD: ieee80211_proto.c,v 1.34 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
* Note that this is important for 11b stations
* when they want to associate with an 11g AP.
*/
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
(nrs->rs_rates[i] & IEEE80211_RATE_BASIC))
error++;
+#endif
ignore++;
}
}
* the device supports short slot time
*/
ieee80211_set_shortslottime(ic,
- ic->ic_curmode == IEEE80211_MODE_11A ||
+ ic->ic_curmode == IEEE80211_MODE_11A
+#ifndef IEEE80211_STA_ONLY
+ ||
(ic->ic_curmode == IEEE80211_MODE_11G &&
ic->ic_opmode == IEEE80211_M_HOSTAP &&
- (ic->ic_caps & IEEE80211_C_SHSLOT)));
+ (ic->ic_caps & IEEE80211_C_SHSLOT))
+#endif
+ );
if (ic->ic_curmode == IEEE80211_MODE_11A ||
(ic->ic_caps & IEEE80211_C_SHPREAMBLE))
ic->ic_updateslot(ic);
}
+#ifndef IEEE80211_STA_ONLY
/*
* Initiate a group key handshake with a node.
*/
/* re-schedule a GTK rekeying after 3600s */
timeout_add(&ic->ic_rsn_timeout, 3600 * hz);
}
+#endif /* IEEE80211_STA_ONLY */
void
ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh,
{
struct ifnet *ifp = &ic->ic_if;
switch (ic->ic_opmode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
if (ic->ic_state != IEEE80211_S_RUN ||
seq != IEEE80211_AUTH_OPEN_REQUEST) {
"newly" : "already");
ieee80211_node_newstate(ni, IEEE80211_STA_AUTH);
break;
+#endif /* IEEE80211_STA_ONLY */
case IEEE80211_M_STA:
if (ic->ic_state != IEEE80211_S_AUTH ||
ieee80211_new_state(ic, IEEE80211_S_ASSOC,
wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK);
break;
- case IEEE80211_M_MONITOR:
+ default:
break;
}
}
struct ieee80211_node *ni;
enum ieee80211_state ostate;
u_int rate;
+#ifndef IEEE80211_STA_ONLY
int s;
+#endif
ostate = ic->ic_state;
DPRINTF(("%s -> %s\n", ieee80211_state_name[ostate],
IEEE80211_FC0_SUBTYPE_DISASSOC,
IEEE80211_REASON_ASSOC_LEAVE);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
s = splnet();
RB_FOREACH(ni, ieee80211_tree, &ic->ic_tree) {
}
splx(s);
break;
+#endif
default:
break;
}
IEEE80211_FC0_SUBTYPE_DEAUTH,
IEEE80211_REASON_AUTH_LEAVE);
break;
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_HOSTAP:
s = splnet();
RB_FOREACH(ni, ieee80211_tree, &ic->ic_tree) {
}
splx(s);
break;
+#endif
default:
break;
}
/* FALLTHROUGH */
case IEEE80211_S_AUTH:
case IEEE80211_S_SCAN:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP)
timeout_del(&ic->ic_rsn_timeout);
+#endif
ic->ic_mgt_timer = 0;
IF_PURGE(&ic->ic_mgtq);
IF_PURGE(&ic->ic_pwrsaveq);
ni->ni_rstamp = 0;
switch (ostate) {
case IEEE80211_S_INIT:
+#ifndef IEEE80211_STA_ONLY
if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
ic->ic_des_chan != IEEE80211_CHAN_ANYC) {
/*
* bypass the scan and startup immediately.
*/
ieee80211_create_ibss(ic, ic->ic_des_chan);
- } else {
+ } else
+#endif
ieee80211_begin_scan(ifp);
- }
break;
case IEEE80211_S_SCAN:
/* scan next */
struct ifnet *ifp = &ic->ic_if;
switch (ic->ic_opmode) {
+#ifndef IEEE80211_STA_ONLY
case IEEE80211_M_IBSS:
case IEEE80211_M_HOSTAP:
nstate = LINK_STATE_UNKNOWN;
break;
+#endif
case IEEE80211_M_MONITOR:
nstate = LINK_STATE_DOWN;
break;
-/* $OpenBSD: ieee80211_var.h,v 1.46 2008/08/12 19:59:09 damien Exp $ */
+/* $OpenBSD: ieee80211_var.h,v 1.47 2008/08/27 09:05:04 damien Exp $ */
/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */
/*-
enum ieee80211_opmode {
IEEE80211_M_STA = 1, /* infrastructure station */
+#ifndef IEEE80211_STA_ONLY
IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */
IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */
IEEE80211_M_HOSTAP = 6, /* Software Access Point */
+#endif
IEEE80211_M_MONITOR = 8 /* Monitor mode */
};