ieee80211_adhoc.c (282742) | ieee80211_adhoc.c (282820) |
---|---|
1/*- 2 * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> 27#ifdef __FreeBSD__ | 1/*- 2 * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> 27#ifdef __FreeBSD__ |
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_adhoc.c 282742 2015-05-10 22:07:53Z adrian $"); | 28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_adhoc.c 282820 2015-05-12 16:55:50Z adrian $"); |
29#endif 30 31/* 32 * IEEE 802.11 IBSS mode support. 33 */ 34#include "opt_inet.h" 35#include "opt_wlan.h" 36 --- 249 unchanged lines hidden (view full) --- 286 * during AP scanning to select a AP to associate with; it can have 287 * any units so long as values have consistent units and higher values 288 * mean ``better signal''. The receive timestamp is currently not used 289 * by the 802.11 layer. 290 */ 291static int 292adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) 293{ | 29#endif 30 31/* 32 * IEEE 802.11 IBSS mode support. 33 */ 34#include "opt_inet.h" 35#include "opt_wlan.h" 36 --- 249 unchanged lines hidden (view full) --- 286 * during AP scanning to select a AP to associate with; it can have 287 * any units so long as values have consistent units and higher values 288 * mean ``better signal''. The receive timestamp is currently not used 289 * by the 802.11 layer. 290 */ 291static int 292adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) 293{ |
294#define HAS_SEQ(type) ((type & 0x4) == 0) | |
295 struct ieee80211vap *vap = ni->ni_vap; 296 struct ieee80211com *ic = ni->ni_ic; 297 struct ifnet *ifp = vap->iv_ifp; 298 struct ieee80211_frame *wh; 299 struct ieee80211_key *key; 300 struct ether_header *eh; 301 int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ 302 uint8_t dir, type, subtype, qos; --- 106 unchanged lines hidden (view full) --- 409 ni = ieee80211_fakeup_adhoc_node(vap, wh->i_addr2); 410 if (ni == NULL) { 411 /* NB: stat kept for alloc failure */ 412 goto err; 413 } 414 } 415 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); 416 ni->ni_noise = nf; | 294 struct ieee80211vap *vap = ni->ni_vap; 295 struct ieee80211com *ic = ni->ni_ic; 296 struct ifnet *ifp = vap->iv_ifp; 297 struct ieee80211_frame *wh; 298 struct ieee80211_key *key; 299 struct ether_header *eh; 300 int hdrspace, need_tap = 1; /* mbuf need to be tapped. */ 301 uint8_t dir, type, subtype, qos; --- 106 unchanged lines hidden (view full) --- 408 ni = ieee80211_fakeup_adhoc_node(vap, wh->i_addr2); 409 if (ni == NULL) { 410 /* NB: stat kept for alloc failure */ 411 goto err; 412 } 413 } 414 IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); 415 ni->ni_noise = nf; |
417 if (HAS_SEQ(type) && IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { | 416 if (IEEE80211_HAS_SEQ(type, subtype) && 417 IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { |
418 uint8_t tid = ieee80211_gettid(wh); 419 if (IEEE80211_QOS_HAS_SEQ(wh) && 420 TID_TO_WME_AC(tid) >= WME_AC_VI) 421 ic->ic_wme.wme_hipri_traffic++; 422 rxseq = le16toh(*(uint16_t *)wh->i_seq); 423 if (! ieee80211_check_rxseq(ni, wh)) { 424 /* duplicate, discard */ 425 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, --- 539 unchanged lines hidden --- | 418 uint8_t tid = ieee80211_gettid(wh); 419 if (IEEE80211_QOS_HAS_SEQ(wh) && 420 TID_TO_WME_AC(tid) >= WME_AC_VI) 421 ic->ic_wme.wme_hipri_traffic++; 422 rxseq = le16toh(*(uint16_t *)wh->i_seq); 423 if (! ieee80211_check_rxseq(ni, wh)) { 424 /* duplicate, discard */ 425 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, --- 539 unchanged lines hidden --- |