From: damien Date: Sun, 27 Jul 2008 14:21:15 +0000 (+0000) Subject: s/IEEE80211_DPRINTF/DPRINTF/ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=932b90273d3ad4b209af3086369c24ea290f775b;p=openbsd s/IEEE80211_DPRINTF/DPRINTF/ automatically prepend __func__ to output. deobfuscates debug messages a bit. no binary change unless compiled with IEEE80211_DEBUG. --- diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 5e64258b045..3d4fc6c7ea4 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -666,8 +666,8 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) /* validate new mode */ if ((ic->ic_modecaps & (1<ic_modecaps)); + DPRINTF(("mode %u not supported (caps 0x%x)\n", + mode, ic->ic_modecaps)); return EINVAL; } @@ -690,8 +690,7 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) } } 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; } @@ -957,7 +956,7 @@ ieee80211_rate2plcp(u_int8_t rate, enum ieee80211_phymode mode) } else panic("Unexpected mode %u", mode); - IEEE80211_DPRINTF(("%s: unsupported rate %u\n", __func__, rate)); + DPRINTF(("unsupported rate %u\n", rate)); return 0; } @@ -988,9 +987,9 @@ ieee80211_plcp2rate(u_int8_t plcp, enum ieee80211_phymode mode) 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; } diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index b238b2b22ee..2603b5d723f 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -1,4 +1,4 @@ -/* $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 @@ -68,6 +68,7 @@ void 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)) { @@ -77,10 +78,8 @@ ieee80211_amrr_choose(struct ieee80211_amrr *amrr, struct ieee80211_node *ni, 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 { @@ -100,10 +99,8 @@ ieee80211_amrr_choose(struct ieee80211_amrr *amrr, struct ieee80211_node *ni, 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; } @@ -112,4 +109,5 @@ ieee80211_amrr_choose(struct ieee80211_amrr *amrr, struct ieee80211_node *ni, if (is_enough(amn) || need_change) reset_cnt(amn); +#undef RV } diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 846c15eb94f..efd6c2163db 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $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 @@ -149,8 +149,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, /* 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; } @@ -158,8 +157,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, 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; } @@ -173,8 +171,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, * 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; } @@ -249,9 +246,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, 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; } @@ -280,9 +276,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, !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; } @@ -298,16 +293,14 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, !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); @@ -320,8 +313,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, 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, @@ -360,9 +352,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, #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; } @@ -370,8 +361,8 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, 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; } @@ -514,7 +505,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, 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; } @@ -571,7 +562,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m, int hdrlen) 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; } @@ -673,10 +664,7 @@ ieee80211_parse_edca_params_body(struct ieee80211com *ic, const u_int8_t *frm) 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; } @@ -686,10 +674,7 @@ ieee80211_parse_edca_params(struct ieee80211com *ic, const u_int8_t *frm) 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; } @@ -834,10 +819,7 @@ int 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; } @@ -848,10 +830,7 @@ int 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; } @@ -928,7 +907,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, /* 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; @@ -1009,8 +988,8 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, } 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; } @@ -1018,13 +997,12 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, } /* 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 ( @@ -1032,9 +1010,8 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, 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; } @@ -1051,9 +1028,8 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, * 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; } @@ -1103,8 +1079,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m0, * 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 && @@ -1254,25 +1229,24 @@ ieee80211_recv_probe_req(struct ieee80211com *ic, struct mbuf *m0, } /* 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; } @@ -1281,8 +1255,8 @@ ieee80211_recv_probe_req(struct ieee80211com *ic, struct mbuf *m0, 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; @@ -1290,8 +1264,8 @@ ieee80211_recv_probe_req(struct ieee80211com *ic, struct mbuf *m0, 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); @@ -1317,20 +1291,19 @@ ieee80211_recv_auth(struct ieee80211com *ic, struct mbuf *m0, /* 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 */ @@ -1379,12 +1352,12 @@ ieee80211_recv_assoc_req(struct ieee80211com *ic, struct mbuf *m0, /* 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; } @@ -1429,28 +1402,26 @@ ieee80211_recv_assoc_req(struct ieee80211com *ic, struct mbuf *m0, } /* 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) { @@ -1597,7 +1568,7 @@ ieee80211_recv_assoc_resp(struct ieee80211com *ic, struct mbuf *m0, /* 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; @@ -1646,16 +1617,15 @@ ieee80211_recv_assoc_resp(struct ieee80211com *ic, struct mbuf *m0, } /* 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; } @@ -1723,7 +1693,7 @@ ieee80211_recv_deauth(struct ieee80211com *ic, struct mbuf *m0, /* 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); @@ -1769,7 +1739,7 @@ ieee80211_recv_disassoc(struct ieee80211com *ic, struct mbuf *m0, /* 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); @@ -1846,8 +1816,8 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, 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; } diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index ffec5d3226f..9d8e129b793 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -267,7 +267,7 @@ ieee80211_next_scan(struct ifnet *ifp) } } 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; @@ -471,7 +471,7 @@ ieee80211_end_scan(struct ifnet *ifp) 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) && @@ -653,8 +653,7 @@ ieee80211_setup_node(struct ieee80211com *ic, { 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); @@ -878,7 +877,7 @@ ieee80211_find_rxnode(struct ieee80211com *ic, 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); @@ -914,7 +913,7 @@ ieee80211_free_node(struct ieee80211com *ic, struct ieee80211_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--; @@ -934,8 +933,8 @@ ieee80211_release_node(struct ieee80211com *ic, struct ieee80211_node *ni) { 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(); @@ -950,7 +949,7 @@ ieee80211_free_allnodes(struct ieee80211com *ic) 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); @@ -981,7 +980,7 @@ ieee80211_clean_nodes(struct ieee80211com *ic) 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. @@ -1033,9 +1032,9 @@ ieee80211_setup_rates(struct ieee80211com *ic, struct ieee80211_node *ni, 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); @@ -1077,7 +1076,7 @@ ieee80211_iserp_sta(const struct ieee80211_node *ni) 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)); @@ -1119,9 +1118,8 @@ ieee80211_node_join_11g(struct ieee80211com *ic, struct ieee80211_node *ni) 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)) { @@ -1130,14 +1128,13 @@ ieee80211_node_join_11g(struct ieee80211com *ic, struct ieee80211_node *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; } @@ -1179,9 +1176,8 @@ ieee80211_node_join(struct ieee80211com *ic, struct ieee80211_node *ni, } 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 */ @@ -1255,9 +1251,8 @@ ieee80211_node_leave_11g(struct ieee80211com *ic, struct ieee80211_node *ni) 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)) { @@ -1277,9 +1272,8 @@ ieee80211_node_leave_11g(struct ieee80211com *ic, struct ieee80211_node *ni) 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)); } } diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 875e95b64e3..7ed7b2b9d00 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -495,16 +495,16 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node **pni) 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; } @@ -1329,8 +1329,7 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni, 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 */ } @@ -1424,7 +1423,7 @@ ieee80211_beacon_alloc(struct ieee80211com *ic, struct ieee80211_node *ni) 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) + diff --git a/sys/net80211/ieee80211_pae_input.c b/sys/net80211/ieee80211_pae_input.c index c6d28080dd4..446185636c3 100644 --- a/sys/net80211/ieee80211_pae_input.c +++ b/sys/net80211/ieee80211_pae_input.c @@ -1,4 +1,4 @@ -/* $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 @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -35,7 +34,6 @@ #include #include #include -#include #endif #include @@ -238,8 +236,7 @@ ieee80211_recv_4way_msg2(struct ieee80211com *ic, /* 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; @@ -257,7 +254,7 @@ ieee80211_recv_4way_msg2(struct ieee80211com *ic, /* 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.. */ } @@ -317,8 +314,7 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, /* 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 */ @@ -334,7 +330,7 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, /* 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; } @@ -344,7 +340,7 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, /* 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; } @@ -396,12 +392,12 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, } /* 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; } /* @@ -495,8 +491,8 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, 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; } } @@ -522,8 +518,7 @@ ieee80211_recv_4way_msg4(struct ieee80211com *ic, /* 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; } @@ -531,7 +526,7 @@ ieee80211_recv_4way_msg4(struct ieee80211com *ic, /* 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.. */ } @@ -553,7 +548,7 @@ ieee80211_recv_4way_msg4(struct ieee80211com *ic, } } 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; } @@ -642,7 +637,7 @@ ieee80211_recv_rsn_group_msg1(struct ieee80211com *ic, } /* 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; } @@ -651,7 +646,7 @@ ieee80211_recv_rsn_group_msg1(struct ieee80211com *ic, /* 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; } @@ -680,8 +675,7 @@ ieee80211_recv_rsn_group_msg1(struct ieee80211com *ic, } /* 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; } @@ -704,8 +698,8 @@ ieee80211_recv_rsn_group_msg1(struct ieee80211com *ic, 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; } } @@ -742,7 +736,7 @@ ieee80211_recv_wpa_group_msg1(struct ieee80211com *ic, } /* 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; } @@ -751,7 +745,7 @@ ieee80211_recv_wpa_group_msg1(struct ieee80211com *ic, * 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); @@ -783,8 +777,8 @@ ieee80211_recv_wpa_group_msg1(struct ieee80211com *ic, 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; } } @@ -814,8 +808,7 @@ ieee80211_recv_group_msg2(struct ieee80211com *ic, /* 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) { @@ -824,7 +817,7 @@ ieee80211_recv_group_msg2(struct ieee80211com *ic, } /* 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; } @@ -871,7 +864,7 @@ ieee80211_recv_eapol_key_req(struct ieee80211com *ic, } 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; } @@ -883,8 +876,7 @@ ieee80211_recv_eapol_key_req(struct ieee80211com *ic, /* 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; } diff --git a/sys/net80211/ieee80211_pae_output.c b/sys/net80211/ieee80211_pae_output.c index 52f51e64bfa..78404227cec 100644 --- a/sys/net80211/ieee80211_pae_output.c +++ b/sys/net80211/ieee80211_pae_output.c @@ -1,4 +1,4 @@ -/* $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 @@ -134,8 +134,8 @@ ieee80211_eapol_timeout(void *arg) 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(); diff --git a/sys/net80211/ieee80211_priv.h b/sys/net80211/ieee80211_priv.h index cfc3ca779e0..7a8c6de5ba1 100644 --- a/sys/net80211/ieee80211_priv.h +++ b/sys/net80211/ieee80211_priv.h @@ -1,4 +1,4 @@ -/* $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 @@ -20,19 +20,22 @@ #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 */ diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 80ec125b082..14312051a32 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -441,8 +441,7 @@ ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, 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++; @@ -459,8 +458,7 @@ ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, 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++; @@ -492,8 +490,7 @@ ieee80211_auth_open(struct ieee80211com *ic, const struct ieee80211_frame *wh, 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; @@ -535,8 +532,8 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, 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) @@ -651,8 +648,7 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, 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, @@ -692,8 +688,7 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, 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, @@ -711,8 +706,7 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, 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 */