automatically prepend __func__ to output.
deobfuscates debug messages a bit.
no binary change unless compiled with IEEE80211_DEBUG.
-/* $OpenBSD: ieee80211.c,v 1.32 2008/07/21 19:27:26 damien Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.33 2008/07/27 14:21:15 damien Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
/* validate new mode */
if ((ic->ic_modecaps & (1<<mode)) == 0) {
- IEEE80211_DPRINTF(("%s: mode %u not supported (caps 0x%x)\n",
- __func__, mode, ic->ic_modecaps));
+ DPRINTF(("mode %u not supported (caps 0x%x)\n",
+ mode, ic->ic_modecaps));
return EINVAL;
}
}
}
if (i > IEEE80211_CHAN_MAX) {
- IEEE80211_DPRINTF(("%s: no channels found for mode %u\n",
- __func__, mode));
+ DPRINTF(("no channels found for mode %u\n", mode));
return EINVAL;
}
} else
panic("Unexpected mode %u", mode);
- IEEE80211_DPRINTF(("%s: unsupported rate %u\n", __func__, rate));
+ DPRINTF(("unsupported rate %u\n", rate));
return 0;
}
case 0x0c: return 108;
}
} else
- panic("Unexpected mode %u", mode);
+ panic("unexpected mode %u", mode);
- IEEE80211_DPRINTF(("%s: unsupported plcp %u\n", __func__, plcp));
+ DPRINTF(("unsupported plcp %u\n", plcp));
return 0;
}
-/* $OpenBSD: ieee80211_amrr.c,v 1.4 2008/07/21 19:27:26 damien Exp $ */
+/* $OpenBSD: ieee80211_amrr.c,v 1.5 2008/07/27 14:21:15 damien Exp $ */
/*-
* Copyright (c) 2006
ieee80211_amrr_choose(struct ieee80211_amrr *amrr, struct ieee80211_node *ni,
struct ieee80211_amrr_node *amn)
{
+#define RV(rate) ((rate) & IEEE80211_RATE_VAL)
int need_change = 0;
if (is_success(amn) && is_enough(amn)) {
amn->amn_recovery = 1;
amn->amn_success = 0;
increase_rate(ni);
- IEEE80211_DPRINTF(("AMRR increasing rate %d (txcnt=%d "
- "retrycnt=%d)\n",
- ni->ni_rates.rs_rates[ni->ni_txrate] &
- IEEE80211_RATE_VAL,
+ DPRINTF(("increase rate=%d,#tx=%d,#retries=%d\n",
+ RV(ni->ni_rates.rs_rates[ni->ni_txrate]),
amn->amn_txcnt, amn->amn_retrycnt));
need_change = 1;
} else {
amrr->amrr_min_success_threshold;
}
decrease_rate(ni);
- IEEE80211_DPRINTF(("AMRR decreasing rate %d (txcnt=%d "
- "retrycnt=%d)\n",
- ni->ni_rates.rs_rates[ni->ni_txrate] &
- IEEE80211_RATE_VAL,
+ DPRINTF(("decrease rate=%d,#tx=%d,#retries=%d\n",
+ RV(ni->ni_rates.rs_rates[ni->ni_txrate]),
amn->amn_txcnt, amn->amn_retrycnt));
need_change = 1;
}
if (is_enough(amn) || need_change)
reset_cnt(amn);
+#undef RV
}
/* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */
-/* $OpenBSD: ieee80211_input.c,v 1.83 2008/07/21 19:27:26 damien Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.84 2008/07/27 14:21:15 damien Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
/* do not process frames w/o i_addr2 any further */
if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_min)) {
- IEEE80211_DPRINTF2(("%s: frame too short (1), len %u\n",
- __func__, m->m_pkthdr.len));
+ DPRINTF(("frame too short (1), len %u\n", m->m_pkthdr.len));
ic->ic_stats.is_rx_tooshort++;
goto out;
}
wh = mtod(m, struct ieee80211_frame *);
if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) !=
IEEE80211_FC0_VERSION_0) {
- IEEE80211_DPRINTF(("%s: packet with wrong version: %x\n",
- __func__, wh->i_fc[0]));
+ DPRINTF(("packet with wrong version: %x\n", wh->i_fc[0]));
ic->ic_stats.is_rx_badversion++;
goto err;
}
* them to go through bpf tapping at the 802.11 layer.
*/
if (m->m_pkthdr.len < sizeof(struct ieee80211_frame)) {
- IEEE80211_DPRINTF2(("%s: frame too short (2), len %u\n",
- __func__, m->m_pkthdr.len));
+ DPRINTF(("frame too short (2), len %u\n", m->m_pkthdr.len));
ic->ic_stats.is_rx_tooshort++;
goto out;
}
if (ic->ic_state != IEEE80211_S_SCAN &&
!IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_bssid)) {
/* Source address is not our BSS. */
- IEEE80211_DPRINTF(
- ("%s: discard frame from SA %s\n",
- __func__, ether_sprintf(wh->i_addr2)));
+ DPRINTF(("discard frame from SA %s\n",
+ ether_sprintf(wh->i_addr2)));
ic->ic_stats.is_rx_wrongbss++;
goto out;
}
!IEEE80211_ADDR_EQ(wh->i_addr3,
etherbroadcastaddr)) {
/* Destination is not our BSS or broadcast. */
- IEEE80211_DPRINTF2(
- ("%s: discard data frame to DA %s\n",
- __func__, ether_sprintf(wh->i_addr3)));
+ DPRINTF(("discard data frame to DA %s\n",
+ ether_sprintf(wh->i_addr3)));
ic->ic_stats.is_rx_wrongbss++;
goto out;
}
!IEEE80211_ADDR_EQ(wh->i_addr1,
etherbroadcastaddr)) {
/* BSS is not us or broadcast. */
- IEEE80211_DPRINTF2(
- ("%s: discard data frame to BSS %s\n",
- __func__, ether_sprintf(wh->i_addr1)));
+ DPRINTF(("discard data frame to BSS %s\n",
+ ether_sprintf(wh->i_addr1)));
ic->ic_stats.is_rx_wrongbss++;
goto out;
}
/* check if source STA is associated */
if (ni == ic->ic_bss) {
- IEEE80211_DPRINTF(("%s: "
- "data from unknown src %s\n", __func__,
+ DPRINTF(("data from unknown src %s\n",
ether_sprintf(wh->i_addr2)));
/* NB: caller deals with reference */
ni = ieee80211_dup_bss(ic, wh->i_addr2);
goto err;
}
if (ni->ni_associd == 0) {
- IEEE80211_DPRINTF(("%s: "
- "data from unassoc src %s\n", __func__,
+ DPRINTF(("data from unassoc src %s\n",
ether_sprintf(wh->i_addr2)));
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_DISASSOC,
#endif
m = ieee80211_decap(ifp, m, hdrlen);
if (m == NULL) {
- IEEE80211_DPRINTF(("%s: "
- "decapsulation error for src %s\n",
- __func__, ether_sprintf(wh->i_addr2)));
+ DPRINTF(("decapsulation error for src %s\n",
+ ether_sprintf(wh->i_addr2)));
ic->ic_stats.is_rx_decap++;
goto err;
}
if ((ic->ic_flags & IEEE80211_F_RSNON) && !ni->ni_port_valid &&
eh->ether_type != htons(ETHERTYPE_PAE)) {
- IEEE80211_DPRINTF(("%s: port not valid: %s\n",
- __func__, ether_sprintf(wh->i_addr2)));
+ DPRINTF(("port not valid: %s\n",
+ ether_sprintf(wh->i_addr2)));
ic->ic_stats.is_rx_unauth++;
goto err;
}
goto out;
default:
- IEEE80211_DPRINTF(("%s: bad packet type %x\n", __func__, type));
+ DPRINTF(("bad packet type %x\n", type));
/* should not come here */
break;
}
break;
case IEEE80211_FC1_DIR_DSTODS:
/* not yet supported */
- IEEE80211_DPRINTF(("%s: discard DS to DS frame\n", __func__));
+ DPRINTF(("discard DS to DS frame\n"));
m_freem(m);
return NULL;
}
int
ieee80211_parse_edca_params(struct ieee80211com *ic, const u_int8_t *frm)
{
- /* check IE length */
if (frm[1] < 18) {
- IEEE80211_DPRINTF(("%s: invalid EDCA parameter set IE;"
- " length %u, expecting 18\n", __func__, frm[1]));
ic->ic_stats.is_rx_elem_toosmall++;
return IEEE80211_REASON_IE_INVALID;
}
int
ieee80211_parse_wmm_params(struct ieee80211com *ic, const u_int8_t *frm)
{
- /* check IE length */
if (frm[1] < 24) {
- IEEE80211_DPRINTF(("%s: invalid WMM parameter set IE;"
- " length %u, expecting 24\n", __func__, frm[1]));
ic->ic_stats.is_rx_elem_toosmall++;
return IEEE80211_REASON_IE_INVALID;
}
ieee80211_parse_rsn(struct ieee80211com *ic, const u_int8_t *frm,
struct ieee80211_rsnparams *rsn)
{
- /* check IE length */
if (frm[1] < 2) {
- IEEE80211_DPRINTF(("%s: invalid RSN IE;"
- " length %u, expecting at least 2\n", __func__, frm[1]));
ic->ic_stats.is_rx_elem_toosmall++;
return IEEE80211_STATUS_IE_INVALID;
}
ieee80211_parse_wpa(struct ieee80211com *ic, const u_int8_t *frm,
struct ieee80211_rsnparams *rsn)
{
- /* check IE length */
if (frm[1] < 6) {
- IEEE80211_DPRINTF(("%s: invalid WPA IE;"
- " length %u, expecting at least 6\n", __func__, frm[1]));
ic->ic_stats.is_rx_elem_toosmall++;
return IEEE80211_STATUS_IE_INVALID;
}
/* make sure all mandatory fixed fields are present */
if (efrm - frm < 12) {
- IEEE80211_DPRINTF(("%s: frame too short\n", __func__));
+ DPRINTF(("frame too short\n"));
return;
}
tstamp = frm; frm += 8;
}
break;
default:
- IEEE80211_DPRINTF2(("%s: element id %u/len %u "
- "ignored\n", __func__, *frm, frm[1]));
+ DPRINTF(("element id %u/len %u ignored\n",
+ frm[0], frm[1]));
ic->ic_stats.is_rx_elem_unknown++;
break;
}
}
/* supported rates element is mandatory */
if (rates == NULL || rates[1] > IEEE80211_RATE_MAXSIZE) {
- IEEE80211_DPRINTF(("%s: invalid supported rates element\n",
- __func__));
+ DPRINTF(("invalid supported rates element\n"));
return;
}
/* SSID element is mandatory */
if (ssid == NULL || ssid[1] > IEEE80211_NWID_LEN) {
- IEEE80211_DPRINTF(("%s: invalid SSID element\n", __func__));
+ DPRINTF(("invalid SSID element\n"));
return;
}
if (
chan > IEEE80211_CHAN_MAX ||
#endif
isclr(ic->ic_chan_active, chan)) {
- IEEE80211_DPRINTF(("%s: ignore %s with invalid channel "
- "%u\n", __func__, isprobe ?
- "probe response" : "beacon", chan));
+ DPRINTF(("ignore %s with invalid channel %u\n",
+ isprobe ? "probe response" : "beacon", chan));
ic->ic_stats.is_rx_badchan++;
return;
}
* the rssi value should be correct even for
* different hop pattern in FH.
*/
- IEEE80211_DPRINTF(("%s: ignore %s on channel %u marked "
- "for channel %u\n", __func__, isprobe ?
- "probe response" : "beacon", bchan, chan));
+ DPRINTF(("ignore %s on channel %u marked for channel %u\n",
+ isprobe ? "probe response" : "beacon", bchan, chan));
ic->ic_stats.is_rx_chanmismatch++;
return;
}
* Check if protection mode has changed since last beacon.
*/
if (ni->ni_erp != erp) {
- IEEE80211_DPRINTF((
- "[%s] erp change: was 0x%x, now 0x%x\n",
+ DPRINTF(("[%s] erp change: was 0x%x, now 0x%x\n",
ether_sprintf((u_int8_t *)wh->i_addr2),
ni->ni_erp, erp));
if (ic->ic_curmode == IEEE80211_MODE_11G &&
}
/* supported rates element is mandatory */
if (rates == NULL || rates[1] > IEEE80211_RATE_MAXSIZE) {
- IEEE80211_DPRINTF(("%s: invalid supported rates element\n",
- __func__));
+ DPRINTF(("invalid supported rates element\n"));
return;
}
/* SSID element is mandatory */
if (ssid == NULL || ssid[1] > IEEE80211_NWID_LEN) {
- IEEE80211_DPRINTF(("%s: invalid SSID element\n", __func__));
+ DPRINTF(("invalid SSID element\n"));
return;
}
/* check that the specified SSID (if not wildcard) matches ours */
if (ssid[1] != 0 && (ssid[1] != ic->ic_bss->ni_esslen ||
memcmp(&ssid[2], ic->ic_bss->ni_essid, ic->ic_bss->ni_esslen))) {
- IEEE80211_DPRINTF(("%s: SSID mismatch\n", __func__));
+ DPRINTF(("SSID mismatch\n"));
ic->ic_stats.is_rx_ssidmismatch++;
return;
}
/* refuse wildcard SSID if we're hiding our SSID in beacons */
if (ssid[1] == 0 && (ic->ic_flags & IEEE80211_F_HIDENWID)) {
- IEEE80211_DPRINTF(("%s: wildcard SSID rejected", __func__));
+ DPRINTF(("wildcard SSID rejected"));
ic->ic_stats.is_rx_ssidmismatch++;
return;
}
ni = ieee80211_dup_bss(ic, wh->i_addr2);
if (ni == NULL)
return;
- IEEE80211_DPRINTF(("%s: new probe req from %s\n",
- __func__, ether_sprintf((u_int8_t *)wh->i_addr2)));
+ DPRINTF(("new probe req from %s\n",
+ ether_sprintf((u_int8_t *)wh->i_addr2)));
}
ni->ni_rssi = rxi->rxi_rssi;
ni->ni_rstamp = rxi->rxi_tstamp;
IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE | IEEE80211_F_DONEGO |
IEEE80211_F_DODEL);
if (rate & IEEE80211_RATE_BASIC) {
- IEEE80211_DPRINTF(("%s: rate mismatch for %s\n",
- __func__, ether_sprintf((u_int8_t *)wh->i_addr2)));
+ DPRINTF(("rate mismatch for %s\n",
+ ether_sprintf((u_int8_t *)wh->i_addr2)));
return;
}
IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
/* make sure all mandatory fixed fields are present */
if (efrm - frm < 6) {
- IEEE80211_DPRINTF(("%s: frame too short\n", __func__));
+ DPRINTF(("frame too short\n"));
return;
}
algo = LE_READ_2(frm); frm += 2;
seq = LE_READ_2(frm); frm += 2;
status = LE_READ_2(frm); frm += 2;
- IEEE80211_DPRINTF(("%s: auth %d seq %d from %s\n",
- __func__, algo, seq, ether_sprintf((u_int8_t *)wh->i_addr2)));
+ DPRINTF(("auth %d seq %d from %s\n", algo, seq,
+ ether_sprintf((u_int8_t *)wh->i_addr2)));
/* only "open" auth mode is supported */
if (algo != IEEE80211_AUTH_ALG_OPEN) {
- IEEE80211_DPRINTF(("%s: unsupported authentication "
- "algorithm %d from %s\n",
- __func__, algo, ether_sprintf((u_int8_t *)wh->i_addr2)));
+ DPRINTF(("unsupported auth algorithm %d from %s\n",
+ algo, ether_sprintf((u_int8_t *)wh->i_addr2)));
ic->ic_stats.is_rx_auth_unsupported++;
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
/* XXX hack to workaround calling convention */
/* make sure all mandatory fixed fields are present */
if (efrm - frm < (reassoc ? 10 : 4)) {
- IEEE80211_DPRINTF(("%s: frame too short\n", __func__));
+ DPRINTF(("frame too short\n"));
return;
}
if (!IEEE80211_ADDR_EQ(wh->i_addr3, ic->ic_bss->ni_bssid)) {
- IEEE80211_DPRINTF(("%s: ignore other bss from %s\n",
- __func__, ether_sprintf((u_int8_t *)wh->i_addr2)));
+ DPRINTF(("ignore other bss from %s\n",
+ ether_sprintf((u_int8_t *)wh->i_addr2)));
ic->ic_stats.is_rx_assoc_bss++;
return;
}
}
/* supported rates element is mandatory */
if (rates == NULL || rates[1] > IEEE80211_RATE_MAXSIZE) {
- IEEE80211_DPRINTF(("%s: invalid supported rates element\n",
- __func__));
+ DPRINTF(("invalid supported rates element\n"));
return;
}
/* SSID element is mandatory */
if (ssid == NULL || ssid[1] > IEEE80211_NWID_LEN) {
- IEEE80211_DPRINTF(("%s: invalid SSID element\n", __func__));
+ DPRINTF(("invalid SSID element\n"));
return;
}
/* check that the specified SSID matches ours */
if (ssid[1] != ic->ic_bss->ni_esslen ||
memcmp(&ssid[2], ic->ic_bss->ni_essid, ic->ic_bss->ni_esslen)) {
- IEEE80211_DPRINTF(("%s: SSID mismatch\n", __func__));
+ DPRINTF(("SSID mismatch\n"));
ic->ic_stats.is_rx_ssidmismatch++;
return;
}
if (ni->ni_state != IEEE80211_STA_AUTH &&
ni->ni_state != IEEE80211_STA_ASSOC) {
- IEEE80211_DPRINTF(
- ("%s: deny %sassoc from %s, not authenticated\n",
- __func__, reassoc ? "re" : "",
+ DPRINTF(("deny %sassoc from %s, not authenticated\n",
+ reassoc ? "re" : "",
ether_sprintf((u_int8_t *)wh->i_addr2)));
ni = ieee80211_dup_bss(ic, wh->i_addr2);
if (ni != NULL) {
/* make sure all mandatory fixed fields are present */
if (efrm - frm < 6) {
- IEEE80211_DPRINTF(("%s: frame too short\n", __func__));
+ DPRINTF(("%s: frame too short\n"));
return;
}
capinfo = LE_READ_2(frm); frm += 2;
}
/* supported rates element is mandatory */
if (rates == NULL || rates[1] > IEEE80211_RATE_MAXSIZE) {
- IEEE80211_DPRINTF(("%s: invalid supported rates element\n",
- __func__));
+ DPRINTF(("invalid supported rates element\n"));
return;
}
rate = ieee80211_setup_rates(ic, ni, rates, xrates,
IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE | IEEE80211_F_DONEGO |
IEEE80211_F_DODEL);
if (rate & IEEE80211_RATE_BASIC) {
- IEEE80211_DPRINTF(("%s: rate mismatch for %s\n",
- __func__, ether_sprintf((u_int8_t *)wh->i_addr2)));
+ DPRINTF(("rate mismatch for %s\n",
+ ether_sprintf((u_int8_t *)wh->i_addr2)));
ic->ic_stats.is_rx_assoc_norate++;
return;
}
/* make sure all mandatory fixed fields are present */
if (efrm - frm < 2) {
- IEEE80211_DPRINTF(("%s: frame too short\n", __func__));
+ DPRINTF(("frame too short\n"));
return;
}
reason = LE_READ_2(frm);
/* make sure all mandatory fixed fields are present */
if (efrm - frm < 2) {
- IEEE80211_DPRINTF(("%s: frame too short\n", __func__));
+ DPRINTF(("frame too short\n"));
return;
}
reason = LE_READ_2(frm);
ieee80211_recv_action(ic, m0, ni);
break;
default:
- IEEE80211_DPRINTF(("%s: mgmt frame with subtype 0x%x not "
- "handled\n", __func__, subtype));
+ DPRINTF(("mgmt frame with subtype 0x%x not handled\n",
+ subtype));
ic->ic_stats.is_rx_badsubtype++;
break;
}
-/* $OpenBSD: ieee80211_node.c,v 1.35 2008/07/21 19:27:26 damien Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.36 2008/07/27 14:21:15 damien Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
}
}
clrbit(ic->ic_chan_scan, ieee80211_chan2ieee(ic, chan));
- IEEE80211_DPRINTF(("%s: chan %d->%d\n", __func__,
+ DPRINTF(("chan %d->%d\n",
ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan),
ieee80211_chan2ieee(ic, chan)));
ic->ic_bss->ni_chan = chan;
goto wakeup;
}
if (ni == NULL) {
- IEEE80211_DPRINTF(("%s: no scan candidate\n", __func__));
+ DPRINTF(("no scan candidate\n"));
notfound:
if (ic->ic_opmode == IEEE80211_M_IBSS &&
(ic->ic_flags & IEEE80211_F_IBSSON) &&
{
int s;
- IEEE80211_DPRINTF(("%s %s\n", __func__,
- ether_sprintf((u_int8_t *)macaddr)));
+ DPRINTF(("%s\n", ether_sprintf((u_int8_t *)macaddr)));
IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr);
ieee80211_node_newstate(ni, IEEE80211_STA_CACHE);
if (ic->ic_newassoc)
(*ic->ic_newassoc)(ic, ni, 1);
- IEEE80211_DPRINTF(("%s: faked-up node %p for %s\n", __func__, ni,
+ DPRINTF(("faked-up node %p for %s\n", ni,
ether_sprintf((u_int8_t *)wh->i_addr2)));
return ieee80211_ref_node(ni);
if (ni == ic->ic_bss)
panic("freeing bss node");
- IEEE80211_DPRINTF(("%s %s\n", __func__, ether_sprintf(ni->ni_macaddr)));
+ DPRINTF(("%s\n", ether_sprintf(ni->ni_macaddr)));
IEEE80211_AID_CLR(ni->ni_associd, ic->ic_aid_bitmap);
RB_REMOVE(ieee80211_tree, &ic->ic_tree, ni);
ic->ic_nnodes--;
{
int s;
- IEEE80211_DPRINTF(("%s %s refcnt %d\n", __func__,
- ether_sprintf(ni->ni_macaddr), ni->ni_refcnt));
+ DPRINTF(("%s refcnt %d\n", ether_sprintf(ni->ni_macaddr),
+ ni->ni_refcnt));
if (ieee80211_node_decref(ni) == 0 &&
ni->ni_state == IEEE80211_STA_COLLECT) {
s = splnet();
struct ieee80211_node *ni;
int s;
- IEEE80211_DPRINTF(("%s\n", __func__));
+ DPRINTF(("freeing all nodes\n"));
s = splnet();
while ((ni = RB_MIN(ieee80211_tree, &ic->ic_tree)) != NULL)
ieee80211_free_node(ic, ni);
ni->ni_scangen = gen;
if (ni->ni_refcnt > 0)
continue;
- IEEE80211_DPRINTF(("station %s purged from LRU cache\n",
+ DPRINTF(("station %s purged from LRU cache\n",
ether_sprintf(ni->ni_macaddr)));
/*
* Send a deauthenticate frame.
nxrates = xrates[1];
if (rs->rs_nrates + nxrates > IEEE80211_RATE_MAXSIZE) {
nxrates = IEEE80211_RATE_MAXSIZE - rs->rs_nrates;
- IEEE80211_DPRINTF(("%s: extended rate set too large;"
- " only using %u of %u rates\n",
- __func__, nxrates, xrates[1]));
+ DPRINTF(("extended rate set too large; "
+ "only using %u of %u rates\n",
+ nxrates, xrates[1]));
ic->ic_stats.is_rx_rstoobig++;
}
memcpy(rs->rs_rates + rs->rs_nrates, xrates+2, nxrates);
void
ieee80211_node_join_rsn(struct ieee80211com *ic, struct ieee80211_node *ni)
{
- IEEE80211_DPRINTF(("station %s associated using proto %d akm 0x%x "
+ DPRINTF(("station %s associated using proto %d akm 0x%x "
"cipher 0x%x groupcipher 0x%x\n", ether_sprintf(ni->ni_macaddr),
ni->ni_rsnprotos, ni->ni_rsnakms, ni->ni_rsnciphers,
ni->ni_rsngroupcipher));
if (ic->ic_caps & IEEE80211_C_SHSLOT)
ieee80211_set_shortslottime(ic, 0);
}
- IEEE80211_DPRINTF(("[%s] station needs long slot time, "
- "count %d\n", ether_sprintf(ni->ni_macaddr),
- ic->ic_longslotsta));
+ DPRINTF(("[%s] station needs long slot time, count %d\n",
+ ether_sprintf(ni->ni_macaddr), ic->ic_longslotsta));
}
if (!ieee80211_iserp_sta(ni)) {
*/
ic->ic_nonerpsta++;
- IEEE80211_DPRINTF(("[%s] station is non-ERP, %d non-ERP "
+ DPRINTF(("[%s] station is non-ERP, %d non-ERP "
"stations associated\n", ether_sprintf(ni->ni_macaddr),
ic->ic_nonerpsta));
/* must enable the use of protection */
if (ic->ic_protmode != IEEE80211_PROT_NONE) {
- IEEE80211_DPRINTF(("%s: enable use of protection\n",
- __func__));
+ DPRINTF(("enable use of protection\n"));
ic->ic_flags |= IEEE80211_F_USEPROT;
}
} else
newassoc = 0;
- IEEE80211_DPRINTF(("station %s %s associated at aid %d\n",
- ether_sprintf(ni->ni_macaddr),
- (newassoc ? "newly" : "already"),
+ DPRINTF(("station %s %s associated at aid %d\n",
+ ether_sprintf(ni->ni_macaddr), newassoc ? "newly" : "already",
ni->ni_associd & ~0xc000));
/* give driver a chance to setup state like ni_txrate */
ic->ic_opmode != IEEE80211_M_IBSS)
ieee80211_set_shortslottime(ic, 1);
}
- IEEE80211_DPRINTF(("[%s] long slot time station leaves, "
- "count now %d\n", ether_sprintf(ni->ni_macaddr),
- ic->ic_longslotsta));
+ DPRINTF(("[%s] long slot time station leaves, count %d\n",
+ ether_sprintf(ni->ni_macaddr), ic->ic_longslotsta));
}
if (!(ni->ni_flags & IEEE80211_NODE_ERP)) {
if (ic->ic_caps & IEEE80211_C_SHPREAMBLE)
ic->ic_flags |= IEEE80211_F_SHPREAMBLE;
}
- IEEE80211_DPRINTF(("[%s] non-ERP station leaves, "
- "count now %d\n", ether_sprintf(ni->ni_macaddr),
- ic->ic_nonerpsta));
+ DPRINTF(("[%s] non-ERP station leaves, count %d\n",
+ ether_sprintf(ni->ni_macaddr), ic->ic_nonerpsta));
}
}
-/* $OpenBSD: ieee80211_output.c,v 1.62 2008/07/23 15:55:46 damien Exp $ */
+/* $OpenBSD: ieee80211_output.c,v 1.63 2008/07/27 14:21:15 damien Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
ni = ieee80211_find_txnode(ic, eh.ether_dhost);
if (ni == NULL) {
- IEEE80211_DPRINTF(("%s: no node for dst %s, discard frame\n",
- __func__, ether_sprintf(eh.ether_dhost)));
+ DPRINTF(("no node for dst %s, discard frame\n",
+ ether_sprintf(eh.ether_dhost)));
ic->ic_stats.is_tx_nonode++;
goto bad;
}
if ((ic->ic_flags & IEEE80211_F_RSNON) && !ni->ni_port_valid &&
eh.ether_type != htons(ETHERTYPE_PAE)) {
- IEEE80211_DPRINTF(("%s: port not valid: %s\n",
- __func__, ether_sprintf(eh.ether_dhost)));
+ DPRINTF(("port not valid: %s\n",
+ ether_sprintf(eh.ether_dhost)));
ic->ic_stats.is_tx_noauth++;
goto bad;
}
break;
default:
- IEEE80211_DPRINTF(("%s: invalid mgmt frame type %u\n",
- __func__, type));
+ DPRINTF(("invalid mgmt frame type %u\n", type));
senderr(EINVAL, is_tx_unknownmgt);
/* NOTREACHED */
}
u_int8_t *frm;
m = ieee80211_getmgmt(M_DONTWAIT, MT_DATA,
- 8 + 2 + 2 +
+ 8 + 2 + 2 +
2 + ((ic->ic_flags & IEEE80211_F_HIDENWID) ? 0 : ni->ni_esslen) +
2 + min(rs->rs_nrates, IEEE80211_RATE_SIZE) +
2 + ((ic->ic_phytype == IEEE80211_T_FH) ? 5 : 1) +
-/* $OpenBSD: ieee80211_pae_input.c,v 1.2 2008/07/21 19:27:26 damien Exp $ */
+/* $OpenBSD: ieee80211_pae_input.c,v 1.3 2008/07/27 14:21:15 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/sockio.h>
-#include <sys/endian.h>
#include <sys/errno.h>
#include <sys/proc.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/in_systm.h>
-#include <netinet/ip.h>
#endif
#include <net80211/ieee80211_var.h>
/* discard if we're not expecting this message */
if (ni->ni_rsn_state != RSNA_PTKSTART &&
ni->ni_rsn_state != RSNA_PTKCALCNEGOTIATING) {
- IEEE80211_DPRINTF(("%s: unexpected in state: %d\n",
- __func__, ni->ni_rsn_state));
+ DPRINTF(("unexpected in state: %d\n", ni->ni_rsn_state));
return;
}
ni->ni_rsn_state = RSNA_PTKCALCNEGOTIATING;
/* check Key MIC field using KCK */
if (ieee80211_eapol_key_check_mic(key, tptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return; /* will timeout.. */
}
/* check that ANonce matches that of message 1 */
if (memcmp(key->nonce, ni->ni_nonce, EAPOL_KEY_NONCE_LEN) != 0) {
- IEEE80211_DPRINTF(("%s: ANonce does not match msg 1/4\n",
- __func__));
+ DPRINTF(("ANonce does not match msg 1/4\n"));
return;
}
/* retrieve PMK and derive TPTK */
/* check Key MIC field using KCK */
if (ieee80211_eapol_key_check_mic(key, tptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return;
}
/* if encrypted, decrypt Key Data field using KEK */
if ((info & EAPOL_KEY_ENCRYPTED) &&
ieee80211_eapol_key_decrypt(key, ni->ni_ptk.kek) != 0) {
- IEEE80211_DPRINTF(("%s: decryption failed\n", __func__));
+ DPRINTF(("decryption failed\n"));
return;
}
}
/* first WPA/RSN IE is mandatory */
if (rsnie1 == NULL) {
- IEEE80211_DPRINTF(("%s: missing RSN IE\n", __func__));
+ DPRINTF(("missing RSN IE\n"));
return;
}
/* key data must be encrypted if GTK is included */
if (gtk != NULL && !(info & EAPOL_KEY_ENCRYPTED)) {
- IEEE80211_DPRINTF(("%s: GTK not encrypted\n", __func__));
+ DPRINTF(("GTK not encrypted\n"));
return;
}
/*
if (info & EAPOL_KEY_SECURE) {
if (ic->ic_opmode != IEEE80211_M_IBSS ||
++ni->ni_key_count == 2) {
- IEEE80211_DPRINTF(("%s: marking port %s valid\n",
- __func__, ether_sprintf(ni->ni_macaddr)));
+ DPRINTF(("marking port %s valid\n",
+ ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
}
}
/* discard if we're not expecting this message */
if (ni->ni_rsn_state != RSNA_PTKINITNEGOTIATING) {
- IEEE80211_DPRINTF(("%s: unexpected in state: %d\n",
- __func__, ni->ni_rsn_state));
+ DPRINTF(("unexpected in state: %d\n", ni->ni_rsn_state));
return;
}
/* check Key MIC field using KCK */
if (ieee80211_eapol_key_check_mic(key, ni->ni_ptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return; /* will timeout.. */
}
}
}
if (ic->ic_opmode != IEEE80211_M_IBSS || ++ni->ni_key_count == 2) {
- IEEE80211_DPRINTF(("%s: marking port %s valid\n", __func__,
+ DPRINTF(("marking port %s valid\n",
ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
}
}
/* check Key MIC field using KCK */
if (ieee80211_eapol_key_check_mic(key, ni->ni_ptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return;
}
/* check that encrypted and decrypt Key Data field using KEK */
if (!(info & EAPOL_KEY_ENCRYPTED) ||
ieee80211_eapol_key_decrypt(key, ni->ni_ptk.kek) != 0) {
- IEEE80211_DPRINTF(("%s: decryption failed\n", __func__));
+ DPRINTF(("decryption failed\n"));
return;
}
}
/* check that the GTK KDE is present and valid */
if (gtk == NULL || gtk[1] < 4 + 2) {
- IEEE80211_DPRINTF(("%s: missing or invalid GTK KDE\n",
- __func__));
+ DPRINTF(("missing or invalid GTK KDE\n"));
return;
}
if (info & EAPOL_KEY_SECURE) {
if (ic->ic_opmode != IEEE80211_M_IBSS ||
++ni->ni_key_count == 2) {
- IEEE80211_DPRINTF(("%s: marking port %s valid\n",
- __func__, ether_sprintf(ni->ni_macaddr)));
+ DPRINTF(("marking port %s valid\n",
+ ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
}
}
}
/* check Key MIC field using KCK */
if (ieee80211_eapol_key_check_mic(key, ni->ni_ptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return;
}
* the ENCRYPTED bit in the info field.
*/
if (ieee80211_eapol_key_decrypt(key, ni->ni_ptk.kek) != 0) {
- IEEE80211_DPRINTF(("%s: decryption failed\n", __func__));
+ DPRINTF(("decryption failed\n"));
return;
}
info = BE_READ_2(key->info);
if (info & EAPOL_KEY_SECURE) {
if (ic->ic_opmode != IEEE80211_M_IBSS ||
++ni->ni_key_count == 2) {
- IEEE80211_DPRINTF(("%s: marking port %s valid\n",
- __func__, ether_sprintf(ni->ni_macaddr)));
+ DPRINTF(("marking port %s valid\n",
+ ether_sprintf(ni->ni_macaddr)));
ni->ni_port_valid = 1;
}
}
/* discard if we're not expecting this message */
if (ni->ni_rsn_gstate != RSNA_REKEYNEGOTIATING) {
- IEEE80211_DPRINTF(("%s: unexpected in state: %d\n",
- __func__, ni->ni_rsn_state));
+ DPRINTF(("%s: unexpected in state: %d\n", ni->ni_rsn_state));
return;
}
if (BE_READ_8(key->replaycnt) != ni->ni_replaycnt) {
}
/* check Key MIC field using KCK */
if (ieee80211_eapol_key_check_mic(key, ni->ni_ptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return;
}
}
if (!(info & EAPOL_KEY_KEYMIC) ||
ieee80211_eapol_key_check_mic(key, ni->ni_ptk.kck) != 0) {
- IEEE80211_DPRINTF(("%s: key MIC failed\n", __func__));
+ DPRINTF(("key MIC failed\n"));
ic->ic_stats.is_rx_eapol_badmic++;
return;
}
/* ignore reports from STAs not using TKIP */
if (ic->ic_bss->ni_rsngroupcipher != IEEE80211_CIPHER_TKIP &&
ni->ni_rsncipher != IEEE80211_CIPHER_TKIP) {
- IEEE80211_DPRINTF(("%s: MIC failure report from "
- "STA not using TKIP: %s\n", __func__,
+ DPRINTF(("MIC failure report from !TKIP STA: %s\n",
ether_sprintf(ni->ni_macaddr)));
return;
}
-/* $OpenBSD: ieee80211_pae_output.c,v 1.3 2008/07/23 15:55:46 damien Exp $ */
+/* $OpenBSD: ieee80211_pae_output.c,v 1.4 2008/07/27 14:21:15 damien Exp $ */
/*-
* Copyright (c) 2007,2008 Damien Bergamini <damien.bergamini@free.fr>
struct ieee80211com *ic = ni->ni_ic;
int s;
- IEEE80211_DPRINTF(("%s: no answer from station %s in state %d\n",
- __func__, ether_sprintf(ni->ni_macaddr), ni->ni_rsn_state));
+ DPRINTF(("no answer from station %s in state %d\n",
+ ether_sprintf(ni->ni_macaddr), ni->ni_rsn_state));
s = splnet();
-/* $OpenBSD: ieee80211_priv.h,v 1.1 2008/07/21 19:27:26 damien Exp $ */
+/* $OpenBSD: ieee80211_priv.h,v 1.2 2008/07/27 14:21:15 damien Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
#define _NET80211_IEEE80211_PRIV_H_
#ifdef IEEE80211_DEBUG
-extern int ieee80211_debug;
-#define IEEE80211_DPRINTF(X) do { if (ieee80211_debug) printf X; } while(0)
-#define IEEE80211_DPRINTF2(X) do { if (ieee80211_debug>1) printf X; } while(0)
+extern int ieee80211_debug;
+#define DPRINTF(X) do { \
+ if (ieee80211_debug) { \
+ printf("%s: ", __func__); \
+ printf X; \
+ } \
+} while(0)
#else
-#define IEEE80211_DPRINTF(X)
-#define IEEE80211_DPRINTF2(X)
+#define DPRINTF(X)
#endif
-#define IEEE80211_AID_SET(b, w) \
+#define IEEE80211_AID_SET(b, w) \
((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
-#define IEEE80211_AID_CLR(b, w) \
+#define IEEE80211_AID_CLR(b, w) \
((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
-#define IEEE80211_AID_ISSET(b, w) \
+#define IEEE80211_AID_ISSET(b, w) \
((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
/* unaligned big endian access */
-/* $OpenBSD: ieee80211_proto.c,v 1.27 2008/07/26 12:56:06 damien Exp $ */
+/* $OpenBSD: ieee80211_proto.c,v 1.28 2008/07/27 14:21:15 damien Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
case IEEE80211_M_IBSS:
if (ic->ic_state != IEEE80211_S_RUN ||
seq != IEEE80211_AUTH_OPEN_REQUEST) {
- IEEE80211_DPRINTF(("%s: discard auth from %s; "
- "state %u, seq %u\n", __func__,
+ DPRINTF(("discard auth from %s; state %u, seq %u\n",
ether_sprintf((u_int8_t *)wh->i_addr2),
ic->ic_state, seq));
ic->ic_stats.is_rx_bad_auth++;
case IEEE80211_M_HOSTAP:
if (ic->ic_state != IEEE80211_S_RUN ||
seq != IEEE80211_AUTH_OPEN_REQUEST) {
- IEEE80211_DPRINTF(("%s: discard auth from %s; "
- "state %u, seq %u\n", __func__,
+ DPRINTF(("discard auth from %s; state %u, seq %u\n",
ether_sprintf((u_int8_t *)wh->i_addr2),
ic->ic_state, seq));
ic->ic_stats.is_rx_bad_auth++;
if (ic->ic_state != IEEE80211_S_AUTH ||
seq != IEEE80211_AUTH_OPEN_RESPONSE) {
ic->ic_stats.is_rx_bad_auth++;
- IEEE80211_DPRINTF(("%s: discard auth from %s; "
- "state %u, seq %u\n", __func__,
+ DPRINTF(("discard auth from %s; state %u, seq %u\n",
ether_sprintf((u_int8_t *)wh->i_addr2),
ic->ic_state, seq));
return;
int s;
ostate = ic->ic_state;
- IEEE80211_DPRINTF(("%s: %s -> %s\n", __func__,
- ieee80211_state_name[ostate], ieee80211_state_name[nstate]));
+ DPRINTF(("%s -> %s\n", ieee80211_state_name[ostate],
+ ieee80211_state_name[nstate]));
ic->ic_state = nstate; /* state transition */
ni = ic->ic_bss; /* NB: no reference held */
if (ostate == IEEE80211_S_RUN)
case IEEE80211_S_AUTH:
switch (ostate) {
case IEEE80211_S_INIT:
- IEEE80211_DPRINTF(("%s: invalid transition\n",
- __func__));
+ DPRINTF(("invalid transition\n"));
break;
case IEEE80211_S_SCAN:
IEEE80211_SEND_MGMT(ic, ni,
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
case IEEE80211_S_ASSOC:
- IEEE80211_DPRINTF(("%s: invalid transition\n",
- __func__));
+ DPRINTF(("invalid transition\n"));
break;
case IEEE80211_S_AUTH:
IEEE80211_SEND_MGMT(ic, ni,
case IEEE80211_S_INIT:
case IEEE80211_S_AUTH:
case IEEE80211_S_RUN:
- IEEE80211_DPRINTF(("%s: invalid transition\n",
- __func__));
+ DPRINTF(("invalid transition\n"));
break;
case IEEE80211_S_SCAN: /* adhoc/hostap mode */
case IEEE80211_S_ASSOC: /* infra mode */