Deleted Added
full compact
ieee80211.c (178955) ieee80211.c (178957)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 178955 2008-05-11 23:33:56Z sam $");
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 178957 2008-05-12 00:15:30Z sam $");
29
30/*
31 * IEEE 802.11 generic handler
32 */
33#include "opt_wlan.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 19 unchanged lines hidden (view full) ---

56 [IEEE80211_MODE_11G] = "11g",
57 [IEEE80211_MODE_FH] = "FH",
58 [IEEE80211_MODE_TURBO_A] = "turboA",
59 [IEEE80211_MODE_TURBO_G] = "turboG",
60 [IEEE80211_MODE_STURBO_A] = "sturboA",
61 [IEEE80211_MODE_11NA] = "11na",
62 [IEEE80211_MODE_11NG] = "11ng",
63};
29
30/*
31 * IEEE 802.11 generic handler
32 */
33#include "opt_wlan.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

--- 19 unchanged lines hidden (view full) ---

56 [IEEE80211_MODE_11G] = "11g",
57 [IEEE80211_MODE_FH] = "FH",
58 [IEEE80211_MODE_TURBO_A] = "turboA",
59 [IEEE80211_MODE_TURBO_G] = "turboG",
60 [IEEE80211_MODE_STURBO_A] = "sturboA",
61 [IEEE80211_MODE_11NA] = "11na",
62 [IEEE80211_MODE_11NG] = "11ng",
63};
64/* map ieee80211_opmode to the corresponding capability bit */
65const int ieee80211_opcap[IEEE80211_OPMODE_MAX] = {
66 [IEEE80211_M_IBSS] = IEEE80211_C_IBSS,
67 [IEEE80211_M_WDS] = IEEE80211_C_WDS,
68 [IEEE80211_M_STA] = IEEE80211_C_STA,
69 [IEEE80211_M_AHDEMO] = IEEE80211_C_AHDEMO,
70 [IEEE80211_M_HOSTAP] = IEEE80211_C_HOSTAP,
71 [IEEE80211_M_MONITOR] = IEEE80211_C_MONITOR,
72};
73
64static const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] =
65 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
66
67static void ieee80211_syncflag_locked(struct ieee80211com *ic, int flag);
68static void ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag);
69static int ieee80211_media_setup(struct ieee80211com *ic,
70 struct ifmedia *media, int caps, int addsta,
71 ifm_change_cb_t media_change, ifm_stat_cb_t media_stat);

--- 233 unchanged lines hidden (view full) ---

305 * them with ieee80211_vap_attach (below).
306 */
307int
308ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
309 const char name[IFNAMSIZ], int unit, int opmode, int flags,
310 const uint8_t bssid[IEEE80211_ADDR_LEN],
311 const uint8_t macaddr[IEEE80211_ADDR_LEN])
312{
74static const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] =
75 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
76
77static void ieee80211_syncflag_locked(struct ieee80211com *ic, int flag);
78static void ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag);
79static int ieee80211_media_setup(struct ieee80211com *ic,
80 struct ifmedia *media, int caps, int addsta,
81 ifm_change_cb_t media_change, ifm_stat_cb_t media_stat);

--- 233 unchanged lines hidden (view full) ---

