Author: avos
Date: Thu Jun  1 20:46:43 2017
New Revision: 319460
URL: https://svnweb.freebsd.org/changeset/base/319460

Log:
  net80211: initialize i_seq for A-MPDU frames.
  
  Fragment number field (part of i_seq) is used for AAD calculation;
  as a result, without this patch every driver without h/w crypto support
  need to clear it before ieee80211_crypto_encap().
  
  Also fixes rtwn(4) A-MPDU Tx with dev.rtwn.%d.hwcrypto tunable
  set to 0 (h/w crypto is disabled).
  
  Tested with:
   * Intel 6205, STA mode.
   * RTL8188EU, STA mode.
  
  Differential Revision:        https://reviews.freebsd.org/D10753

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==============================================================================
--- head/sys/net80211/ieee80211_output.c        Thu Jun  1 20:29:48 2017        
(r319459)
+++ head/sys/net80211/ieee80211_output.c        Thu Jun  1 20:46:43 2017        
(r319460)
@@ -779,6 +779,9 @@ ieee80211_send_setup(
        tap = &ni->ni_tx_ampdu[tid];
        if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap)) {
                m->m_flags |= M_AMPDU_MPDU;
+
+               /* NB: zero out i_seq field (for s/w encryption etc) */
+               *(uint16_t *)&wh->i_seq[0] = 0;
        } else {
                if (IEEE80211_HAS_SEQ(type & IEEE80211_FC0_TYPE_MASK,
                                      type & IEEE80211_FC0_SUBTYPE_MASK))
@@ -1610,6 +1613,9 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee8
                        *(uint16_t *)wh->i_seq =
                            htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
                        M_SEQNO_SET(m, seqno);
+               } else {
+                       /* NB: zero out i_seq field (for s/w encryption etc) */
+                       *(uint16_t *)wh->i_seq = 0;
                }
        } else {
                /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to