From 04efa18f83d12dca2b69dd4cdb626f92e5ce64f0 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Sun, 26 Dec 2021 17:25:57 +0000 Subject: [PATCH] net80211: add debugging information Add more STATE / DEBUG probes and enhance the output of one in order to track state changes triggered by "ack" (or not). This helped to narrow down causes from drivers or the LinuxKPI 802.11 compat framework which kept us in a scan -> auth -> scan loop. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/net80211/ieee80211_node.c | 3 +++ sys/net80211/ieee80211_output.c | 18 +++++++++++++++++- sys/net80211/ieee80211_proto.c | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 95bed7821d1..80694c650ed 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -895,6 +895,9 @@ ieee80211_sta_join1(struct ieee80211_node *selbs) * us to try to re-authenticate if we are operating * as a station. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_AUTH, + "%s %p<%s> -> AUTH, FC0_SUBTYPE_DEAUTH\n", + __func__, selbs, ether_sprintf(selbs->ni_macaddr)); ieee80211_new_state(vap, IEEE80211_S_AUTH, IEEE80211_FC0_SUBTYPE_DEAUTH); } diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 9b1898df7b1..66d659af086 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -3378,6 +3378,12 @@ ieee80211_tx_mgt_timeout(void *arg) { struct ieee80211vap *vap = arg; + IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, + "vap %p mode %s state %s flags %#x & %#x\n", vap, + ieee80211_opmode_name[vap->iv_opmode], + ieee80211_state_name[vap->iv_state], + vap->iv_ic->ic_flags, IEEE80211_F_SCAN); + IEEE80211_LOCK(vap->iv_ic); if (vap->iv_state != IEEE80211_S_INIT && (vap->iv_ic->ic_flags & IEEE80211_F_SCAN) == 0) { @@ -3423,6 +3429,11 @@ ieee80211_tx_mgt_cb(struct ieee80211_node *ni, void *arg, int status) * XXX what happens if !acked but response shows up before callback? */ if (vap->iv_state == ostate) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, + "ni %p mode %s state %s ostate %d arg %p status %d\n", ni, + ieee80211_opmode_name[vap->iv_opmode], + ieee80211_state_name[vap->iv_state], ostate, arg, status); + callout_reset(&vap->iv_mgtsend, status == 0 ? IEEE80211_TRANS_WAIT*hz : 0, ieee80211_tx_mgt_timeout, vap); @@ -4170,8 +4181,13 @@ ieee80211_tx_complete(struct ieee80211_node *ni, struct mbuf *m, int status) if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); } else if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - if (m->m_flags & M_TXCB) + if (m->m_flags & M_TXCB) { + IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, + "ni %p vap %p mode %s state %s m %p status %d\n", ni, ni->ni_vap, + ieee80211_opmode_name[ni->ni_vap->iv_opmode], + ieee80211_state_name[ni->ni_vap->iv_state], m, status); ieee80211_process_callback(ni, m, status); + } ieee80211_free_node(ni); } m_freem(m); diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index ad27275d8cf..98a04e5251f 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -2654,8 +2654,8 @@ ieee80211_new_state_locked(struct ieee80211vap *vap, } ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, - "%s: %s -> %s (nrunning %d nscanning %d)\n", __func__, - ieee80211_state_name[ostate], ieee80211_state_name[nstate], + "%s: %s -> %s (arg %d) (nrunning %d nscanning %d)\n", __func__, + ieee80211_state_name[ostate], ieee80211_state_name[nstate], arg, nrunning, nscanning); switch (nstate) { case IEEE80211_S_SCAN: