Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/net80211 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/7c3a2c05d44f
branches:  netbsd-7
changeset: 799909:7c3a2c05d44f
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 15 09:07:57 2016 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #1167):
        sys/net80211/ieee80211_input.c: revision 1.83-1.84
Don't check sequence number on multicast packets in station mode.
Handle overflow of 12bit sequence number.
In station mode filter packets that or not for us in case the
interface is in promiscous mode or doesn't filter packets itself.

diffstat:

 sys/net80211/ieee80211_input.c |  38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 deletions(-)

diffs (77 lines):

diff -r 1ad431b3ac52 -r 7c3a2c05d44f sys/net80211/ieee80211_input.c
--- a/sys/net80211/ieee80211_input.c    Thu May 12 08:49:49 2016 +0000
+++ b/sys/net80211/ieee80211_input.c    Sun May 15 09:07:57 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_input.c,v 1.77 2013/09/13 20:19:53 joerg Exp $       */
+/*     $NetBSD: ieee80211_input.c,v 1.77.4.1 2016/05/15 09:07:57 martin Exp $  */
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.77 2013/09/13 20:19:53 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.77.4.1 2016/05/15 09:07:57 martin Exp $");
 #endif
 
 #include "opt_inet.h"
@@ -224,6 +224,18 @@
                                ic->ic_stats.is_rx_wrongbss++;
                                goto out;
                        }
+
+                       /* Filter out packets not directed to us in case the
+                        * device is in promiscous mode
+                        */
+                       if ((! IEEE80211_IS_MULTICAST(wh->i_addr1))
+                           && (! IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr))) {
+                               IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT,
+                                   bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D",
+                                   ic->ic_myaddr, ":", wh->i_addr1, ":");
+                               ic->ic_stats.is_rx_wrongbss++;
+                               goto out;
+                       }
                        break;
                case IEEE80211_M_IBSS:
                case IEEE80211_M_AHDEMO:
@@ -280,8 +292,11 @@
                }
                ni->ni_rssi = rssi;
                ni->ni_rstamp = rstamp;
-               if (HAS_SEQ(type)) {
-                       u_int8_t tid;
+               if (HAS_SEQ(type) && (ic->ic_opmode != IEEE80211_M_STA ||
+                   !IEEE80211_IS_MULTICAST(wh->i_addr1))) {
+                       u_int8_t tid, retry;
+                       u_int16_t rxno, orxno;
+
                        if (ieee80211_has_qos(wh)) {
                                tid = ((struct ieee80211_qosframe *)wh)->
                                        i_qos[0] & IEEE80211_QOS_TID;
@@ -291,15 +306,20 @@
                        } else
                                tid = 0;
                        rxseq = le16toh(*(u_int16_t *)wh->i_seq);
-                       if ((wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
-                           SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
+                       retry = wh->i_fc[1] & IEEE80211_FC1_RETRY;
+                       rxno = rxseq >> IEEE80211_SEQ_SEQ_SHIFT;
+                       orxno = ni->ni_rxseqs[tid] >> IEEE80211_SEQ_SEQ_SHIFT;
+                       if (retry && (
+                           (orxno == 4095 && rxno == orxno) ||
+                           (orxno != 4095 &&
+                            SEQ_LEQ(rxseq, ni->ni_rxseqs[tid]))
+                           )) {
                                /* duplicate, discard */
                                IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT,
                                    bssid, "duplicate",
                                    "seqno <%u,%u> fragno <%u,%u> tid %u",
-                                   rxseq >> IEEE80211_SEQ_SEQ_SHIFT,
-                                   ni->ni_rxseqs[tid] >>
-                                       IEEE80211_SEQ_SEQ_SHIFT,
+                                   rxno,
+                                   orxno,
                                    rxseq & IEEE80211_SEQ_FRAG_MASK,
                                    ni->ni_rxseqs[tid] &
                                        IEEE80211_SEQ_FRAG_MASK,



Home | Main Index | Thread Index | Old Index