315 * them with ieee80211_vap_attach (below).
316 */
317int
318ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
319 const char name[IFNAMSIZ], int unit, int opmode, int flags,
320 const uint8_t bssid[IEEE80211_ADDR_LEN],
321 const uint8_t macaddr[IEEE80211_ADDR_LEN])
322{
313#define IEEE80211_C_OPMODE \
314 (IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | IEEE80211_C_AHDEMO | \
315 IEEE80211_C_MONITOR | IEEE80211_C_WDS)
316 struct ifnet *ifp;
317
318 ifp = if_alloc(IFT_ETHER);
319 if (ifp == NULL) {
320 if_printf(ic->ic_ifp, "%s: unable to allocate ifnet\n",
321 __func__);
322 return ENOMEM;
323 }

--- 12 unchanged lines hidden (view full) ---

336 vap->iv_ifp = ifp;
337 vap->iv_ic = ic;
338 vap->iv_flags = ic->ic_flags; /* propagate common flags */
339 vap->iv_flags_ext = ic->ic_flags_ext;
340 vap->iv_flags_ven = ic->ic_flags_ven;
341 vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
342 vap->iv_htcaps = ic->ic_htcaps;
343 vap->iv_opmode = opmode;
323 struct ifnet *ifp;
324
325 ifp = if_alloc(IFT_ETHER);
326 if (ifp == NULL) {
327 if_printf(ic->ic_ifp, "%s: unable to allocate ifnet\n",
328 __func__);
329 return ENOMEM;
330 }

--- 12 unchanged lines hidden (view full) ---

343 vap->iv_ifp = ifp;
344 vap->iv_ic = ic;
345 vap->iv_flags = ic->ic_flags; /* propagate common flags */
346 vap->iv_flags_ext = ic->ic_flags_ext;
347 vap->iv_flags_ven = ic->ic_flags_ven;
348 vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
349 vap->iv_htcaps = ic->ic_htcaps;
350 vap->iv_opmode = opmode;
351 vap->iv_caps |= ieee80211_opcap[opmode];
344 switch (opmode) {
345 case IEEE80211_M_STA:
346 /* auto-enable s/w beacon miss support */
347 if (flags & IEEE80211_CLONE_NOBEACONS)
348 vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
349 break;
352 switch (opmode) {
353 case IEEE80211_M_STA:
354 /* auto-enable s/w beacon miss support */
355 if (flags & IEEE80211_CLONE_NOBEACONS)
356 vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
357 break;
350 case IEEE80211_M_IBSS:
351 vap->iv_caps |= IEEE80211_C_IBSS;
352 break;
353 case IEEE80211_M_AHDEMO:
354 vap->iv_caps |= IEEE80211_C_AHDEMO;
355 break;
356 case IEEE80211_M_HOSTAP:
357 vap->iv_caps |= IEEE80211_C_HOSTAP;
358 break;
359 case IEEE80211_M_MONITOR:
360 vap->iv_caps |= IEEE80211_C_MONITOR;
361 break;
362 case IEEE80211_M_WDS:
358 case IEEE80211_M_WDS:
363 vap->iv_caps |= IEEE80211_C_WDS;
364 /*
365 * WDS links must specify the bssid of the far end.
366 * For legacy operation this is a static relationship.
367 * For non-legacy operation the station must associate
368 * and be authorized to pass traffic. Plumbing the
369 * vap to the proper node happens when the vap
370 * transitions to RUN state.
371 */

--- 14 unchanged lines hidden (view full) ---

386 if (vap->iv_caps & IEEE80211_C_FF)
387 vap->iv_flags |= IEEE80211_F_FF;
388 if (vap->iv_caps & IEEE80211_C_TURBOP)
389 vap->iv_flags |= IEEE80211_F_TURBOP;
390 /* NB: bg scanning only makes sense for station mode right now */
391 if (vap->iv_opmode == IEEE80211_M_STA &&
392 (vap->iv_caps & IEEE80211_C_BGSCAN))
393 vap->iv_flags |= IEEE80211_F_BGSCAN;
359 /*
360 * WDS links must specify the bssid of the far end.
361 * For legacy operation this is a static relationship.
362 * For non-legacy operation the station must associate
363 * and be authorized to pass traffic. Plumbing the
364 * vap to the proper node happens when the vap
365 * transitions to RUN state.
366 */

--- 14 unchanged lines hidden (view full) ---

381 if (vap->iv_caps & IEEE80211_C_FF)
382 vap->iv_flags |= IEEE80211_F_FF;
383 if (vap->iv_caps & IEEE80211_C_TURBOP)
384 vap->iv_flags |= IEEE80211_F_TURBOP;
385 /* NB: bg scanning only makes sense for station mode right now */
386 if (vap->iv_opmode == IEEE80211_M_STA &&
387 (vap->iv_caps & IEEE80211_C_BGSCAN))
388 vap->iv_flags |= IEEE80211_F_BGSCAN;
394 vap->iv_flags |= IEEE80211_F_DOTH; /* XXX out of caps, just ena */
389 vap->iv_flags |= IEEE80211_F_DOTH; /* XXX no cap, just ena */
395 /* NB: DFS support only makes sense for ap mode right now */
396 if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
397 (vap->iv_caps & IEEE80211_C_DFS))
398 vap->iv_flags_ext |= IEEE80211_FEXT_DFS;
399
400 vap->iv_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */
401 vap->iv_bmissthreshold = IEEE80211_HWBMISS_DEFAULT;
402 vap->iv_dtim_period = IEEE80211_DTIM_DEFAULT;

--- 10 unchanged lines hidden (view full) ---

413 ieee80211_node_vattach(vap);
414 ieee80211_power_vattach(vap);
415 ieee80211_proto_vattach(vap);
416 ieee80211_ht_vattach(vap);
417 ieee80211_scan_vattach(vap);
418 ieee80211_regdomain_vattach(vap);
419
420 return 0;
390 /* NB: DFS support only makes sense for ap mode right now */
391 if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
392 (vap->iv_caps & IEEE80211_C_DFS))
393 vap->iv_flags_ext |= IEEE80211_FEXT_DFS;
394
395 vap->iv_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */
396 vap->iv_bmissthreshold = IEEE80211_HWBMISS_DEFAULT;
397 vap->iv_dtim_period = IEEE80211_DTIM_DEFAULT;

--- 10 unchanged lines hidden (view full) ---

408 ieee80211_node_vattach(vap);
409 ieee80211_power_vattach(vap);
410 ieee80211_proto_vattach(vap);
411 ieee80211_ht_vattach(vap);
412 ieee80211_scan_vattach(vap);
413 ieee80211_regdomain_vattach(vap);
414
415 return 0;
421#undef IEEE80211_C_OPMODE
422}
423
424/*
425 * Activate a vap. State should have been prepared with a
426 * call to ieee80211_vap_setup and by the driver. On return
427 * from this call the vap is ready for use.
428 */
429int

--- 1097 unchanged lines hidden ---
416}
417
418/*
419 * Activate a vap. State should have been prepared with a
420 * call to ieee80211_vap_setup and by the driver. On return
421 * from this call the vap is ready for use.
422 */
423int

--- 1097 unchanged lines hidden ---