ieee80211_scan_sta.c (245928) | ieee80211_scan_sta.c (254315) |
---|---|
1/*- 2 * Copyright (c) 2002-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 --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 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> | 1/*- 2 * Copyright (c) 2002-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 --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 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__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_scan_sta.c 245928 2013-01-26 00:37:54Z adrian $"); | 27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_scan_sta.c 254315 2013-08-14 04:24:25Z rpaulo $"); |
28 29/* 30 * IEEE 802.11 station scanning support. 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 409 unchanged lines hidden (view full) --- 445 [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, 446}; 447 448static void 449add_channels(struct ieee80211vap *vap, 450 struct ieee80211_scan_state *ss, 451 enum ieee80211_phymode mode, const uint16_t freq[], int nfreq) 452{ | 28 29/* 30 * IEEE 802.11 station scanning support. 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 409 unchanged lines hidden (view full) --- 445 [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, 446}; 447 448static void 449add_channels(struct ieee80211vap *vap, 450 struct ieee80211_scan_state *ss, 451 enum ieee80211_phymode mode, const uint16_t freq[], int nfreq) 452{ |
453#define N(a) (sizeof(a) / sizeof(a[0])) | |
454 struct ieee80211com *ic = vap->iv_ic; 455 struct ieee80211_channel *c, *cg; 456 u_int modeflags; 457 int i; 458 | 453 struct ieee80211com *ic = vap->iv_ic; 454 struct ieee80211_channel *c, *cg; 455 u_int modeflags; 456 int i; 457 |
459 KASSERT(mode < N(chanflags), ("Unexpected mode %u", mode)); | 458 KASSERT(mode < nitems(chanflags), ("Unexpected mode %u", mode)); |
460 modeflags = chanflags[mode]; 461 for (i = 0; i < nfreq; i++) { 462 if (ss->ss_last >= IEEE80211_SCAN_MAX) 463 break; 464 465 c = ieee80211_find_channel(ic, freq[i], modeflags); 466 if (c == NULL || isexcluded(vap, c)) 467 continue; 468 if (mode == IEEE80211_MODE_AUTO) { 469 /* 470 * XXX special-case 11b/g channels so we select 471 * the g channel if both are present. 472 */ 473 if (IEEE80211_IS_CHAN_B(c) && 474 (cg = find11gchannel(ic, i, c->ic_freq)) != NULL) 475 c = cg; 476 } 477 ss->ss_chans[ss->ss_last++] = c; 478 } | 459 modeflags = chanflags[mode]; 460 for (i = 0; i < nfreq; i++) { 461 if (ss->ss_last >= IEEE80211_SCAN_MAX) 462 break; 463 464 c = ieee80211_find_channel(ic, freq[i], modeflags); 465 if (c == NULL || isexcluded(vap, c)) 466 continue; 467 if (mode == IEEE80211_MODE_AUTO) { 468 /* 469 * XXX special-case 11b/g channels so we select 470 * the g channel if both are present. 471 */ 472 if (IEEE80211_IS_CHAN_B(c) && 473 (cg = find11gchannel(ic, i, c->ic_freq)) != NULL) 474 c = cg; 475 } 476 ss->ss_chans[ss->ss_last++] = c; 477 } |
479#undef N | |
480} 481 482struct scanlist { 483 uint16_t mode; 484 uint16_t count; 485 const uint16_t *list; 486}; 487 --- 1473 unchanged lines hidden --- | 478} 479 480struct scanlist { 481 uint16_t mode; 482 uint16_t count; 483 const uint16_t *list; 484}; 485 --- 1473 unchanged lines hidden --- |