Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Nov 2016 01:47:37 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308663 - head/sys/net80211
Message-ID:  <201611150147.uAF1lb3f095221@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Tue Nov 15 01:47:37 2016
New Revision: 308663
URL: https://svnweb.freebsd.org/changeset/base/308663

Log:
  [net80211] announce 11n capabilities in probe requests in IBSS mode.
  
  The 802.11-2012 specification notes that a subset of IEs should be present
  in IBSS probe requests.  This is what (initially) allows nodes to discover
  that other nodes are 11n capable.  Notably - HTCAP, but not HTINFO.
  
  This isn't everything required to reliably enable 11n between net80211
  peers; there's more work to come.
  
  Tested:
  
  * AR9380, IBSS+11n mode

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c	Tue Nov 15 01:41:45 2016	(r308662)
+++ head/sys/net80211/ieee80211_output.c	Tue Nov 15 01:47:37 2016	(r308663)
@@ -2074,6 +2074,7 @@ ieee80211_send_probereq(struct ieee80211
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ieee80211_node *bss;
 	const struct ieee80211_txparam *tp;
 	struct ieee80211_bpf_params params;
 	const struct ieee80211_rateset *rs;
@@ -2081,10 +2082,13 @@ ieee80211_send_probereq(struct ieee80211
 	uint8_t *frm;
 	int ret;
 
+	bss = ieee80211_ref_node(vap->iv_bss);
+
 	if (vap->iv_state == IEEE80211_S_CAC) {
 		IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni,
 		    "block %s frame in CAC state", "probe request");
 		vap->iv_stats.is_tx_badstate++;
+		ieee80211_free_node(bss);
 		return EIO;		/* XXX */
 	}
 
@@ -2106,6 +2110,7 @@ ieee80211_send_probereq(struct ieee80211
 	 *	[tlv] supported rates
 	 *	[tlv] RSN (optional)
 	 *	[tlv] extended supported rates
+	 *	[tlv] HT cap (optional)
 	 *	[tlv] WPA (optional)
 	 *	[tlv] user-specified ie's
 	 */
@@ -2113,6 +2118,8 @@ ieee80211_send_probereq(struct ieee80211
 		 ic->ic_headroom + sizeof(struct ieee80211_frame),
 	       	 2 + IEEE80211_NWID_LEN
 	       + 2 + IEEE80211_RATE_SIZE
+	       + sizeof(struct ieee80211_ie_htcap)
+	       + sizeof(struct ieee80211_ie_htinfo)
 	       + sizeof(struct ieee80211_ie_wpa)
 	       + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE)
 	       + sizeof(struct ieee80211_ie_wpa)
@@ -2122,6 +2129,7 @@ ieee80211_send_probereq(struct ieee80211
 	if (m == NULL) {
 		vap->iv_stats.is_tx_nobuf++;
 		ieee80211_free_node(ni);
+		ieee80211_free_node(bss);
 		return ENOMEM;
 	}
 
@@ -2130,6 +2138,27 @@ ieee80211_send_probereq(struct ieee80211
 	frm = ieee80211_add_rates(frm, rs);
 	frm = ieee80211_add_rsn(frm, vap);
 	frm = ieee80211_add_xrates(frm, rs);
+
+	/*
+	 * Note: we can't use bss; we don't have one yet.
+	 *
+	 * So, we should announce our capabilities
+	 * in this channel mode (2g/5g), not the
+	 * channel details itself.
+	 */
+	if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
+	    (vap->iv_flags_ht & IEEE80211_FHT_HT)) {
+		struct ieee80211_channel *c;
+
+		/*
+		 * Get the HT channel that we should try upgrading to.
+		 * If we can do 40MHz then this'll upgrade it appropriately.
+		 */
+		c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan,
+		    vap->iv_flags_ht);
+		frm = ieee80211_add_htcap_ch(frm, vap, c);
+	}
+
 	frm = ieee80211_add_wpa(frm, vap);
 	if (vap->iv_appie_probereq != NULL)
 		frm = add_appie(frm, vap->iv_appie_probereq);
@@ -2141,6 +2170,7 @@ ieee80211_send_probereq(struct ieee80211
 	if (m == NULL) {
 		/* NB: cannot happen */
 		ieee80211_free_node(ni);
+		ieee80211_free_node(bss);
 		return ENOMEM;
 	}
 
@@ -2157,8 +2187,11 @@ ieee80211_send_probereq(struct ieee80211
 	IEEE80211_NODE_STAT(ni, tx_mgmt);
 
 	IEEE80211_DPRINTF(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_DUMPPKTS,
-	    "send probe req on channel %u bssid %s ssid \"%.*s\"\n",
-	    ieee80211_chan2ieee(ic, ic->ic_curchan), ether_sprintf(bssid),
+	    "send probe req on channel %u bssid %s sa %6D da %6D ssid \"%.*s\"\n",
+	    ieee80211_chan2ieee(ic, ic->ic_curchan),
+	    ether_sprintf(bssid),
+	    sa, ":",
+	    da, ":",
 	    ssidlen, ssid);
 
 	memset(&params, 0, sizeof(params));
@@ -2173,6 +2206,7 @@ ieee80211_send_probereq(struct ieee80211
 	params.ibp_power = ni->ni_txpower;
 	ret = ieee80211_raw_output(vap, ni, m, &params);
 	IEEE80211_TX_UNLOCK(ic);
+	ieee80211_free_node(bss);
 	return (ret);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611150147.uAF1lb3f095221>