From 0b5aeb89eb5cfb8fc799f499dbce999b659ec2f4 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Fri, 5 Jun 2020 00:11:44 +0000 Subject: [PATCH] [net80211] Send a probe request after IBSS node discovery This sends a probe request after IBSS node discovery through beacon frames. This allows things like HT and VHT capabilities to be "negotiated" in adhoc mode. It is .. kinda fire and pray - this isn't retried after discovery so it's quite possible that nodes occasionally don't come up with HT/VHT rate upgrades. At some point it may be a fun side project to add support for retrying these probe requests/negotiations after IBSS node discovery. Tested: * tested with multiple ath(4) NICs in 11n mode. Differential Revision: https://reviews.freebsd.org/D24979 --- sys/net80211/ieee80211_adhoc.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index 24f6ba448e7..ea1519b3381 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -715,6 +715,15 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, wh = mtod(m0, struct ieee80211_frame *); frm = (uint8_t *)&wh[1]; efrm = mtod(m0, uint8_t *) + m0->m_len; + + IEEE80211_DPRINTF(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG, + "%s: recv mgmt frame, addr2=%6D, ni=%p (%6D) fc=%.02x %.02x\n", + __func__, + wh->i_addr2, ":", + ni, + ni->ni_macaddr, ":", + wh->i_fc[0], + wh->i_fc[1]); switch (subtype) { case IEEE80211_FC0_SUBTYPE_PROBE_RESP: case IEEE80211_FC0_SUBTYPE_BEACON: { @@ -788,6 +797,20 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, } else ni = NULL; + /* + * Send a probe request so we announce 11n + * capabilities. + * + * Don't do this if we're scanning. + */ + if (! (ic->ic_flags & IEEE80211_F_SCAN)) + ieee80211_send_probereq(ni, /* node */ + vap->iv_myaddr, /* SA */ + ni->ni_macaddr, /* DA */ + vap->iv_bss->ni_bssid, /* BSSID */ + vap->iv_bss->ni_essid, + vap->iv_bss->ni_esslen); /* SSID */ + } else if (ni->ni_capinfo == 0) { /* * Update faked node created on transmit. @@ -936,11 +959,11 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, vap->iv_stats.is_rx_mgtdiscard++; } else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) && !IEEE80211_IS_MULTICAST(wh->i_addr1)) { - IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, + IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG, wh, NULL, "%s", "not for us"); vap->iv_stats.is_rx_mgtdiscard++; } else if (vap->iv_state != IEEE80211_S_RUN) { - IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, + IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_DEBUG, wh, NULL, "wrong state %s", ieee80211_state_name[vap->iv_state]); vap->iv_stats.is_rx_mgtdiscard++;