From 1e290df35345fbdb4da7834e2bc7c2c5a083b4a4 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Fri, 28 Dec 2012 20:50:28 +0100 Subject: [PATCH] kern - Utilize new way of printing MAC addresses. kether_aton() function is being used to return a buffer with the human readable notation of an ethernet address. --- sys/dev/atm/en/midway.c | 5 +- sys/dev/netif/acx/if_acx.c | 5 +- sys/dev/netif/ath/ath/if_ath.c | 24 ++--- sys/dev/netif/ath/hal/ah_osdep.c | 3 +- sys/dev/netif/ath/rate_amrr/amrr.c | 6 +- sys/dev/netif/ath/rate_onoe/onoe.c | 11 +-- sys/dev/netif/ath/rate_sample/sample.c | 10 ++- sys/dev/netif/bce/if_bce.c | 14 ++- sys/dev/netif/bwi/if_bwi.c | 3 +- sys/dev/netif/ed/if_ed.c | 7 +- sys/dev/netif/fe/if_fe.c | 12 ++- sys/dev/netif/iwi/if_iwi.c | 21 +++-- sys/dev/netif/iwl/iwl2100.c | 5 +- sys/dev/netif/iwn/if_iwn.c | 21 +++-- sys/dev/netif/ndis/if_ndis.c | 11 ++- sys/dev/netif/ral/rt2560.c | 6 +- sys/dev/netif/re/if_re.c | 10 ++- sys/dev/netif/rtw/rtw.c | 6 +- sys/dev/netif/rum/if_rum.c | 5 +- sys/dev/netif/ural/if_ural.c | 10 ++- sys/dev/netif/wi/if_wi.c | 10 ++- sys/net/ethernet.h | 5 ++ sys/net/if_ethersubr.c | 5 +- sys/netgraph/bridge/ng_bridge.c | 9 +- sys/netgraph/pppoe/ng_pppoe.c | 13 +-- sys/netgraph7/atm/ng_atm.c | 4 +- sys/netgraph7/bridge/ng_bridge.c | 6 +- sys/netproto/802_11/wlan/ieee80211_adhoc.c | 10 ++- sys/netproto/802_11/wlan/ieee80211_crypto.c | 5 +- sys/netproto/802_11/wlan/ieee80211_ddb.c | 24 +++-- sys/netproto/802_11/wlan/ieee80211_hostap.c | 14 +-- sys/netproto/802_11/wlan/ieee80211_ht.c | 15 ++-- sys/netproto/802_11/wlan/ieee80211_hwmp.c | 89 ++++++++++--------- sys/netproto/802_11/wlan/ieee80211_input.c | 27 +++--- sys/netproto/802_11/wlan/ieee80211_mesh.c | 35 +++++--- sys/netproto/802_11/wlan/ieee80211_node.c | 80 ++++++++++------- sys/netproto/802_11/wlan/ieee80211_output.c | 31 ++++--- sys/netproto/802_11/wlan/ieee80211_proto.c | 27 +++--- sys/netproto/802_11/wlan/ieee80211_scan.c | 9 +- sys/netproto/802_11/wlan/ieee80211_scan_sta.c | 7 +- sys/netproto/802_11/wlan/ieee80211_sta.c | 15 ++-- sys/netproto/802_11/wlan/ieee80211_wds.c | 24 ++--- sys/netproto/802_11/wlan_acl/ieee80211_acl.c | 12 +-- 43 files changed, 402 insertions(+), 269 deletions(-) diff --git a/sys/dev/atm/en/midway.c b/sys/dev/atm/en/midway.c index ee0ddde2be..ff6819344b 100644 --- a/sys/dev/atm/en/midway.c +++ b/sys/dev/atm/en/midway.c @@ -601,6 +601,7 @@ void en_attach(struct en_softc *sc) { struct ifnet *ifp = &sc->enif; + char ethstr[ETHER_ADDRSTRLEN + 1]; int sz; u_int32_t reg, lcv, check, ptr, sav, midvloc; @@ -757,8 +758,8 @@ done_probe: kprintf("%s: %d %dKB receive buffers, %d %dKB transmit buffers allocated\n", sc->sc_dev.dv_xname, sc->en_nrx, EN_RXSZ, EN_NTX, EN_TXSZ); - kprintf("%s: End Station Identifier (mac address) %6D\n", - sc->sc_dev.dv_xname, sc->macaddr, ":"); + kprintf("%s: End Station Identifier (mac address) %s\n", + sc->sc_dev.dv_xname, kether_ntoa(sc->macaddr, ethstr)); /* * final commit diff --git a/sys/dev/netif/acx/if_acx.c b/sys/dev/netif/acx/if_acx.c index 269131d7d8..d0f7af5751 100644 --- a/sys/dev/netif/acx/if_acx.c +++ b/sys/dev/netif/acx/if_acx.c @@ -876,6 +876,7 @@ acx_read_config(struct acx_softc *sc, struct acx_config *conf) struct acx_conf_regdom reg_dom; struct acx_conf_antenna ant; struct acx_conf_fwrev fw_rev; + char ethstr[ETHER_ADDRSTRLEN + 1]; uint32_t fw_rev_no; uint8_t sen; int i, error; @@ -892,8 +893,8 @@ acx_read_config(struct acx_softc *sc, struct acx_config *conf) */ for (i = 0; i < IEEE80211_ADDR_LEN; ++i) conf->eaddr[IEEE80211_ADDR_LEN - 1 - i] = addr.eaddr[i]; - if_printf(&sc->sc_ic.ic_if, "MAC address (from firmware): %6D\n", - conf->eaddr, ":"); + if_printf(&sc->sc_ic.ic_if, "MAC address (from firmware): %s\n", + kether_ntoa(conf->eaddr, ethstr)); /* Get region domain */ if (acx_get_regdom_conf(sc, ®_dom) != 0) { diff --git a/sys/dev/netif/ath/ath/if_ath.c b/sys/dev/netif/ath/ath/if_ath.c index 92cb46f534..058c2e91f3 100644 --- a/sys/dev/netif/ath/ath/if_ath.c +++ b/sys/dev/netif/ath/ath/if_ath.c @@ -1922,12 +1922,13 @@ ath_keyprint(struct ath_softc *sc, const char *tag, u_int ix, "TKIP", "CLR", }; + char ethstr[ETHER_ADDRSTRLEN + 1]; int i, n; kprintf("%s: [%02u] %-7s ", tag, ix, ciphers[hk->kv_type]); for (i = 0, n = hk->kv_len; i < n; i++) kprintf("%02x", hk->kv_val[i]); - kprintf(" mac %6D", mac, ":"); + kprintf(" mac %s", kether_ntoa(mac, ethstr)); if (hk->kv_type == HAL_CIPHER_TKIP) { kprintf(" %s ", sc->sc_splitmic ? "mic" : "rxmic"); for (i = 0; i < sizeof(hk->kv_mic); i++) @@ -5474,6 +5475,7 @@ ath_scan_start(struct ieee80211com *ic) struct ifnet *ifp = ic->ic_ifp; struct ath_softc *sc = ifp->if_softc; struct ath_hal *ah = sc->sc_ah; + char ethstr[ETHER_ADDRSTRLEN + 1]; u_int32_t rfilt; /* XXX calibration timer? */ @@ -5484,8 +5486,8 @@ ath_scan_start(struct ieee80211com *ic) ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, ifp->if_broadcastaddr, 0); - DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %6D aid 0\n", - __func__, rfilt, ifp->if_broadcastaddr, ":"); + DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0\n", + __func__, rfilt, kether_ntoa(ifp->if_broadcastaddr, ethstr)); } static void @@ -5494,6 +5496,7 @@ ath_scan_end(struct ieee80211com *ic) struct ifnet *ifp = ic->ic_ifp; struct ath_softc *sc = ifp->if_softc; struct ath_hal *ah = sc->sc_ah; + char ethstr[ETHER_ADDRSTRLEN + 1]; u_int32_t rfilt; sc->sc_scanning = 0; @@ -5503,9 +5506,9 @@ ath_scan_end(struct ieee80211com *ic) ath_hal_process_noisefloor(ah); - DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %6D aid 0x%x\n", - __func__, rfilt, sc->sc_curbssid, ":", - sc->sc_curaid); + DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0x%x\n", + __func__, rfilt, kether_ntoa(sc->sc_curbssid, ethstr), + sc->sc_curaid); } static void @@ -5551,6 +5554,7 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211_node *ni = NULL; int i, error, stamode; u_int32_t rfilt; + char ethstr[ETHER_ADDRSTRLEN + 1]; static const HAL_LED_STATE leds[] = { HAL_LED_INIT, /* IEEE80211_S_INIT */ HAL_LED_SCAN, /* IEEE80211_S_SCAN */ @@ -5593,8 +5597,8 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) IEEE80211_ADDR_COPY(sc->sc_curbssid, ni->ni_bssid); ath_hal_setassocid(ah, sc->sc_curbssid, sc->sc_curaid); } - DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %6D aid 0x%x\n", - __func__, rfilt, sc->sc_curbssid, ":", sc->sc_curaid); + DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0x%x\n", + __func__, rfilt, kether_ntoa(sc->sc_curbssid, ethstr), sc->sc_curaid); ath_hal_setrxfilter(ah, rfilt); /* XXX is this to restore keycache on resume? */ @@ -5617,9 +5621,9 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) ni = vap->iv_bss; DPRINTF(sc, ATH_DEBUG_STATE, - "%s(RUN): iv_flags 0x%08x bintvl %d bssid %6D " + "%s(RUN): iv_flags 0x%08x bintvl %d bssid %s " "capinfo 0x%04x chan %d\n", __func__, - vap->iv_flags, ni->ni_intval, ni->ni_bssid, ":", + vap->iv_flags, ni->ni_intval, kether_ntoa(ni->ni_bssid, ethstr), ni->ni_capinfo, ieee80211_chan2ieee(ic, ic->ic_curchan)); switch (vap->iv_opmode) { diff --git a/sys/dev/netif/ath/hal/ah_osdep.c b/sys/dev/netif/ath/hal/ah_osdep.c index d105d39f25..265f82617f 100644 --- a/sys/dev/netif/ath/hal/ah_osdep.c +++ b/sys/dev/netif/ath/hal/ah_osdep.c @@ -137,7 +137,8 @@ ath_hal_ether_sprintf(const u_int8_t *mac) { static char etherbuf[18]; - ksnprintf(etherbuf, sizeof(etherbuf), "%6D", mac, ":"); + kether_ntoa(mac, etherbuf); + return etherbuf; } diff --git a/sys/dev/netif/ath/rate_amrr/amrr.c b/sys/dev/netif/ath/rate_amrr/amrr.c index 597ac434ac..0e5238bf2d 100644 --- a/sys/dev/netif/ath/rate_amrr/amrr.c +++ b/sys/dev/netif/ath/rate_amrr/amrr.c @@ -35,7 +35,6 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.12 2006/12/13 19:34:34 sam Exp $ - * $DragonFly: src/sys/dev/netif/ath/rate_amrr/amrr.c,v 1.5 2007/02/22 05:17:09 sephe Exp $ */ /* @@ -190,12 +189,13 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) struct ath_node *an = ATH_NODE(ni); struct amrr_node *amn = ATH_NODE_AMRR(an); const HAL_RATE_TABLE *rt = sc->sc_currates; + char ethstr[ETHER_ADDRSTRLEN + 1]; uint8_t rix; KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); - DPRINTF(sc, "%s: set xmit rate for %6D to %dM\n", - __func__, ni->ni_macaddr, ":", + DPRINTF(sc, "%s: set xmit rate for %s to %dM\n", + __func__, kether_ntoa(ni->ni_macaddr, ethstr), ni->ni_rates.rs_nrates > 0 ? (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0); diff --git a/sys/dev/netif/ath/rate_onoe/onoe.c b/sys/dev/netif/ath/rate_onoe/onoe.c index afdcb732f7..1699a3205b 100644 --- a/sys/dev/netif/ath/rate_onoe/onoe.c +++ b/sys/dev/netif/ath/rate_onoe/onoe.c @@ -34,7 +34,6 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.12 2006/12/13 19:34:35 sam Exp $ - * $DragonFly: src/sys/dev/netif/ath/rate_onoe/onoe.c,v 1.5 2007/02/22 05:17:09 sephe Exp $ */ /* @@ -175,12 +174,13 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate) struct ath_node *an = ATH_NODE(ni); struct onoe_node *on = ATH_NODE_ONOE(an); const HAL_RATE_TABLE *rt = sc->sc_currates; + char ethstr[ETHER_ADDRSTRLEN + 1]; uint8_t rix; KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); - DPRINTF(sc, "%s: set xmit rate for %6D to %dM\n", - __func__, ni->ni_macaddr, ":", + DPRINTF(sc, "%s: set xmit rate for %s to %dM\n", + __func__, kether_ntoa(ni->ni_macaddr, ethstr), ni->ni_rates.rs_nrates > 0 ? (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0); @@ -365,6 +365,7 @@ ath_rate_ctl(void *arg, struct ieee80211_node *ni) struct ath_softc *sc = arg; struct onoe_node *on = ATH_NODE_ONOE(ATH_NODE(ni)); struct ieee80211_rateset *rs = &ni->ni_rates; + char ethstr[ETHER_ADDRSTRLEN + 1]; int dir = 0, nrate, enough; /* @@ -386,8 +387,8 @@ ath_rate_ctl(void *arg, struct ieee80211_node *ni) on->on_tx_retr < (on->on_tx_ok * ath_rate_raise) / 100) dir = 1; - DPRINTF(sc, "%6D: ok %d err %d retr %d upper %d dir %d\n", - ni->ni_macaddr, ":", + DPRINTF(sc, "%s: ok %d err %d retr %d upper %d dir %d\n", + kether_ntoa(ni->ni_macaddr, ethstr), on->on_tx_ok, on->on_tx_err, on->on_tx_retr, on->on_tx_upper, dir); diff --git a/sys/dev/netif/ath/rate_sample/sample.c b/sys/dev/netif/ath/rate_sample/sample.c index d315c83bc4..1a48251129 100644 --- a/sys/dev/netif/ath/rate_sample/sample.c +++ b/sys/dev/netif/ath/rate_sample/sample.c @@ -736,6 +736,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni) const struct ieee80211_txparam *tp = ni->ni_txparms; struct sample_node *sn = ATH_NODE_SAMPLE(an); const HAL_RATE_TABLE *rt = sc->sc_currates; + char ethstr[ETHER_ADDRSTRLEN + 1]; int x, y, srate, rix; KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); @@ -793,8 +794,8 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni) if (ieee80211_msg(ni->ni_vap, IEEE80211_MSG_RATECTL)) { uint32_t mask; - ieee80211_note(ni->ni_vap, "[%6D] %s: size 1600 rate/tt", - ni->ni_macaddr, ":", __func__); + ieee80211_note(ni->ni_vap, "[%s] %s: size 1600 rate/tt", + kether_ntoa(ni->ni_macaddr, ethstr), __func__); for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) { if ((mask & 1) == 0) continue; @@ -859,11 +860,12 @@ sample_stats(void *arg, struct ieee80211_node *ni) struct ath_softc *sc = arg; const HAL_RATE_TABLE *rt = sc->sc_currates; struct sample_node *sn = ATH_NODE_SAMPLE(ATH_NODE(ni)); + char ethstr[ETHER_ADDRSTRLEN + 1]; uint32_t mask; int rix, y; - kprintf("\n[%6D] refcnt %d static_rix %d ratemask 0x%x\n", - ni->ni_macaddr, ":", ieee80211_node_refcnt(ni), + kprintf("\n[%s] refcnt %d static_rix %d ratemask 0x%x\n", + kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni), sn->static_rix, sn->ratemask); for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { kprintf("[%4u] cur rix %d since switch: packets %d ticks %u\n", diff --git a/sys/dev/netif/bce/if_bce.c b/sys/dev/netif/bce/if_bce.c index 952fa9f371..de87515b23 100644 --- a/sys/dev/netif/bce/if_bce.c +++ b/sys/dev/netif/bce/if_bce.c @@ -3410,7 +3410,9 @@ static void bce_get_mac_addr(struct bce_softc *sc) { uint32_t mac_lo = 0, mac_hi = 0; - +#ifdef BCE_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif /* * The NetXtreme II bootcode populates various NIC * power-on and runtime configuration items in a @@ -3434,7 +3436,8 @@ bce_get_mac_addr(struct bce_softc *sc) sc->eaddr[5] = (u_char)(mac_lo >> 0); } - DBPRINT(sc, BCE_INFO, "Permanent Ethernet address = %6D\n", sc->eaddr, ":"); + DBPRINT(sc, BCE_INFO, "Permanent Ethernet address = %s\n", + kether_ntoa(sc->eaddr, ethstr)); } @@ -3448,10 +3451,13 @@ static void bce_set_mac_addr(struct bce_softc *sc) { const uint8_t *mac_addr = sc->eaddr; +#ifdef BCE_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif uint32_t val; - DBPRINT(sc, BCE_INFO, "Setting Ethernet address = %6D\n", - sc->eaddr, ":"); + DBPRINT(sc, BCE_INFO, "Setting Ethernet address = %s\n", + kether_ntoa(sc->eaddr, ethstr)); val = (mac_addr[0] << 8) | mac_addr[1]; REG_WR(sc, BCE_EMAC_MAC_MATCH0, val); diff --git a/sys/dev/netif/bwi/if_bwi.c b/sys/dev/netif/bwi/if_bwi.c index 6e2b077bce..08b725e3f8 100644 --- a/sys/dev/netif/bwi/if_bwi.c +++ b/sys/dev/netif/bwi/if_bwi.c @@ -532,6 +532,7 @@ bwi_attach(device_t dev) struct ifnet *ifp = &ic->ic_if; struct bwi_mac *mac; struct bwi_phy *phy; + char ethstr[ETHER_ADDRSTRLEN + 1]; int i, error; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); @@ -754,7 +755,7 @@ bwi_attach(device_t dev) bwi_get_eaddr(sc, BWI_SPROM_11A_EADDR, ic->ic_myaddr); if (IEEE80211_IS_MULTICAST(ic->ic_myaddr)) { device_printf(dev, "invalid MAC address: " - "%6D\n", ic->ic_myaddr, ":"); + "%s\n", kether_ntoa(ic->ic_myaddr, ethstr)); } } } else if (phy->phy_mode == IEEE80211_MODE_11A) { diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c index 50196e6290..c34e4c4463 100644 --- a/sys/dev/netif/ed/if_ed.c +++ b/sys/dev/netif/ed/if_ed.c @@ -916,6 +916,9 @@ ed_probe_SIC(device_t dev, int port_rid, int flags) u_int memsize; u_long conf_maddr, conf_msize; u_char sum; +#ifdef ED_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif error = ed_alloc_port(dev, 0, ED_SIC_IO_PORTS); if (error) @@ -957,8 +960,8 @@ ed_probe_SIC(device_t dev, int port_rid, int flags) sum ^= (sc->arpcom.ac_enaddr[i] = sc->mem_start[i]); } #ifdef ED_DEBUG - device_printf(dev, "ed_probe_sic: got address %6D\n", - sc->arpcom.ac_enaddr, ":"); + device_printf(dev, "ed_probe_sic: got address %s\n", + kether_ntoa(sc->arpcom.ac_enaddr, ethestr)); #endif if (sum != 0) { return (ENXIO); diff --git a/sys/dev/netif/fe/if_fe.c b/sys/dev/netif/fe/if_fe.c index e90df0feb7..63b9c3175c 100644 --- a/sys/dev/netif/fe/if_fe.c +++ b/sys/dev/netif/fe/if_fe.c @@ -248,7 +248,9 @@ int valid_Ether_p (u_char const * addr, unsigned vendor) { #ifdef FE_DEBUG - kprintf("fe?: validating %6D against %06x\n", addr, ":", vendor); + char ethstr[ETHER_ADDRSTRLEN + 1]; + kprintf("fe?: validating %s against %06x\n", kether_ntoa(addr, ethstr), + vendor); #endif /* All zero is not allowed as a vendor code. */ @@ -2077,15 +2079,17 @@ fe_mcaf ( struct fe_softc *sc ) int index; struct fe_filter filter; struct ifmultiaddr *ifma; - +#ifdef FE_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif filter = fe_filter_nothing; TAILQ_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = fe_hash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); #ifdef FE_DEBUG - kprintf("fe%d: hash(%6D) == %d\n", - sc->sc_unit, enm->enm_addrlo , ":", index); + kprintf("fe%d: hash(%s) == %d\n", + sc->sc_unit, kether_ntoa(enm->enm_addrlo, ethstr), index); #endif filter.data[index >> 3] |= 1 << (index & 7); diff --git a/sys/dev/netif/iwi/if_iwi.c b/sys/dev/netif/iwi/if_iwi.c index 602a5ba7bc..2d34c02fad 100644 --- a/sys/dev/netif/iwi/if_iwi.c +++ b/sys/dev/netif/iwi/if_iwi.c @@ -902,10 +902,11 @@ iwi_node_free(struct ieee80211_node *ni) struct ieee80211com *ic = ni->ni_ic; struct iwi_softc *sc = ic->ic_ifp->if_softc; struct iwi_node *in = (struct iwi_node *)ni; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (in->in_station != -1) { - DPRINTF(("%s mac %6D station %u\n", __func__, - ni->ni_macaddr, ":", in->in_station)); + DPRINTF(("%s mac %s station %u\n", __func__, + kether_ntoa(ni->ni_macaddr, ethstr), in->in_station)); devfs_clone_bitmap_put(&sc->sc_unr, in->in_station); } @@ -1735,12 +1736,13 @@ iwi_write_ibssnode(struct iwi_softc *sc, const u_int8_t addr[IEEE80211_ADDR_LEN], int entry) { struct iwi_ibssnode node; + char ethstr[ETHER_ADDRSTRLEN + 1]; /* write node information into NIC memory */ memset(&node, 0, sizeof node); IEEE80211_ADDR_COPY(node.bssid, addr); - DPRINTF(("%s mac %6D station %u\n", __func__, node.bssid, ":", entry)); + DPRINTF(("%s mac %s station %u\n", __func__, kether_ntoa(node.bssid, ethstr), entry)); CSR_WRITE_REGION_1(sc, IWI_CSR_NODE_BASE + entry * sizeof node, @@ -2536,8 +2538,9 @@ iwi_config(struct iwi_softc *sc) uint32_t data; int error, i; const uint8_t *eaddr = IF_LLADDR(ifp); + char ethstr[ETHER_ADDRSTRLEN + 1]; - DPRINTF(("Setting MAC address to %6D\n", eaddr, ":")); + DPRINTF(("Setting MAC address to %s\n", kether_ntoa(eaddr, ethstr))); error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, IF_LLADDR(ifp), IEEE80211_ADDR_LEN); if (error != 0) @@ -2779,6 +2782,7 @@ iwi_auth_and_assoc(struct iwi_softc *sc, struct ieee80211vap *vap) uint16_t capinfo; uint32_t data; int error, mode; + char ethstr[2][ETHER_ADDRSTRLEN + 1]; if (sc->flags & IWI_FLAG_ASSOCIATED) { DPRINTF(("Already associated\n")); @@ -2929,10 +2933,10 @@ iwi_auth_and_assoc(struct iwi_softc *sc, struct ieee80211vap *vap) else IEEE80211_ADDR_COPY(assoc->dst, ni->ni_bssid); - DPRINTF(("%s bssid %6D dst %6D channel %u policy 0x%x " + DPRINTF(("%s bssid %s dst %s channel %u policy 0x%x " "auth %u capinfo 0x%x lintval %u bintval %u\n", assoc->type == IWI_HC_IBSS_START ? "Start" : "Join", - assoc->bssid, ":", assoc->dst, ":", + kether_ntoa(assoc->bssid, ethstr[0]), kether_ntoa(assoc->dst, ethstr[1]), assoc->chan, le16toh(assoc->policy), assoc->auth, le16toh(assoc->capinfo), le16toh(assoc->lintval), le16toh(assoc->intval))); @@ -2958,6 +2962,7 @@ static int iwi_disassociate(struct iwi_softc *sc, int quiet) { struct iwi_associate *assoc = &sc->assoc; + char ethstr[ETHER_ADDRSTRLEN + 1]; if ((sc->flags & IWI_FLAG_ASSOCIATED) == 0) { DPRINTF(("Not associated\n")); @@ -2971,8 +2976,8 @@ iwi_disassociate(struct iwi_softc *sc, int quiet) else assoc->type = IWI_HC_DISASSOC; - DPRINTF(("Trying to disassociate from %6D channel %u\n", - assoc->bssid, ":", assoc->chan)); + DPRINTF(("Trying to disassociate from %s channel %u\n", + kether_ntoa(assoc->bssid, ethstr), assoc->chan)); return iwi_cmd(sc, IWI_CMD_ASSOCIATE, assoc, sizeof *assoc); } diff --git a/sys/dev/netif/iwl/iwl2100.c b/sys/dev/netif/iwl/iwl2100.c index e2348a404c..86be329b93 100644 --- a/sys/dev/netif/iwl/iwl2100.c +++ b/sys/dev/netif/iwl/iwl2100.c @@ -3566,6 +3566,7 @@ iwl2100_ibss_bssid(void *xsc) struct iwl2100_softc *sc = xsc; struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; + char ethstr[ETHER_ADDRSTRLEN + 1]; lwkt_serialize_enter(ifp->if_serializer); @@ -3585,8 +3586,8 @@ iwl2100_ibss_bssid(void *xsc) if (len < (int)sizeof(bssid)) { if_printf(ifp, "can't get IBSS bssid\n"); } else { - DPRINTF(sc, IWL2100_DBG_IBSS, "IBSS bssid: %6D\n", - bssid, ":"); + DPRINTF(sc, IWL2100_DBG_IBSS, "IBSS bssid: %s\n", + kether_ntoa(bssid, ethstr)); IEEE80211_ADDR_COPY(ic->ic_bss->ni_bssid, bssid); sc->sc_flags |= IWL2100_F_IFSTART; diff --git a/sys/dev/netif/iwn/if_iwn.c b/sys/dev/netif/iwn/if_iwn.c index fa62129a49..934ad2ba44 100644 --- a/sys/dev/netif/iwn/if_iwn.c +++ b/sys/dev/netif/iwn/if_iwn.c @@ -23,8 +23,6 @@ * adapters. */ -/* $FreeBSD$ */ - #include #include #include @@ -412,6 +410,7 @@ iwn_pci_attach(device_t dev) int result; #endif uint8_t macaddr[IEEE80211_ADDR_LEN]; + char ethstr[ETHER_ADDRSTRLEN + 1]; wlan_serialize_enter(); @@ -642,9 +641,9 @@ iwn_pci_attach(device_t dev) goto fail; } - device_printf(sc->sc_dev, "MIMO %dT%dR, %.4s, address %6D\n", + device_printf(sc->sc_dev, "MIMO %dT%dR, %.4s, address %s\n", sc->ntxchains, sc->nrxchains, sc->eeprom_domain, - macaddr, ":"); + kether_ntoa(macaddr, ethstr)); #if 0 /* HT */ /* Set supported HT rates. */ @@ -4790,6 +4789,7 @@ iwn_auth(struct iwn_softc *sc, struct ieee80211vap *vap) struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211_node *ni = vap->iv_bss; + char ethstr[3][ETHER_ADDRSTRLEN + 1]; int error; sc->calib.state = IWN_CALIB_STATE_INIT; @@ -4818,13 +4818,15 @@ iwn_auth(struct iwn_softc *sc, struct ieee80211vap *vap) DPRINTF(sc, IWN_DEBUG_STATE, "%s: config chan %d mode %d flags 0x%x cck 0x%x ofdm 0x%x " "ht_single 0x%x ht_dual 0x%x rxchain 0x%x " - "myaddr %6D wlap %6D bssid %6D associd %d filter 0x%x\n", + "myaddr %s wlap %s bssid %s associd %d filter 0x%x\n", __func__, le16toh(sc->rxon.chan), sc->rxon.mode, le32toh(sc->rxon.flags), sc->rxon.cck_mask, sc->rxon.ofdm_mask, sc->rxon.ht_single_mask, sc->rxon.ht_dual_mask, le16toh(sc->rxon.rxchain), - sc->rxon.myaddr, ":", sc->rxon.wlap, ":", sc->rxon.bssid, ":", + kether_ntoa(sc->rxon.myaddr, ethstr[0]), + kether_ntoa(sc->rxon.wlap, ethstr[1]), + kether_ntoa(sc->rxon.bssid, ethstr[2]), le16toh(sc->rxon.associd), le32toh(sc->rxon.filter)); error = iwn_cmd(sc, IWN_CMD_RXON, &sc->rxon, hal->rxonsz, 1); if (error != 0) { @@ -4866,6 +4868,7 @@ iwn_run(struct iwn_softc *sc, struct ieee80211vap *vap) struct ieee80211com *ic = ifp->if_l2com; struct ieee80211_node *ni = vap->iv_bss; struct iwn_node_info node; + char ethstr[3][ETHER_ADDRSTRLEN + 1]; int error; sc->calib.state = IWN_CALIB_STATE_INIT; @@ -4933,13 +4936,15 @@ iwn_run(struct iwn_softc *sc, struct ieee80211vap *vap) DPRINTF(sc, IWN_DEBUG_STATE, "%s: config chan %d mode %d flags 0x%x cck 0x%x ofdm 0x%x " "ht_single 0x%x ht_dual 0x%x rxchain 0x%x " - "myaddr %6D wlap %6D bssid %6D associd %d filter 0x%x\n", + "myaddr %s wlap %s bssid %s associd %d filter 0x%x\n", __func__, le16toh(sc->rxon.chan), sc->rxon.mode, le32toh(sc->rxon.flags), sc->rxon.cck_mask, sc->rxon.ofdm_mask, sc->rxon.ht_single_mask, sc->rxon.ht_dual_mask, le16toh(sc->rxon.rxchain), - sc->rxon.myaddr, ":", sc->rxon.wlap, ":", sc->rxon.bssid, ":", + kether_ntoa(sc->rxon.myaddr, ethstr[0]), + kether_ntoa(sc->rxon.wlap, ethstr[1]), + kether_ntoa(sc->rxon.bssid, ethstr[2]), le16toh(sc->rxon.associd), le32toh(sc->rxon.filter)); error = iwn_cmd(sc, IWN_CMD_RXON, &sc->rxon, hal->rxonsz, 1); if (error != 0) { diff --git a/sys/dev/netif/ndis/if_ndis.c b/sys/dev/netif/ndis/if_ndis.c index 8a2d303174..6751a0e96e 100644 --- a/sys/dev/netif/ndis/if_ndis.c +++ b/sys/dev/netif/ndis/if_ndis.c @@ -2242,6 +2242,7 @@ ndis_setstate_80211(struct ndis_softc *sc) int rval = 0, len; uint32_t arg; struct ifnet *ifp; + char ethstr[ETHER_ADDRSTRLEN + 1]; ifp = sc->ifp; ic = ifp->if_l2com; @@ -2349,7 +2350,7 @@ ndis_setstate_80211(struct ndis_softc *sc) /* Set the BSSID to our value so the driver doesn't associate */ len = IEEE80211_ADDR_LEN; bcopy(IF_LLADDR(ifp), bssid, len); - DPRINTF(("Setting BSSID to %6D\n", (uint8_t *)&bssid, ":")); + DPRINTF(("Setting BSSID to %s\n", kether_ntoa((uint8_t *)&bssid, ethstr))); rval = ndis_set_info(sc, OID_802_11_BSSID, &bssid, &len); if (rval) device_printf(sc->ndis_dev, @@ -2366,6 +2367,7 @@ ndis_auth_and_assoc(struct ndis_softc *sc, struct ieee80211vap *vap) int i, rval = 0, len, error; uint32_t arg; struct ifnet *ifp; + char ethstr[ETHER_ADDRSTRLEN + 1]; ifp = sc->ifp; ni = vap->iv_bss; @@ -2537,7 +2539,7 @@ ndis_auth_and_assoc(struct ndis_softc *sc, struct ieee80211vap *vap) else bcopy(ifp->if_broadcastaddr, bssid, len); - DPRINTF(("Setting BSSID to %6D\n", (uint8_t *)&bssid, ":")); + DPRINTF(("Setting BSSID to %s\n", kether_ntoa((uint8_t *)&bssid, ethstr))); rval = ndis_set_info(sc, OID_802_11_BSSID, &bssid, &len); if (rval) device_printf(sc->ndis_dev, @@ -3209,6 +3211,7 @@ ndis_scan_results(struct ndis_softc *sc) uint8_t ssid[2+IEEE80211_NWID_LEN]; uint8_t rates[2+IEEE80211_RATE_MAXSIZE]; uint8_t *frm, *efrm; + char ethstr[ETHER_ADDRSTRLEN + 1]; ic = sc->ifp->if_l2com; vap = TAILQ_FIRST(&ic->ic_vaps); @@ -3273,8 +3276,8 @@ ndis_scan_results(struct ndis_softc *sc) sp.ies_len = efrm - frm; } done: - DPRINTF(("scan: bssid %6D chan %dMHz (%d/%d) rssi %d\n", - wb->nwbx_macaddr, ":", freq, sp.bchan, chanflag, + DPRINTF(("scan: bssid %s chan %dMHz (%d/%d) rssi %d\n", + kether_ntoa(wb->nwbx_macaddr, ethstr), freq, sp.bchan, chanflag, rssi)); ieee80211_add_scan(vap, &sp, &wh, 0, rssi, noise); wb = (ndis_wlan_bssid_ex *)((char *)wb + wb->nwbx_len); diff --git a/sys/dev/netif/ral/rt2560.c b/sys/dev/netif/ral/rt2560.c index a3a58ed4d0..1c379a20aa 100644 --- a/sys/dev/netif/ral/rt2560.c +++ b/sys/dev/netif/ral/rt2560.c @@ -2370,6 +2370,7 @@ static void rt2560_set_bssid(struct rt2560_softc *sc, const uint8_t *bssid) { uint32_t tmp; + char ethstr[ETHER_ADDRSTRLEN + 1]; tmp = bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24; RAL_WRITE(sc, RT2560_CSR5, tmp); @@ -2377,13 +2378,14 @@ rt2560_set_bssid(struct rt2560_softc *sc, const uint8_t *bssid) tmp = bssid[4] | bssid[5] << 8; RAL_WRITE(sc, RT2560_CSR6, tmp); - DPRINTF(sc, "setting BSSID to %6D\n", bssid, ":"); + DPRINTF(sc, "setting BSSID to %s\n", kether_ntoa(bssid, ethstr)); } static void rt2560_set_macaddr(struct rt2560_softc *sc, uint8_t *addr) { uint32_t tmp; + char ethstr[ETHER_ADDRSTRLEN + 1]; tmp = addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24; RAL_WRITE(sc, RT2560_CSR3, tmp); @@ -2391,7 +2393,7 @@ rt2560_set_macaddr(struct rt2560_softc *sc, uint8_t *addr) tmp = addr[4] | addr[5] << 8; RAL_WRITE(sc, RT2560_CSR4, tmp); - DPRINTF(sc, "setting MAC address to %6D\n", addr, ":"); + DPRINTF(sc, "setting MAC address to %s\n", kether_ntoa(addr, ethstr)); } static void diff --git a/sys/dev/netif/re/if_re.c b/sys/dev/netif/re/if_re.c index 6999abd23f..8094865c41 100644 --- a/sys/dev/netif/re/if_re.c +++ b/sys/dev/netif/re/if_re.c @@ -789,6 +789,7 @@ re_diag(struct re_softc *sc) int total_len, i, error = 0, phyaddr; uint8_t dst[ETHER_ADDR_LEN] = { 0x00, 'h', 'e', 'l', 'l', 'o' }; uint8_t src[ETHER_ADDR_LEN] = { 0x00, 'w', 'o', 'r', 'l', 'd' }; + char ethstr[2][ETHER_ADDRSTRLEN + 1]; /* Allocate a single mbuf */ @@ -895,10 +896,11 @@ re_diag(struct re_softc *sc) bcmp(eh->ether_shost, &src, ETHER_ADDR_LEN) || be16toh(eh->ether_type) != ETHERTYPE_IP) { if_printf(ifp, "WARNING, DMA FAILURE!\n"); - if_printf(ifp, "expected TX data: %6D/%6D/0x%x\n", - dst, ":", src, ":", ETHERTYPE_IP); - if_printf(ifp, "received RX data: %6D/%6D/0x%x\n", - eh->ether_dhost, ":", eh->ether_shost, ":", + if_printf(ifp, "expected TX data: %s/%s/0x%x\n", + kether_ntoa(dst, ethstr[0]), kether_ntoa(src, ethstr[1]), ETHERTYPE_IP); + if_printf(ifp, "received RX data: %s/%s/0x%x\n", + kether_ntoa(eh->ether_dhost, ethstr[0]), + kether_ntoa(eh->ether_shost, ethstr[1]), ntohs(eh->ether_type)); if_printf(ifp, "You may have a defective 32-bit NIC plugged " "into a 64-bit PCI slot.\n"); diff --git a/sys/dev/netif/rtw/rtw.c b/sys/dev/netif/rtw/rtw.c index d3226741c2..fa87fb9a89 100644 --- a/sys/dev/netif/rtw/rtw.c +++ b/sys/dev/netif/rtw/rtw.c @@ -787,6 +787,7 @@ rtw_srom_parse(struct rtw_softc *sc) uint8_t mac[IEEE80211_ADDR_LEN]; const char *rfname, *paname; uint16_t srom_version; + char ethstr[ETHER_ADDRSTRLEN + 1]; int i; sc->sc_flags &= ~(RTW_F_DIGPHY | RTW_F_DFLANTB | RTW_F_ANTDIV); @@ -812,7 +813,7 @@ rtw_srom_parse(struct rtw_softc *sc) mac[i] = RTW_SR_GET(sr, RTW_SR_MAC + i); RTW_DPRINTF(RTW_DEBUG_ATTACH, - ("%s: EEPROM MAC %6D\n", sc->sc_ic.ic_if.if_xname, mac, ":")); + ("%s: EEPROM MAC %s\n", sc->sc_ic.ic_if.if_xname, kether_addr(mac, ethstr))); sc->sc_csthr = RTW_SR_GET(sr, RTW_SR_ENERGYDETTHR); @@ -3608,10 +3609,11 @@ rtw_node_free(struct ieee80211_node *ni) struct ieee80211com *ic = ni->ni_ic; struct ifnet *ifp = ic->ic_ifp; struct rtw_softc *sc = (struct rtw_softc *)ifp->if_softc; + char ethstr[ETHER_ADDRSTRLEN + 1]; DPRINTF(sc, RTW_DEBUG_NODE, ("%s: freeing node %p %s\n", sc->sc_dev.dv_xname, ni, - ether_sprintf(ni->ni_bssid))); + kether_ntoa(ni->ni_bssid, ethstr))); sc->sc_mtbl.mt_node_free(ni); } #endif diff --git a/sys/dev/netif/rum/if_rum.c b/sys/dev/netif/rum/if_rum.c index 93cf0c1be0..9ea13d2025 100644 --- a/sys/dev/netif/rum/if_rum.c +++ b/sys/dev/netif/rum/if_rum.c @@ -267,6 +267,7 @@ rum_attach(device_t self) usbd_status error; int i, ntries; uint32_t tmp; + char ethstr[ETHER_ADDRSTRLEN + 1]; sc->sc_udev = uaa->device; sc->sc_dev = self; @@ -332,9 +333,9 @@ rum_attach(device_t self) /* retrieve MAC address and various other things from EEPROM */ rum_read_eeprom(sc); - kprintf("%s: MAC/BBP RT%04x (rev 0x%05x), RF %s, address %6D\n", + kprintf("%s: MAC/BBP RT%04x (rev 0x%05x), RF %s, address %s\n", device_get_nameunit(sc->sc_dev), sc->macbbp_rev, tmp, - rum_get_rf(sc->rf_rev), ic->ic_myaddr, ":"); + rum_get_rf(sc->rf_rev), kether_addr(ic->ic_myaddr, ethstr)); error = rum_load_microcode(sc, rt2573, sizeof(rt2573)); if (error != 0) { diff --git a/sys/dev/netif/ural/if_ural.c b/sys/dev/netif/ural/if_ural.c index 319415af31..741e04c2fc 100644 --- a/sys/dev/netif/ural/if_ural.c +++ b/sys/dev/netif/ural/if_ural.c @@ -1958,6 +1958,8 @@ static void ural_set_bssid(struct ural_softc *sc, uint8_t *bssid) { uint16_t tmp; + struct ether_addr eaddr; + char ethstr[ETHER_ADDRSTRLEN + 1]; tmp = bssid[0] | bssid[1] << 8; ural_write(sc, RAL_MAC_CSR5, tmp); @@ -1968,13 +1970,16 @@ ural_set_bssid(struct ural_softc *sc, uint8_t *bssid) tmp = bssid[4] | bssid[5] << 8; ural_write(sc, RAL_MAC_CSR7, tmp); - DPRINTF(("setting BSSID to %6D\n", bssid, ":")); + bcopy(bssid, &eaddr.octet, sizeof(eaddr.octet)); + DPRINTF(("setting BSSID to %s\n", kether_ntoa(&eaddr, ethstr))); } static void ural_set_macaddr(struct ural_softc *sc, uint8_t *addr) { uint16_t tmp; + struct ether_addr eaddr; + char ethstr[ETHER_ADDRSTRLEN + 1]; tmp = addr[0] | addr[1] << 8; ural_write(sc, RAL_MAC_CSR2, tmp); @@ -1985,7 +1990,8 @@ ural_set_macaddr(struct ural_softc *sc, uint8_t *addr) tmp = addr[4] | addr[5] << 8; ural_write(sc, RAL_MAC_CSR4, tmp); - DPRINTF(("setting MAC address to %6D\n", addr, ":")); + bcopy(bssid, &eaddr.octet, sizeof(eaddr.octet)); + DPRINTF(("setting MAC address to %s\n", kether_ntoa(&eaddr, ethstr))); } static void diff --git a/sys/dev/netif/wi/if_wi.c b/sys/dev/netif/wi/if_wi.c index 5c1477829e..bbacb41724 100644 --- a/sys/dev/netif/wi/if_wi.c +++ b/sys/dev/netif/wi/if_wi.c @@ -1241,12 +1241,13 @@ wi_sync_bssid(struct wi_softc *sc, u_int8_t new_bssid[IEEE80211_ADDR_LEN]) struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct ieee80211_node *ni = vap->iv_bss; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (IEEE80211_ADDR_EQ(new_bssid, ni->ni_bssid)) return; - DPRINTF(("wi_sync_bssid: bssid %6D -> ", ni->ni_bssid, ":")); - DPRINTF(("%6D ?\n", new_bssid, ":")); + DPRINTF(("wi_sync_bssid: bssid %s -> ", kether_ntoa(ni->ni_bssid, ethstr))); + DPRINTF(("%s ?\n", kether_ntoa(new_bssid, ethstr))); /* In promiscuous mode, the BSSID field is not a reliable * indicator of the firmware's BSSID. Damp spurious @@ -1382,6 +1383,7 @@ wi_tx_ex_intr(struct wi_softc *sc) struct ifnet *ifp = sc->sc_ifp; struct wi_frame frmhdr; int fid; + char ethstr[ETHER_ADDRSTRLEN + 1]; fid = CSR_READ_2(sc, WI_TX_CMP_FID); /* Read in the frame header */ @@ -1402,9 +1404,9 @@ wi_tx_ex_intr(struct wi_softc *sc) if (status & WI_TXSTAT_DISCONNECT) kprintf(", port disconnected"); if (status & WI_TXSTAT_FORM_ERR) - kprintf(", invalid format (data len %u src %6D)", + kprintf(", invalid format (data len %u src %s)", le16toh(frmhdr.wi_dat_len), - frmhdr.wi_ehdr.ether_shost, ":"); + kether_ntoa(frmhdr.wi_ehdr.ether_shost, ethstr)); if (status & ~0xf) kprintf(", status=0x%x", status); kprintf("\n"); diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index 4cae254038..7668ef2dbe 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -17,6 +17,11 @@ */ #define ETHER_ADDR_LEN 6 +/* + * The number of bytes for a ASCII representation of MAC address. + */ +#define ETHER_ADDRSTRLEN 17 + /* * The number of bytes in the type field. */ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 838fd55085..bf46ab7f1e 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -573,6 +573,7 @@ ether_ifattach_bpf(struct ifnet *ifp, uint8_t *lla, u_int dlt, u_int hdrlen, lwkt_serialize_t serializer) { struct sockaddr_dl *sdl; + char ethstr[ETHER_ADDRSTRLEN + 1]; ifp->if_type = IFT_ETHER; ifp->if_addrlen = ETHER_ADDR_LEN; @@ -599,7 +600,7 @@ ether_ifattach_bpf(struct ifnet *ifp, uint8_t *lla, u_int dlt, u_int hdrlen, if (ng_ether_attach_p != NULL) (*ng_ether_attach_p)(ifp); - if_printf(ifp, "MAC address: %6D\n", lla, ":"); + if_printf(ifp, "MAC address: %s\n", kether_ntoa(lla, ethstr)); } /* @@ -1702,7 +1703,7 @@ kether_aton(const char *macstr, u_char *addr) char * kether_ntoa(const u_char *addr, char *buf) { - int len = 3 * ETHER_ADDR_LEN; + int len = ETHER_ADDRSTRLEN + 1; int n; n = ksnprintf(buf, len, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], diff --git a/sys/netgraph/bridge/ng_bridge.c b/sys/netgraph/bridge/ng_bridge.c index 5775b5a0f5..e9032f9d97 100644 --- a/sys/netgraph/bridge/ng_bridge.c +++ b/sys/netgraph/bridge/ng_bridge.c @@ -802,10 +802,12 @@ ng_bridge_put(priv_p priv, const u_char *addr, int linkNum) struct ng_bridge_hent *hent; #ifdef INVARIANTS + char ethstr[ETHER_ADDRSTRLEN + 1]; + /* Assert that entry does not already exist in hashtable */ SLIST_FOREACH(hent, &priv->tab[bucket], next) { KASSERT(!ETHER_EQUAL(hent->host.addr, addr), - ("%s: entry %6D exists in table", __func__, addr, ":")); + ("%s: entry %s exists in table", __func__, kether_ntoa(addr, ethstr))); } #endif @@ -931,6 +933,7 @@ ng_bridge_timeout(void *arg) int bucket; int counter = 0; int linkNum; + char ethstr[ETHER_ADDRSTRLEN + 1]; /* If node was shut down, this is the final lingering timeout */ crit_enter(); @@ -954,8 +957,8 @@ ng_bridge_timeout(void *arg) /* Make sure host's link really exists */ KASSERT(priv->links[hent->host.linkNum] != NULL, - ("%s: host %6D on nonexistent link %d", - __func__, hent->host.addr, ":", + ("%s: host %s on nonexistent link %d", + __func__, kether_ntoa(hent->host.addr, ethstr), hent->host.linkNum)); /* Remove hosts we haven't heard from in a while */ diff --git a/sys/netgraph/pppoe/ng_pppoe.c b/sys/netgraph/pppoe/ng_pppoe.c index abfaf72df4..d633fd8a67 100644 --- a/sys/netgraph/pppoe/ng_pppoe.c +++ b/sys/netgraph/pppoe/ng_pppoe.c @@ -56,6 +56,8 @@ #include #include #include + +#include #include #include @@ -892,6 +894,7 @@ ng_pppoe_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) union uniq data; } __attribute ((packed)) uniqtag; negp neg = NULL; + char ethstr[ETHER_ADDRSTRLEN + 1]; AAA if (hook->private == &privp->debug_hook) { @@ -928,15 +931,13 @@ AAA ETHERTYPE_PPPOE_STUPID_DISC; log(LOG_NOTICE, "Switched to nonstandard PPPoE mode due to " - "packet from %*D\n", - ETHER_ADDR_LEN, - wh->eh.ether_shost, ":"); + "packet from %s\n", + kether_ntoa(wh->eh.ether_shost, ethstr)); } else if (pppoe_mode == PPPOE_KEEPSTANDARD) log(LOG_NOTICE, "Ignored nonstandard PPPoE packet " - "from %*D\n", - ETHER_ADDR_LEN, - wh->eh.ether_shost, ":"); + "from %s\n", + kether_ntoa(wh->eh.ether_shost, ethstr)); /* fall through */ case ETHERTYPE_PPPOE_DISC: /* diff --git a/sys/netgraph7/atm/ng_atm.c b/sys/netgraph7/atm/ng_atm.c index dcb6e66710..588fcc8fce 100644 --- a/sys/netgraph7/atm/ng_atm.c +++ b/sys/netgraph7/atm/ng_atm.c @@ -876,8 +876,8 @@ text_status(node_p node, char *arg, u_int len) if(atmmedia[i].name == NULL) sbuf_printf(&sbuf, "media=unknown\n"); - sbuf_printf(&sbuf, "serial=%u esi=%6D hardware=%u software=%u\n", - mib->serial, mib->esi, ":", mib->hw_version, mib->sw_version); + sbuf_printf(&sbuf, "serial=%u esi=%s hardware=%u software=%u\n", + mib->serial, ether_sprintf(mib->esi), mib->hw_version, mib->sw_version); sbuf_printf(&sbuf, "pcr=%u vpi_bits=%u vci_bits=%u max_vpcs=%u " "max_vccs=%u\n", mib->pcr, mib->vpi_bits, mib->vci_bits, mib->max_vpcs, mib->max_vccs); diff --git a/sys/netgraph7/bridge/ng_bridge.c b/sys/netgraph7/bridge/ng_bridge.c index 8fabf67f65..ff1c34086b 100644 --- a/sys/netgraph7/bridge/ng_bridge.c +++ b/sys/netgraph7/bridge/ng_bridge.c @@ -846,7 +846,7 @@ ng_bridge_put(priv_p priv, const u_char *addr, int linkNum) /* Assert that entry does not already exist in hashtable */ SLIST_FOREACH(hent, &priv->tab[bucket], next) { KASSERT(!ETHER_EQUAL(hent->host.addr, addr), - ("%s: entry %6D exists in table", __func__, addr, ":")); + ("%s: entry %s exists in table", __func__, ether_sprintf(addr))); } #endif @@ -979,8 +979,8 @@ ng_bridge_timeout(node_p node, hook_p hook, void *arg1, int arg2) /* Make sure host's link really exists */ KASSERT(priv->links[hent->host.linkNum] != NULL, - ("%s: host %6D on nonexistent link %d", - __func__, hent->host.addr, ":", + ("%s: host %s on nonexistent link %d", + __func__, ether_sprintf(hent->host.addr), hent->host.linkNum)); /* Remove hosts we haven't heard from in a while */ diff --git a/sys/netproto/802_11/wlan/ieee80211_adhoc.c b/sys/netproto/802_11/wlan/ieee80211_adhoc.c index 1af7f77cf2..ddaa989580 100644 --- a/sys/netproto/802_11/wlan/ieee80211_adhoc.c +++ b/sys/netproto/802_11/wlan/ieee80211_adhoc.c @@ -130,6 +130,7 @@ adhoc_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; enum ieee80211_state ostate; + char ethstr[ETHER_ADDRSTRLEN + 1]; ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", @@ -210,8 +211,8 @@ adhoc_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) #ifdef IEEE80211_DEBUG if (ieee80211_msg_debug(vap)) { ieee80211_note(vap, - "synchronized with %6D ssid ", - ni->ni_bssid, ":"); + "synchronized with %s ssid ", + kether_ntoa(ni->ni_bssid, ethstr)); ieee80211_print_essid(vap->iv_bss->ni_essid, ni->ni_esslen); /* XXX MCS/HT */ @@ -293,6 +294,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) uint8_t dir, type, subtype, qos; uint8_t *bssid; uint16_t rxseq; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (m->m_flags & M_AMPDU_MPDU) { /* @@ -620,10 +622,10 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) #ifdef IEEE80211_DEBUG if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) || ieee80211_msg_dumppkts(vap)) { - if_printf(ifp, "received %s from %6D rssi %d\n", + if_printf(ifp, "received %s from %s rssi %d\n", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - wh->i_addr2, ":", rssi); + kether_ntoa(wh->i_addr2, ethstr), rssi); } #endif if (wh->i_fc[1] & IEEE80211_FC1_WEP) { diff --git a/sys/netproto/802_11/wlan/ieee80211_crypto.c b/sys/netproto/802_11/wlan/ieee80211_crypto.c index 63a1908e2c..010e7b7676 100644 --- a/sys/netproto/802_11/wlan/ieee80211_crypto.c +++ b/sys/netproto/802_11/wlan/ieee80211_crypto.c @@ -492,13 +492,14 @@ int ieee80211_crypto_setkey(struct ieee80211vap *vap, struct ieee80211_key *key) { const struct ieee80211_cipher *cip = key->wk_cipher; + char ethstr[ETHER_ADDRSTRLEN + 1]; KASSERT(cip != NULL, ("No cipher!")); IEEE80211_DPRINTF(vap, IEEE80211_MSG_CRYPTO, - "%s: %s keyix %u flags 0x%x mac %6D rsc %ju tsc %ju len %u\n", + "%s: %s keyix %u flags 0x%x mac %s rsc %ju tsc %ju len %u\n", __func__, cip->ic_name, key->wk_keyix, - key->wk_flags, key->wk_macaddr, ":", + key->wk_flags, kether_ntoa(key->wk_macaddr, ethstr), key->wk_keyrsc[IEEE80211_NONQOS_TID], key->wk_keytsc, key->wk_keylen); diff --git a/sys/netproto/802_11/wlan/ieee80211_ddb.c b/sys/netproto/802_11/wlan/ieee80211_ddb.c index b6a4528859..5bb9339017 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ddb.c +++ b/sys/netproto/802_11/wlan/ieee80211_ddb.c @@ -238,9 +238,10 @@ static void _db_show_sta(const struct ieee80211_node *ni) { int i; + char ethstr[ETHER_ADDRSTRLEN + 1]; - db_printf("0x%p: mac %6D refcnt %d\n", ni, - ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)); + db_printf("0x%p: mac %s refcnt %d\n", ni, + kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)); db_printf("\tvap %p wdsvap %p ic %p table %p\n", ni->ni_vap, ni->ni_wdsvap, ni->ni_ic, ni->ni_table); db_printf("\tflags=%b\n", ni->ni_flags, IEEE80211_NODE_BITS); @@ -280,7 +281,7 @@ _db_show_sta(const struct ieee80211_node *ni) ni->ni_noise); db_printf("\tintval %u capinfo %b\n", ni->ni_intval, ni->ni_capinfo, IEEE80211_CAPINFO_BITS); - db_printf("\tbssid %6D", ni->ni_bssid, ":"); + db_printf("\tbssid %s", kether_ntoa(ni->ni_bssid, ethstr)); _db_show_ssid(" essid ", 0, ni->ni_esslen, ni->ni_essid); db_printf("\n"); _db_show_channel("\tchannel", ni->ni_chan); @@ -336,11 +337,12 @@ static void _db_show_vap(const struct ieee80211vap *vap, int showprocs) { const struct ieee80211com *ic = vap->iv_ic; + char ethstr[ETHER_ADDRSTRLEN + 1]; int i; db_printf("%p:", vap); db_printf(" bss %p", vap->iv_bss); - db_printf(" myaddr %6D", vap->iv_myaddr, ":"); + db_printf(" myaddr %s", kether_ntoa(vap->iv_myaddr, ethstr)); db_printf("\n"); db_printf("\topmode %s", ieee80211_opmode_name[vap->iv_opmode]); @@ -377,7 +379,7 @@ _db_show_vap(const struct ieee80211vap *vap, int showprocs) if (vap->iv_des_nssid) _db_show_ssid(" des_ssid[%u] ", 0, vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid); - db_printf(" des_bssid %6D", vap->iv_des_bssid, ":"); + db_printf(" des_bssid %s", kether_ntoa(vap->iv_des_bssid, ethstr)); db_printf("\n"); db_printf("\tdes_mode %d", vap->iv_des_mode); _db_show_channel(" des_chan", vap->iv_des_chan); @@ -669,6 +671,7 @@ _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, int showp static void _db_show_node_table(const char *tag, const struct ieee80211_node_table *nt) { + char ethstr[ETHER_ADDRSTRLEN + 1]; int i; db_printf("%s%s@%p:\n", tag, nt->nt_name, nt); @@ -679,8 +682,8 @@ _db_show_node_table(const char *tag, const struct ieee80211_node_table *nt) for (i = 0; i < nt->nt_keyixmax; i++) { const struct ieee80211_node *ni = nt->nt_keyixmap[i]; if (ni != NULL) - db_printf("%s [%3u] %p %6D\n", tag, i, ni, - ni->ni_macaddr, ":"); + db_printf("%s [%3u] %p %s\n", tag, i, ni, + kether_ntoa(ni->ni_macaddr, ethstr)); } } @@ -861,6 +864,7 @@ static void _db_show_mesh(const struct ieee80211_mesh_state *ms) { struct ieee80211_mesh_route *rt; + char ethstr[2][ETHER_ADDRSTRLEN + 1]; int i; _db_show_ssid(" meshid ", 0, ms->ms_idlen, ms->ms_id); @@ -869,8 +873,10 @@ _db_show_mesh(const struct ieee80211_mesh_state *ms) db_printf("routing table:\n"); i = 0; TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { - db_printf("entry %d:\tdest: %6D nexthop: %6D metric: %u", i, - rt->rt_dest, ":", rt->rt_nexthop, ":", rt->rt_metric); + db_printf("entry %d:\tdest: %s nexthop: %s metric: %u", i, + kether_ntoa(rt->rt_dest, ethstr[0]), + kether_ntoa(rt->rt_nexthop, ethstr[1]), + rt->rt_metric); db_printf("\tlifetime: %u lastseq: %u priv: %p\n", rt->rt_lifetime, rt->rt_lastmseq, rt->rt_priv); i++; diff --git a/sys/netproto/802_11/wlan/ieee80211_hostap.c b/sys/netproto/802_11/wlan/ieee80211_hostap.c index bc629d3fc7..ac6d04e96e 100644 --- a/sys/netproto/802_11/wlan/ieee80211_hostap.c +++ b/sys/netproto/802_11/wlan/ieee80211_hostap.c @@ -156,6 +156,7 @@ hostap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { struct ieee80211com *ic = vap->iv_ic; enum ieee80211_state ostate; + char ethstr[ETHER_ADDRSTRLEN + 1]; ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", @@ -300,8 +301,8 @@ hostap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) if (ieee80211_msg_debug(vap)) { struct ieee80211_node *ni = vap->iv_bss; ieee80211_note(vap, - "synchronized with %6D ssid ", - ni->ni_bssid, ":"); + "synchronized with %s ssid ", + kether_ntoa(ni->ni_bssid, ethstr)); ieee80211_print_essid(ni->ni_essid, ni->ni_esslen); /* XXX MCS/HT */ @@ -480,6 +481,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) uint8_t dir, type, subtype, qos; uint8_t *bssid; uint16_t rxseq; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (m->m_flags & M_AMPDU_MPDU) { /* @@ -835,18 +837,18 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) if (IEEE80211_IS_MULTICAST(wh->i_addr2)) { /* ensure return frames are unicast */ IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY, - wh, NULL, "source is multicast: %6D", - wh->i_addr2, ":"); + wh, NULL, "source is multicast: %s", + kether_ntoa(wh->i_addr2, ethstr)); vap->iv_stats.is_rx_mgtdiscard++; /* XXX stat */ goto out; } #ifdef IEEE80211_DEBUG if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) || ieee80211_msg_dumppkts(vap)) { - if_printf(ifp, "received %s from %6D rssi %d\n", + if_printf(ifp, "received %s from %s rssi %d\n", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - wh->i_addr2, ":", rssi); + kether_ntoa(wh->i_addr2, ethstr), rssi); } #endif if (wh->i_fc[1] & IEEE80211_FC1_WEP) { diff --git a/sys/netproto/802_11/wlan/ieee80211_ht.c b/sys/netproto/802_11/wlan/ieee80211_ht.c index 3f2cc5daf7..cbdd1bef78 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ht.c +++ b/sys/netproto/802_11/wlan/ieee80211_ht.c @@ -2152,6 +2152,7 @@ ht_send_action_ba_addba(struct ieee80211_node *ni, uint16_t *args = arg0; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, "send ADDBA %s: dialogtoken %d " @@ -2162,8 +2163,8 @@ ht_send_action_ba_addba(struct ieee80211_node *ni, args[2], args[3]); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, @@ -2199,6 +2200,7 @@ ht_send_action_ba_delba(struct ieee80211_node *ni, struct mbuf *m; uint16_t baparamset; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; baparamset = SM(args[0], IEEE80211_DELBAPS_TID) | args[1] @@ -2208,8 +2210,8 @@ ht_send_action_ba_delba(struct ieee80211_node *ni, args[0], args[1], args[2]); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, @@ -2240,14 +2242,15 @@ ht_send_action_ht_txchwidth(struct ieee80211_node *ni, struct ieee80211com *ic = ni->ni_ic; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, "send HT txchwidth: width %d", IEEE80211_IS_CHAN_HT40(ni->ni_chan) ? 40 : 20); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, diff --git a/sys/netproto/802_11/wlan/ieee80211_hwmp.c b/sys/netproto/802_11/wlan/ieee80211_hwmp.c index 0ce7a27e89..9a9ec72424 100644 --- a/sys/netproto/802_11/wlan/ieee80211_hwmp.c +++ b/sys/netproto/802_11/wlan/ieee80211_hwmp.c @@ -393,7 +393,9 @@ hwmp_send_action(struct ieee80211_node *ni, struct ieee80211_bpf_params params; struct mbuf *m; uint8_t *frm; - +#ifdef IEEE80211_DEBUG_REFCNT + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, "block %s frame in CAC state", "HWMP action"); @@ -409,9 +411,9 @@ hwmp_send_action(struct ieee80211_node *ni, */ #ifdef IEEE80211_DEBUG_REFCNT IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); #endif ieee80211_ref_node(ni); @@ -684,6 +686,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211_hwmp_route *hrorig; struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -696,7 +699,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, return; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "received PREQ, source %6D", preq->preq_origaddr, ":"); + "received PREQ, source %s", kether_ntoa(preq->preq_origaddr, ethstr)); /* * Acceptance criteria: if the PREQ is not for us and @@ -722,8 +725,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, if (HWMP_SEQ_LEQ(preq->preq_id, hrorig->hr_preqid) && HWMP_SEQ_LEQ(preq->preq_origseq, hrorig->hr_seq)) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "discard PREQ from %6D, old seq no %u <= %u", - preq->preq_origaddr, ":", + "discard PREQ from %s, old seq no %u <= %u", + kether_ntoa(preq->preq_origaddr, ethstr), preq->preq_origseq, hrorig->hr_seq); return; } @@ -735,7 +738,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, */ if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "reply to %6D", preq->preq_origaddr, ":"); + "reply to %s", kether_ntoa(preq->preq_origaddr, ethstr)); /* * Build and send a PREP frame. */ @@ -775,14 +778,14 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, rt = ieee80211_mesh_rt_add(vap, rootmac); if (rt == NULL) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "unable to add root mesh path to %6D", - rootmac, ":"); + "unable to add root mesh path to %s", + kether_ntoa(rootmac, ethstr)); vap->iv_stats.is_mesh_rtaddfailed++; return; } } IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "root mesh station @ %6D", rootmac, ":"); + "root mesh station @ %s", kether_ntoa(rootmac, ethstr)); /* * Reply with a PREP if we don't have a path to the root @@ -823,8 +826,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, if (preq->preq_ttl > 1 && preq->preq_hopcount < hs->hs_maxhops) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "forward PREQ from %6D", - preq->preq_origaddr, ":"); + "forward PREQ from %s", + kether_ntoa(preq->preq_origaddr, ethstr)); /* * Propagate the original PREQ. */ @@ -851,8 +854,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211_meshprep_ie prep; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "intermediate reply for PREQ from %6D", - preq->preq_origaddr, ":"); + "intermediate reply for PREQ from %s", + kether_ntoa(preq->preq_origaddr, ethstr)); prep.prep_flags = 0; prep.prep_hopcount = rt->rt_nhops + 1; prep.prep_ttl = ms->ms_ttl; @@ -878,8 +881,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, rt = ieee80211_mesh_rt_add(vap, PREQ_TADDR(0)); if (rt == NULL) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, - ni, "unable to add PREQ path to %6D", - PREQ_TADDR(0), ":"); + ni, "unable to add PREQ path to %s", + kether_ntoa(PREQ_TADDR(0), ethstr)); vap->iv_stats.is_mesh_rtaddfailed++; return; } @@ -892,8 +895,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, hrorig->hr_preqid = preq->preq_id; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "forward PREQ from %6D", - preq->preq_origaddr, ":"); + "forward PREQ from %s", + kether_ntoa(preq->preq_origaddr, ethstr)); ppreq.preq_hopcount += 1; ppreq.preq_ttl -= 1; ppreq.preq_metric += ms->ms_pmetric->mpm_metric(ni); @@ -947,6 +950,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211com *ic = vap->iv_ic; struct ifnet *ifp = vap->iv_ifp; struct mbuf *m, *next; + char ethstr[ETHER_ADDRSTRLEN + 1]; /* * Acceptance criteria: if the corresponding PREQ was not generated @@ -960,7 +964,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, return; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "received PREP from %6D", prep->prep_targetaddr, ":"); + "received PREP from %s", kether_ntoa(prep->prep_targetaddr, ethstr)); rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr); if (rt == NULL) { @@ -971,8 +975,8 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, rt = ieee80211_mesh_rt_add(vap, prep->prep_targetaddr); if (rt == NULL) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, - ni, "unable to add PREP path to %6D", - prep->prep_targetaddr, ":"); + ni, "unable to add PREP path to %s", + kether_ntoa(prep->prep_targetaddr, ethstr)); vap->iv_stats.is_mesh_rtaddfailed++; return; } @@ -982,8 +986,8 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, rt->rt_metric = prep->prep_metric; rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "add root path to %6D nhops %d metric %d (PREP)", - prep->prep_targetaddr, ":", + "add root path to %s nhops %d metric %d (PREP)", + kether_ntoa(prep->prep_targetaddr, ethstr), rt->rt_nhops, rt->rt_metric); return; } @@ -995,8 +999,8 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); if (HWMP_SEQ_LEQ(prep->prep_targetseq, hr->hr_seq)) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "discard PREP from %6D, old seq no %u <= %u", - prep->prep_targetaddr, ":", + "discard PREP from %s, old seq no %u <= %u", + kether_ntoa(prep->prep_targetaddr, ethstr), prep->prep_targetseq, hr->hr_seq); return; } @@ -1009,8 +1013,8 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211_meshprep_ie pprep; /* propagated PREP */ IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "propagate PREP from %6D", - prep->prep_targetaddr, ":"); + "propagate PREP from %s", + kether_ntoa(prep->prep_targetaddr, ethstr)); memcpy(&pprep, prep, sizeof(pprep)); pprep.prep_hopcount += 1; @@ -1023,8 +1027,8 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { /* NB: never clobber a proxy entry */; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "discard PREP for %6D, route is marked PROXY", - prep->prep_targetaddr, ":"); + "discard PREP for %s, route is marked PROXY", + kether_ntoa(prep->prep_targetaddr, ethstr)); vap->iv_stats.is_hwmp_proxy++; } else if (prep->prep_origseq == hr->hr_origseq) { /* @@ -1036,10 +1040,10 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, (prep->prep_hopcount < rt->rt_nhops || prep->prep_metric < rt->rt_metric)) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "%s path to %6D, hopcount %d:%d metric %d:%d", + "%s path to %s, hopcount %d:%d metric %d:%d", rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", - prep->prep_origaddr, ":", + kether_ntoa(prep->prep_origaddr, ethstr), rt->rt_nhops, prep->prep_hopcount, rt->rt_metric, prep->prep_metric); IEEE80211_ADDR_COPY(rt->rt_nexthop, wh->i_addr2); @@ -1049,15 +1053,15 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; } else { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "ignore PREP for %6D, hopcount %d:%d metric %d:%d", - prep->prep_targetaddr, ":", + "ignore PREP for %s, hopcount %d:%d metric %d:%d", + kether_ntoa(prep->prep_targetaddr, ethstr), rt->rt_nhops, prep->prep_hopcount, rt->rt_metric, prep->prep_metric); } } else { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "discard PREP for %6D, wrong seqno %u != %u", - prep->prep_targetaddr, ":", prep->prep_origseq, + "discard PREP for %s, wrong seqno %u != %u", + kether_ntoa(prep->prep_targetaddr, ethstr), prep->prep_origseq, hr->hr_seq); vap->iv_stats.is_hwmp_wrongseq++; } @@ -1152,6 +1156,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211_hwmp_route *hr; struct ieee80211_meshperr_ie pperr; int i, forward = 0; + char ethstr[ETHER_ADDRSTRLEN + 1]; /* * Acceptance criteria: check if we received a PERR from a @@ -1183,7 +1188,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni, */ if (forward && perr->perr_ttl > 1) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "propagate PERR from %6D", wh->i_addr2, ":"); + "propagate PERR from %s", kether_ntoa(wh->i_addr2, ethstr)); memcpy(&pperr, perr, sizeof(*perr)); pperr.perr_ttl--; hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, @@ -1296,6 +1301,7 @@ hwmp_discover(struct ieee80211vap *vap, struct ieee80211_meshpreq_ie preq; struct ieee80211_node *ni; int sendpreq = 0; + char ethstr[ETHER_ADDRSTRLEN + 1]; KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a mesh vap, opmode %d", vap->iv_opmode)); @@ -1310,8 +1316,8 @@ hwmp_discover(struct ieee80211vap *vap, rt = ieee80211_mesh_rt_add(vap, dest); if (rt == NULL) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, - ni, "unable to add discovery path to %6D", - dest, ":"); + ni, "unable to add discovery path to %s", + kether_ntoa(dest, ethstr)); vap->iv_stats.is_mesh_rtaddfailed++; goto done; } @@ -1333,9 +1339,10 @@ hwmp_discover(struct ieee80211vap *vap, } else { IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, dest, - "start path discovery (src %6D)", - mtod(m, struct ether_header *)->ether_shost, - ":"); + "start path discovery (src %s)", + kether_ntoa( + mtod(m, struct ether_header *)->ether_shost, + ethstr)); } /* * Try to discover the path for this node. diff --git a/sys/netproto/802_11/wlan/ieee80211_input.c b/sys/netproto/802_11/wlan/ieee80211_input.c index bd174b6747..2b74228005 100644 --- a/sys/netproto/802_11/wlan/ieee80211_input.c +++ b/sys/netproto/802_11/wlan/ieee80211_input.c @@ -723,8 +723,10 @@ void ieee80211_ssid_mismatch(struct ieee80211vap *vap, const char *tag, uint8_t mac[IEEE80211_ADDR_LEN], uint8_t *ssid) { - kprintf("[%6D] discard %s frame, ssid mismatch: ", - mac, ":", tag); + char ethstr[ETHER_ADDRSTRLEN + 1]; + + kprintf("[%s] discard %s frame, ssid mismatch: ", + kether_ntoa(mac, ethstr), tag); ieee80211_print_essid(ssid + 2, ssid[1]); kprintf("\n"); } @@ -766,12 +768,13 @@ ieee80211_note_frame(const struct ieee80211vap *vap, { char buf[128]; /* XXX */ __va_list ap; + char ethstr[ETHER_ADDRSTRLEN + 1]; __va_start(ap, fmt); kvsnprintf(buf, sizeof(buf), fmt, ap); __va_end(ap); - if_printf(vap->iv_ifp, "[%6D] %s\n", - ieee80211_getbssid(vap, wh), ":", buf); + if_printf(vap->iv_ifp, "[%s] %s\n", + kether_ntoa(ieee80211_getbssid(vap, wh), ethstr), buf); } void @@ -781,11 +784,12 @@ ieee80211_note_mac(const struct ieee80211vap *vap, { char buf[128]; /* XXX */ __va_list ap; + char ethstr[ETHER_ADDRSTRLEN + 1]; __va_start(ap, fmt); kvsnprintf(buf, sizeof(buf), fmt, ap); __va_end(ap); - if_printf(vap->iv_ifp, "[%6D] %s\n", mac, ":", buf); + if_printf(vap->iv_ifp, "[%s] %s\n", kether_ntoa(mac, ethstr), buf); } void @@ -794,9 +798,10 @@ ieee80211_discard_frame(const struct ieee80211vap *vap, const char *type, const char *fmt, ...) { __va_list ap; + char ethstr[ETHER_ADDRSTRLEN + 1]; - if_printf(vap->iv_ifp, "[%6D] discard ", - ieee80211_getbssid(vap, wh), ":"); + if_printf(vap->iv_ifp, "[%s] discard ", + kether_ntoa(ieee80211_getbssid(vap, wh), ethstr)); if (type == NULL) { kprintf("%s frame, ", ieee80211_mgt_subtype_name[ (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) >> @@ -815,9 +820,10 @@ ieee80211_discard_ie(const struct ieee80211vap *vap, const char *type, const char *fmt, ...) { __va_list ap; + char ethstr[ETHER_ADDRSTRLEN + 1]; - if_printf(vap->iv_ifp, "[%6D] discard ", - ieee80211_getbssid(vap, wh), ":"); + if_printf(vap->iv_ifp, "[%s] discard ", + kether_ntoa(ieee80211_getbssid(vap, wh), ethstr)); if (type != NULL) kprintf("%s information element, ", type); else @@ -834,8 +840,9 @@ ieee80211_discard_mac(const struct ieee80211vap *vap, const char *type, const char *fmt, ...) { __va_list ap; + char ethstr[ETHER_ADDRSTRLEN + 1]; - if_printf(vap->iv_ifp, "[%6D] discard ", mac, ":"); + if_printf(vap->iv_ifp, "[%s] discard ", kether_ntoa(mac, ethstr)); if (type != NULL) kprintf("%s frame, ", type); else diff --git a/sys/netproto/802_11/wlan/ieee80211_mesh.c b/sys/netproto/802_11/wlan/ieee80211_mesh.c index ee42c3df56..2b0bd0713c 100644 --- a/sys/netproto/802_11/wlan/ieee80211_mesh.c +++ b/sys/netproto/802_11/wlan/ieee80211_mesh.c @@ -517,6 +517,7 @@ mesh_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211com *ic = vap->iv_ic; enum ieee80211_state ostate; + char ethstr[ETHER_ADDRSTRLEN + 1]; ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", @@ -635,8 +636,8 @@ mesh_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) if (ieee80211_msg_debug(vap)) { struct ieee80211_node *ni = vap->iv_bss; ieee80211_note(vap, - "synchronized with %6D meshid ", - ni->ni_meshid, ":"); + "synchronized with %s meshid ", + kether_ntoa(ni->ni_meshid, ethstr)); ieee80211_print_essid(ni->ni_meshid, ni->ni_meshidlen); /* XXX MCS/HT */ @@ -1014,6 +1015,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) uint32_t seq; uint8_t *addr; ieee80211_seq rxseq; + char ethstr[ETHER_ADDRSTRLEN + 1]; KASSERT(ni != NULL, ("null node")); ni->ni_inact = ni->ni_inact_reload; @@ -1228,10 +1230,10 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) if ((ieee80211_msg_debug(vap) && (vap->iv_ic->ic_flags & IEEE80211_F_SCAN)) || ieee80211_msg_dumppkts(vap)) { - if_printf(ifp, "received %s from %6D rssi %d\n", + if_printf(ifp, "received %s from %s rssi %d\n", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - wh->i_addr2, ":", rssi); + kether_ntoa(wh->i_addr2, ethstr), rssi); } #endif if (wh->i_fc[1] & IEEE80211_FC1_WEP) { @@ -1878,13 +1880,14 @@ mesh_send_action_meshpeering_open(struct ieee80211_node *ni, const struct ieee80211_rateset *rs; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni, "send PEER OPEN action: localid 0x%x", args[0]); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, @@ -1938,14 +1941,15 @@ mesh_send_action_meshpeering_confirm(struct ieee80211_node *ni, const struct ieee80211_rateset *rs; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni, "send PEER CONFIRM action: localid 0x%x, peerid 0x%x", args[0], args[1]); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, @@ -2005,14 +2009,15 @@ mesh_send_action_meshpeering_close(struct ieee80211_node *ni, uint16_t *args = args0; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni, "send PEER CLOSE action: localid 0x%x, peerid 0x%x reason %d", args[0], args[1], args[2]); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, @@ -2055,13 +2060,14 @@ mesh_send_action_meshlink_request(struct ieee80211_node *ni, struct ieee80211com *ic = ni->ni_ic; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni, "%s", "send LINK METRIC REQUEST action"); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, @@ -2094,13 +2100,14 @@ mesh_send_action_meshlink_reply(struct ieee80211_node *ni, uint32_t *metric = args0; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni, "send LINK METRIC REPLY action: metric 0x%x", *metric); IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)+1); + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); m = ieee80211_getmgtframe(&frm, diff --git a/sys/netproto/802_11/wlan/ieee80211_node.c b/sys/netproto/802_11/wlan/ieee80211_node.c index bd8ef59d1a..c3407a98f1 100644 --- a/sys/netproto/802_11/wlan/ieee80211_node.c +++ b/sys/netproto/802_11/wlan/ieee80211_node.c @@ -507,6 +507,7 @@ check_bss_debug(struct ieee80211vap *vap, struct ieee80211_node *ni) struct ieee80211com *ic = ni->ni_ic; uint8_t rate; int fail; + char ethstr[ETHER_ADDRSTRLEN + 1]; fail = 0; if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, ni->ni_chan))) @@ -537,8 +538,8 @@ check_bss_debug(struct ieee80211vap *vap, struct ieee80211_node *ni) !IEEE80211_ADDR_EQ(vap->iv_des_bssid, ni->ni_bssid)) fail |= 0x20; - kprintf(" %c %6D", fail ? '-' : '+', ni->ni_macaddr, ":"); - kprintf(" %6D%c", ni->ni_bssid, ":", fail & 0x20 ? '!' : ' '); + kprintf(" %c %s", fail ? '-' : '+', kether_ntoa(ni->ni_macaddr, ethstr)); + kprintf(" %s%c", kether_ntoa(ni->ni_bssid, ethstr), fail & 0x20 ? '!' : ' '); kprintf(" %3d%c", ieee80211_chan2ieee(ic, ni->ni_chan), fail & 0x01 ? '!' : ' '); kprintf(" %2dM%c", (rate & IEEE80211_RATE_VAL) / 2, @@ -575,6 +576,7 @@ ieee80211_ibss_merge(struct ieee80211_node *ni) #ifdef IEEE80211_DEBUG struct ieee80211com *ic = ni->ni_ic; #endif + char ethstr[ETHER_ADDRSTRLEN + 1]; if (ni == vap->iv_bss || IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { @@ -593,8 +595,8 @@ ieee80211_ibss_merge(struct ieee80211_node *ni) return 0; } IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, - "%s: new bssid %6D: %s preamble, %s slot time%s\n", __func__, - ni->ni_bssid, ":", + "%s: new bssid %s: %s preamble, %s slot time%s\n", __func__, + kether_ntoa(ni->ni_bssid, ethstr), ic->ic_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long", ic->ic_flags&IEEE80211_F_SHSLOT ? "short" : "long", ic->ic_flags&IEEE80211_F_USEPROT ? ", protection" : "" @@ -1092,6 +1094,7 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, struct ieee80211com *ic = nt->nt_ic; struct ieee80211_node *ni; int hash; + char ethstr[ETHER_ADDRSTRLEN + 1]; ni = ic->ic_node_alloc(vap, macaddr); if (ni == NULL) { @@ -1100,8 +1103,8 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, } IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "%s %p<%6D> in %s table\n", __func__, ni, - macaddr, ":", nt->nt_name); + "%s %p<%s> in %s table\n", __func__, ni, + kether_ntoa(macaddr, ethstr), nt->nt_name); IEEE80211_ADDR_COPY(ni->ni_macaddr, macaddr); hash = IEEE80211_NODE_HASH(ic, macaddr); @@ -1144,13 +1147,14 @@ ieee80211_tmp_node(struct ieee80211vap *vap, { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; + char ethstr[ETHER_ADDRSTRLEN + 1]; ni = ic->ic_node_alloc(vap, macaddr); if (ni != NULL) { struct ieee80211_node *bss = vap->iv_bss; IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "%s %p<%6D>\n", __func__, ni, macaddr, ":"); + "%s %p<%s>\n", __func__, ni, kether_ntoa(macaddr, ethstr)); ni->ni_table = NULL; /* NB: pedantic */ ni->ni_ic = ic; /* NB: needed to set channel */ @@ -1266,16 +1270,18 @@ ieee80211_find_node_locked(struct ieee80211_node_table *nt, { struct ieee80211_node *ni; int hash; - +#ifdef IEEE80211_DEBUG_REFCNT + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif hash = IEEE80211_NODE_HASH(nt->nt_ic, macaddr); LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { ieee80211_ref_node(ni); /* mark referenced */ #ifdef IEEE80211_DEBUG_REFCNT IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s (%s:%u) %p<%6D> refcnt %d\n", __func__, + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, - ni, ni->ni_macaddr, ":", + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)); #endif return ni; @@ -1312,7 +1318,9 @@ ieee80211_find_vap_node_locked(struct ieee80211_node_table *nt, { struct ieee80211_node *ni; int hash; - +#ifdef IEEE80211_DEBUG_REFCNT + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif hash = IEEE80211_NODE_HASH(nt->nt_ic, macaddr); LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { if (ni->ni_vap == vap && @@ -1320,9 +1328,9 @@ ieee80211_find_vap_node_locked(struct ieee80211_node_table *nt, ieee80211_ref_node(ni); /* mark referenced */ #ifdef IEEE80211_DEBUG_REFCNT IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s (%s:%u) %p<%6D> refcnt %d\n", __func__, + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, - ni, ni->ni_macaddr, ":", + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)); #endif return ni; @@ -1359,9 +1367,10 @@ ieee80211_fakeup_adhoc_node(struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN]) { struct ieee80211_node *ni; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "%s: mac<%6D>\n", __func__, macaddr, ":"); + "%s: mac<%s>\n", __func__, kether_ntoa(macaddr, ethstr)); ni = ieee80211_dup_bss(vap, macaddr); if (ni != NULL) { struct ieee80211com *ic = vap->iv_ic; @@ -1444,9 +1453,10 @@ ieee80211_add_neighbor(struct ieee80211vap *vap, const struct ieee80211_scanparams *sp) { struct ieee80211_node *ni; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "%s: mac<%6D>\n", __func__, wh->i_addr2, ":"); + "%s: mac<%s>\n", __func__, kether_ntoa(wh->i_addr2, ethstr)); ni = ieee80211_dup_bss(vap, wh->i_addr2);/* XXX alloc_node? */ if (ni != NULL) { struct ieee80211com *ic = vap->iv_ic; @@ -1522,6 +1532,7 @@ ieee80211_find_rxnode_withkey(struct ieee80211com *ic, { struct ieee80211_node_table *nt; struct ieee80211_node *ni; + char ethstr[ETHER_ADDRSTRLEN + 1]; nt = &ic->ic_sta; if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax) @@ -1541,8 +1552,8 @@ ieee80211_find_rxnode_withkey(struct ieee80211com *ic, nt->nt_keyixmap[keyix] == NULL) { IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s: add key map entry %p<%6D> refcnt %d\n", - __func__, ni, ni->ni_macaddr, ":", + "%s: add key map entry %p<%s> refcnt %d\n", + __func__, ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); nt->nt_keyixmap[keyix] = ieee80211_ref_node(ni); } @@ -1623,8 +1634,8 @@ _ieee80211_free_node(struct ieee80211_node *ni) */ #if 0 IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "%s %p<%6D> in %s table\n", __func__, ni, - ni->ni_macaddr, ":", + "%s %p<%s> in %s table\n", __func__, ni, + kether_ntoa(ni->ni_macaddr, ethstr), nt != NULL ? nt->nt_name : ""); #endif if (ni->ni_associd != 0) { @@ -1647,11 +1658,12 @@ ieee80211_free_node(struct ieee80211_node *ni) #endif { struct ieee80211_node_table *nt = ni->ni_table; + char ethstr[ETHER_ADDRSTRLEN + 1]; #ifdef IEEE80211_DEBUG_REFCNT IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s (%s:%u) %p<%6D> refcnt %d\n", __func__, func, line, ni, - ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)-1); + "%s (%s:%u) %p<%s> refcnt %d\n", __func__, func, line, ni, + kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)-1); #endif if (nt != NULL) { if (ieee80211_node_dectestref(ni)) { @@ -1670,8 +1682,8 @@ ieee80211_free_node(struct ieee80211_node *ni) nt->nt_keyixmap[keyix] == ni) { IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s: %p<%6D> clear key map entry", __func__, - ni, ni->ni_macaddr, ":"); + "%s: %p<%s> clear key map entry", __func__, + ni, kether_ntoa(ni->ni_macaddr, ethstr)); nt->nt_keyixmap[keyix] = NULL; ieee80211_node_decref(ni); /* XXX needed? */ _ieee80211_free_node(ni); @@ -1694,6 +1706,7 @@ ieee80211_node_delucastkey(struct ieee80211_node *ni) struct ieee80211_node *nikey; ieee80211_keyix keyix; int status; + char ethstr[ETHER_ADDRSTRLEN + 1]; /* * NB: We must beware of LOR here; deleting the key @@ -1722,8 +1735,8 @@ ieee80211_node_delucastkey(struct ieee80211_node *ni) KASSERT(nikey == ni, ("key map out of sync, ni %p nikey %p", ni, nikey)); IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s: delete key map entry %p<%6D> refcnt %d\n", - __func__, ni, ni->ni_macaddr, ":", + "%s: delete key map entry %p<%s> refcnt %d\n", + __func__, ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)-1); ieee80211_free_node(ni); } @@ -1739,10 +1752,11 @@ static void node_reclaim(struct ieee80211_node_table *nt, struct ieee80211_node *ni) { ieee80211_keyix keyix; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s: remove %p<%6D> from %s table, refcnt %d\n", - __func__, ni, ni->ni_macaddr, ":", + "%s: remove %p<%s> from %s table, refcnt %d\n", + __func__, ni, kether_ntoa(ni->ni_macaddr, ethstr), nt->nt_name, ieee80211_node_refcnt(ni)-1); /* * Clear any entry in the unicast key mapping table. @@ -1755,8 +1769,8 @@ node_reclaim(struct ieee80211_node_table *nt, struct ieee80211_node *ni) if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax && nt->nt_keyixmap[keyix] == ni) { IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, - "%s: %p<%6D> clear key map entry %u\n", - __func__, ni, ni->ni_macaddr, ":", keyix); + "%s: %p<%s> clear key map entry %u\n", + __func__, ni, kether_ntoa(ni->ni_macaddr, ethstr), keyix); nt->nt_keyixmap[keyix] = NULL; ieee80211_node_decref(ni); /* NB: don't need free */ } @@ -2100,7 +2114,9 @@ restart: void ieee80211_dump_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni) { - kprintf("0x%p: mac %6D refcnt %d\n", ni, ni->ni_macaddr, ":", + char ethstr[ETHER_ADDRSTRLEN + 1]; + + kprintf("0x%p: mac %s refcnt %d\n", ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)); kprintf("\tscangen %u authmode %u flags 0x%x\n", ni->ni_scangen, ni->ni_authmode, ni->ni_flags); @@ -2114,8 +2130,8 @@ ieee80211_dump_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni) kprintf("\trssi %d noise %d intval %u capinfo 0x%x\n", node_getrssi(ni), ni->ni_noise, ni->ni_intval, ni->ni_capinfo); - kprintf("\tbssid %6D essid \"%.*s\" channel %u:0x%x\n", - ni->ni_bssid, ":", + kprintf("\tbssid %s essid \"%.*s\" channel %u:0x%x\n", + kether_ntoa(ni->ni_bssid, ethstr), ni->ni_esslen, ni->ni_essid, ni->ni_chan->ic_freq, ni->ni_chan->ic_flags); kprintf("\tinact %u inact_reload %u txrate %u\n", diff --git a/sys/netproto/802_11/wlan/ieee80211_output.c b/sys/netproto/802_11/wlan/ieee80211_output.c index 2cba9f8444..d8cb285c67 100644 --- a/sys/netproto/802_11/wlan/ieee80211_output.c +++ b/sys/netproto/802_11/wlan/ieee80211_output.c @@ -605,7 +605,9 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type, struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; struct ieee80211_frame *wh; - +#ifdef IEEE80211_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif KASSERT(ni != NULL, ("null node")); if (vap->iv_state == IEEE80211_S_CAC) { @@ -644,8 +646,8 @@ ieee80211_mgmt_output(struct ieee80211_node *ni, struct mbuf *m, int type, /* avoid printing too many frames */ if ((ieee80211_msg_debug(vap) && doprint(vap, type)) || ieee80211_msg_dumppkts(vap)) { - kprintf("[%6D] send %s on channel %u\n", - wh->i_addr1, ":", + kprintf("[%s] send %s on channel %u\n", + kether_ntoa(wh->i_addr1, ethstr), ieee80211_mgt_subtype_name[ (type & IEEE80211_FC0_SUBTYPE_MASK) >> IEEE80211_FC0_SUBTYPE_SHIFT], @@ -1719,6 +1721,7 @@ ieee80211_send_probereq(struct ieee80211_node *ni, const struct ieee80211_rateset *rs; struct mbuf *m; uint8_t *frm; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, @@ -1733,9 +1736,9 @@ ieee80211_send_probereq(struct ieee80211_node *ni, * will remove our reference. */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); @@ -1803,8 +1806,8 @@ ieee80211_send_probereq(struct ieee80211_node *ni, IEEE80211_NODE_STAT(ni, tx_mgmt); IEEE80211_DPRINTF(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_DUMPPKTS, - "send probe req on channel %u bssid %6D ssid \"%.*s\"\n", - ieee80211_chan2ieee(ic, ic->ic_curchan), bssid, ":", + "send probe req on channel %u bssid %s ssid \"%.*s\"\n", + ieee80211_chan2ieee(ic, ic->ic_curchan), kether_ntoa(bssid, ethstr), (int)ssidlen, ssid); memset(¶ms, 0, sizeof(params)); @@ -1867,6 +1870,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) uint8_t *frm; uint16_t capinfo; int has_challenge, is_shared_key, ret, status; + char ethstr[ETHER_ADDRSTRLEN + 1]; KASSERT(ni != NULL, ("null node")); @@ -1876,9 +1880,9 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * will remove our reference. */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, - ni, ni->ni_macaddr, ":", + ni, kether_ntoa(ni->ni_macaddr, ethstr), ieee80211_node_refcnt(ni)+1); ieee80211_ref_node(ni); @@ -2377,6 +2381,7 @@ ieee80211_send_proberesp(struct ieee80211vap *vap, struct ieee80211_node *bss = vap->iv_bss; struct ieee80211com *ic = vap->iv_ic; struct mbuf *m; + char ethstr[ETHER_ADDRSTRLEN + 1]; if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, bss, @@ -2391,8 +2396,8 @@ ieee80211_send_proberesp(struct ieee80211vap *vap, * will remove our reference. */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%6D> refcnt %d\n", - __func__, __LINE__, bss, bss->ni_macaddr, ":", + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", + __func__, __LINE__, bss, kether_ntoa(bss->ni_macaddr, ethstr), ieee80211_node_refcnt(bss)+1); ieee80211_ref_node(bss); @@ -2414,8 +2419,8 @@ ieee80211_send_proberesp(struct ieee80211vap *vap, M_WME_SETAC(m, WME_AC_BE); IEEE80211_DPRINTF(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_DUMPPKTS, - "send probe resp on channel %u to %6D%s\n", - ieee80211_chan2ieee(ic, ic->ic_curchan), da, ":", + "send probe resp on channel %u to %s%s\n", + ieee80211_chan2ieee(ic, ic->ic_curchan), kether_ntoa(da, ethstr), legacy ? " " : ""); IEEE80211_NODE_STAT(bss, tx_mgmt); diff --git a/sys/netproto/802_11/wlan/ieee80211_proto.c b/sys/netproto/802_11/wlan/ieee80211_proto.c index 3d7163b3cc..e0b39e7c69 100644 --- a/sys/netproto/802_11/wlan/ieee80211_proto.c +++ b/sys/netproto/802_11/wlan/ieee80211_proto.c @@ -385,29 +385,30 @@ ieee80211_dump_pkt(struct ieee80211com *ic, { const struct ieee80211_frame *wh; int i; + char ethstr[ETHER_ADDRSTRLEN + 1]; wh = (const struct ieee80211_frame *)buf; switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) { case IEEE80211_FC1_DIR_NODS: - kprintf("NODS %6D", wh->i_addr2, ":"); - kprintf("->%6D", wh->i_addr1, ":"); - kprintf("(%6D)", wh->i_addr3, ":"); + kprintf("NODS %s", kether_ntoa(wh->i_addr2, ethstr)); + kprintf("->%s", kether_ntoa(wh->i_addr1, ethstr)); + kprintf("(%s)", kether_ntoa(wh->i_addr3, ethstr)); break; case IEEE80211_FC1_DIR_TODS: - kprintf("TODS %6D", wh->i_addr2, ":"); - kprintf("->%6D", wh->i_addr3, ":"); - kprintf("(%6D)", wh->i_addr1, ":"); + kprintf("TODS %s", kether_ntoa(wh->i_addr2, ethstr)); + kprintf("->%s", kether_ntoa(wh->i_addr3, ethstr)); + kprintf("(%s)", kether_ntoa(wh->i_addr1, ethstr)); break; case IEEE80211_FC1_DIR_FROMDS: - kprintf("FRDS %6D", wh->i_addr3, ":"); - kprintf("->%6D", wh->i_addr1, ":"); - kprintf("(%6D)", wh->i_addr2, ":"); + kprintf("FRDS %s", kether_ntoa(wh->i_addr3, ethstr)); + kprintf("->%s", kether_ntoa(wh->i_addr1, ethstr)); + kprintf("(%s)", kether_ntoa(wh->i_addr2, ethstr)); break; case IEEE80211_FC1_DIR_DSTODS: - kprintf("DSDS %6D", (const uint8_t *)&wh[1], ":"); - kprintf("->%6D", wh->i_addr3, ":"); - kprintf("(%6D", wh->i_addr2, ":"); - kprintf("->%6D)", wh->i_addr1, ":"); + kprintf("DSDS %s", kether_ntoa((const uint8_t *)&wh[1], ethstr)); + kprintf("->%s", kether_ntoa(wh->i_addr3, ethstr)); + kprintf("(%s", kether_ntoa(wh->i_addr2, ethstr)); + kprintf("->%s)", kether_ntoa(wh->i_addr1, ethstr)); break; } switch (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) { diff --git a/sys/netproto/802_11/wlan/ieee80211_scan.c b/sys/netproto/802_11/wlan/ieee80211_scan.c index 13a5e314d8..36c52c0983 100644 --- a/sys/netproto/802_11/wlan/ieee80211_scan.c +++ b/sys/netproto/802_11/wlan/ieee80211_scan.c @@ -1046,17 +1046,18 @@ dump_probe_beacon(uint8_t subtype, int isnew, const uint8_t mac[IEEE80211_ADDR_LEN], const struct ieee80211_scanparams *sp, int rssi) { + char ethstr[ETHER_ADDRSTRLEN + 1]; - kprintf("[%6D] %s%s on chan %u (bss chan %u) ", - mac, ":", isnew ? "new " : "", + kprintf("[%s] %s%s on chan %u (bss chan %u) ", + kether_ntoa(mac, ethstr), isnew ? "new " : "", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], sp->chan, sp->bchan); ieee80211_print_essid(sp->ssid + 2, sp->ssid[1]); kprintf(" rssi %d\n", rssi); if (isnew) { - kprintf("[%6D] caps 0x%x bintval %u erp 0x%x", - mac, ":", sp->capinfo, sp->bintval, sp->erp); + kprintf("[%s] caps 0x%x bintval %u erp 0x%x", + kether_ntoa(mac, ethstr), sp->capinfo, sp->bintval, sp->erp); if (sp->country != NULL) dump_country(sp->country); kprintf("\n"); diff --git a/sys/netproto/802_11/wlan/ieee80211_scan_sta.c b/sys/netproto/802_11/wlan/ieee80211_scan_sta.c index d1e25b792a..d4e76ed9ad 100644 --- a/sys/netproto/802_11/wlan/ieee80211_scan_sta.c +++ b/sys/netproto/802_11/wlan/ieee80211_scan_sta.c @@ -954,6 +954,7 @@ match_bss(struct ieee80211vap *vap, struct ieee80211_scan_entry *se = &se0->base; uint8_t rate; int fail; + char ethstr[ETHER_ADDRSTRLEN + 1]; fail = 0; if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, se->se_chan))) @@ -1093,7 +1094,7 @@ match_bss(struct ieee80211vap *vap, fail |= MATCH_RSSI; #ifdef IEEE80211_DEBUG if (ieee80211_msg(vap, debug)) { - kprintf(" %c %6D", + kprintf(" %c %s", fail & MATCH_FAILS ? '=' : fail & MATCH_NOTSEEN ? '^' : fail & MATCH_CC ? '$' : @@ -1105,8 +1106,8 @@ match_bss(struct ieee80211vap *vap, fail & MATCH_TDMA_LOCAL ? 'l' : #endif fail & MATCH_MESH_NOID ? 'm' : - fail ? '-' : '+', se->se_macaddr, ":"); - kprintf(" %6D%c", se->se_bssid, ":", + fail ? '-' : '+', kether_ntoa(se->se_macaddr, ethstr)); + kprintf(" %s%c", kether_ntoa(se->se_bssid, ethstr), fail & MATCH_BSSID ? '!' : ' '); kprintf(" %3d%c", ieee80211_chan2ieee(ic, se->se_chan), fail & MATCH_CHANNEL ? '!' : ' '); diff --git a/sys/netproto/802_11/wlan/ieee80211_sta.c b/sys/netproto/802_11/wlan/ieee80211_sta.c index e294a2f9cb..0c64e9cbd6 100644 --- a/sys/netproto/802_11/wlan/ieee80211_sta.c +++ b/sys/netproto/802_11/wlan/ieee80211_sta.c @@ -205,7 +205,9 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; enum ieee80211_state ostate; - +#ifdef IEEE80211_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], @@ -374,10 +376,10 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) case IEEE80211_S_ASSOC: #ifdef IEEE80211_DEBUG if (ieee80211_msg_debug(vap)) { - ieee80211_note(vap, "%s with %6D ssid ", + ieee80211_note(vap, "%s with %s ssid ", (vap->iv_opmode == IEEE80211_M_STA ? "associated" : "synchronized"), - ni->ni_bssid, ":"); + kether_ntoa(ni->ni_bssid, ethstr)); ieee80211_print_essid(vap->iv_bss->ni_essid, ni->ni_esslen); /* XXX MCS/HT */ @@ -517,6 +519,9 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) uint8_t dir, type, subtype, qos; uint8_t *bssid; uint16_t rxseq; +#ifdef IEEE80211_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif if (m->m_flags & M_AMPDU_MPDU) { /* @@ -842,10 +847,10 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) #ifdef IEEE80211_DEBUG if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) || ieee80211_msg_dumppkts(vap)) { - if_printf(ifp, "received %s from %6D rssi %d\n", + if_printf(ifp, "received %s from %s rssi %d\n", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - wh->i_addr2, ":", rssi); + kether_ntoa(wh->i_addr2, ethstr), rssi); } #endif if (wh->i_fc[1] & IEEE80211_FC1_WEP) { diff --git a/sys/netproto/802_11/wlan/ieee80211_wds.c b/sys/netproto/802_11/wlan/ieee80211_wds.c index db5c1c6818..e0048a810a 100644 --- a/sys/netproto/802_11/wlan/ieee80211_wds.c +++ b/sys/netproto/802_11/wlan/ieee80211_wds.c @@ -123,10 +123,11 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) struct ieee80211com *ic = vap->iv_ic; /* struct ieee80211_node_table *nt = &ic->ic_sta;*/ struct ieee80211_node *ni, *obss; + char ethstr[ETHER_ADDRSTRLEN + 1]; IEEE80211_DPRINTF(vap, IEEE80211_MSG_WDS, - "%s: creating link to %6D on channel %u\n", __func__, - vap->iv_des_bssid, ":", ieee80211_chan2ieee(ic, chan)); + "%s: creating link to %s on channel %u\n", __func__, + kether_ntoa(vap->iv_des_bssid, ethstr), ieee80211_chan2ieee(ic, chan)); /* NB: vap create must specify the bssid for the link */ KASSERT(vap->iv_flags & IEEE80211_F_DESBSSID, ("no bssid")); @@ -152,8 +153,8 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) * the vap to be destroyed. */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_WDS, - "%s: station %6D went away\n", - __func__, vap->iv_des_bssid, ":"); + "%s: station %s went away\n", + __func__, kether_ntoa(vap->iv_des_bssid, ethstr)); /* XXX stat? */ } else if (ni->ni_wdsvap != NULL) { /* @@ -164,8 +165,8 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) */ /* XXX printf instead? */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_WDS, - "%s: station %6D in use with %s\n", - __func__, vap->iv_des_bssid, ":", + "%s: station %s in use with %s\n", + __func__, kether_ntoa(vap->iv_des_bssid, ethstr), ni->ni_wdsvap->iv_ifp->if_xname); /* XXX stat? */ } else { @@ -235,9 +236,10 @@ ieee80211_dwds_mcast(struct ieee80211vap *vap0, struct mbuf *m) struct ifnet *ifp; struct mbuf *mcopy; int err; + char ethstr[ETHER_ADDRSTRLEN + 1]; KASSERT(ETHER_IS_MULTICAST(eh->ether_dhost), - ("%6D not mcast", eh->ether_dhost, ":")); + ("%s not mcast", kether_ntoa(eh->ether_dhost, ethstr))); /* XXX locking */ TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { @@ -409,7 +411,9 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ uint8_t dir, type, subtype, qos; uint16_t rxseq; - +#ifdef IEEE80211_DEBUG + char ethstr[ETHER_ADDRSTRLEN + 1]; +#endif if (m->m_flags & M_AMPDU_MPDU) { /* * Fastpath for A-MPDU reorder q resubmission. Frames @@ -697,10 +701,10 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) } #ifdef IEEE80211_DEBUG if (ieee80211_msg_debug(vap) || ieee80211_msg_dumppkts(vap)) { - if_printf(ifp, "received %s from %6D rssi %d\n", + if_printf(ifp, "received %s from %s rssi %d\n", ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT], - wh->i_addr2, ":", rssi); + kether_ntoa(wh->i_addr2, ethstr), rssi); } #endif if (wh->i_fc[1] & IEEE80211_FC1_WEP) { diff --git a/sys/netproto/802_11/wlan_acl/ieee80211_acl.c b/sys/netproto/802_11/wlan_acl/ieee80211_acl.c index 94d3eab04b..c9ab8ac920 100644 --- a/sys/netproto/802_11/wlan_acl/ieee80211_acl.c +++ b/sys/netproto/802_11/wlan_acl/ieee80211_acl.c @@ -168,12 +168,13 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { struct aclstate *as = vap->iv_as; struct acl *acl, *new; + char ethstr[ETHER_ADDRSTRLEN + 1]; int hash; new = (struct acl *) kmalloc(sizeof(struct acl), M_80211_ACL, M_INTWAIT | M_ZERO); if (new == NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, - "ACL: add %6D failed, no memory\n", mac, ":"); + "ACL: add %s failed, no memory\n", kether_ntoa(mac, ethstr)); /* XXX statistic */ return ENOMEM; } @@ -183,8 +184,8 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) { kfree(new, M_80211_ACL); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, - "ACL: add %6D failed, already present\n", - mac, ":"); + "ACL: add %s failed, already present\n", + kether_ntoa(mac, ethstr)); return EEXIST; } } @@ -194,7 +195,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) as->as_nacls++; IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, - "ACL: add %6D\n", mac, ":"); + "ACL: add %s\n", kether_ntoa(mac, ethstr)); return 0; } @@ -203,13 +204,14 @@ acl_remove(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { struct aclstate *as = vap->iv_as; struct acl *acl; + char ethstr[ETHER_ADDRSTRLEN + 1]; acl = _find_acl(as, mac); if (acl != NULL) _acl_free(as, acl); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, - "ACL: remove %6D%s\n", mac, ":", + "ACL: remove %s%s\n", kether_ntoa(mac, ethstr), acl == NULL ? ", not present" : ""); return (acl == NULL ? ENOENT : 0); -- 2.41.0