Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2018 08:24:58 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330462 - stable/11/sys/net80211
Message-ID:  <201803050824.w258OwUT017242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Mar  5 08:24:58 2018
New Revision: 330462
URL: https://svnweb.freebsd.org/changeset/base/330462

Log:
  MFC r308663:
  
  [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:
  stable/11/sys/net80211/ieee80211_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net80211/ieee80211_output.c
==============================================================================
--- stable/11/sys/net80211/ieee80211_output.c	Mon Mar  5 08:22:48 2018	(r330461)
+++ stable/11/sys/net80211/ieee80211_output.c	Mon Mar  5 08:24:58 2018	(r330462)
@@ -2074,6 +2074,7 @@ ieee80211_send_probereq(struct ieee80211_node *ni,
 {
 	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_node *ni,
 	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_node *ni,
 	 *	[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_node *ni,
 		 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_node *ni,
 	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_node *ni,
 	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_node *ni,
 	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_node *ni,
 	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_node *ni,
 	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?201803050824.w258OwUT017242>