Commit Graph

681 Commits

Author SHA1 Message Date
Rui Paulo
f59310a164 Fix typo in comment
Submitted by:	Paul B Mahol <onemda at gmail.com>
2009-12-08 00:54:08 +00:00
Antoine Brodin
d673ae81ed Remove trailing ";" in struct ieee80211_beacon_offsets declaration
Found by:	phk's FlexeLint in September
Reviewed by:	rpaulo@
MFC after:	1 month
2009-11-11 15:00:56 +00:00
Antoine Brodin
b181440e36 Fix off by one in ieee80211_send_action_register
Found by:	phk's FlexeLint in September
Reviewed by:	rpaulo@
MFC after:	1 month
2009-11-11 14:58:48 +00:00
Rui Paulo
d28e9c146a The isr_intval in ieee80211req_scan_result structure should be 16 bit.
This makes ifconfig list scan display the correct beacon interval
(previously it would int overflow). As a side effect, this makes the
ieee80211req_scan_result word aligned.

Submitted by:	Paul B Mahol <onemda at gmail.com>
2009-11-09 11:23:37 +00:00
John Baldwin
e1b17582f4 Take a step towards removing if_watchdog/if_timer. Don't explicitly set
if_watchdog/if_timer to NULL/0 when initializing an ifnet.  if_alloc()
sets those members to NULL/0 already.
2009-11-06 14:55:01 +00:00
Rui Paulo
71a7750434 Update the route's sequence number upon receiving a RANN.
MFC after:	3 days
2009-10-29 12:19:10 +00:00
Rui Paulo
d392e74276 The draft spec doesn't say beacon frames need to have a wildcard BSSID,
so remove the mesh code necessary for that.

MFC after:	2 days
2009-10-23 11:13:08 +00:00
Rui Paulo
038abe369e Initialize rann_flags properly.
MFC after:	2 days
2009-10-22 17:30:22 +00:00
Rui Paulo
357864c2dd Don't call the newstate callback as that's dangerous. Rely no ENETRESET
to DTRT.

MFC after:	3 days
2009-10-21 19:31:23 +00:00
Rui Paulo
d5e9eabead Fix a bug in composing PERR frames introduced by latest draft update.
MFC after:	3 days
2009-10-19 23:11:43 +00:00
Rui Paulo
d093681c60 Implement the missing support for updating the mesh conf number of
neighbors via ieee80211_beacon_notify().

MFC after:	3 days
2009-10-19 18:46:22 +00:00
Rui Paulo
34413c0e2b HWMP fixes, namely:
* fix the processing of RANN frames
* the originator and target addresses were swapped and while it worked
fine, it was not spec compliant.

MFC after:	3 days
2009-10-19 11:17:46 +00:00
Rui Paulo
fe1b9e2ada Properly initialize the mesh conf capabilities byte.
MFC after:	2 days
2009-10-13 10:43:17 +00:00
Rui Paulo
f78595fa10 Fix a wrong initialization that snuck in the latest commit.
MFC after:	3 days
2009-10-12 10:30:15 +00:00
Rui Paulo
6b8c18292c Another 3.03 draft bit that I missed in the previous 802.11s stack
update. The Mesh Configuration IE has changed quite a bit. Refactor the
code to handle this change.

MFC after:	3 days
2009-10-12 10:08:58 +00:00
Rui Paulo
c77735e28f Update 802.11s mesh support to draft 3.03. This includes a revised frame
format for peering and changes to the PERR frames.
Note that this is incompatible with the previous code.

Reviewed by:	sam
MFC after:	1 week
2009-09-22 18:18:14 +00:00
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
Sam Leffler
8460188c5b correct timeout for doing NOL processing; need a ticks-relative value
Obtained from:	Marvell
MFC after:	3 days
2009-09-03 16:29:02 +00:00
Sam Leffler
c32539d4c0 on transition to SLEEP state mark the station in power save, not awake
MFC after:	3 days
2009-09-03 16:24:21 +00:00
Rui Paulo
fbe007da74 Fix a typo in ifdef mesh support. This would make mesh unworkable if
TDMA support was compiled out.

Approved by:	re (kib)
2009-08-17 12:57:57 +00:00
Sam Leffler
ab501dd65d Drain link state event changes posted during vap destroy. This is a
band-aid for the general problem that if_link_state_change can be
called between if_detach and if_free leaving a task queued that has
been free'd.

Spotted by:	thompsa
Reviewed by:	rwatson
Approved by:	re (rwatson)
2009-08-12 21:19:19 +00:00
Robert Watson
530c006014 Merge the remainder of kern_vimage.c and vimage.h into vnet.c and
vnet.h, we now use jails (rather than vimages) as the abstraction
for virtualization management, and what remained was specific to
virtual network stacks.  Minor cleanups are done in the process,
and comments updated to reflect these changes.

Reviewed by:	bz
Approved by:	re (vimage blanket)
2009-08-01 19:26:27 +00:00
Sam Leffler
faf666aa77 fix misplaced #endif that caused tdma handling to be merged with ESS handling
(causing tdma scanning to break)

Approved by:	re (kib)
2009-07-31 19:13:16 +00:00
Sam Leffler
2dfcbb0e2e Filter setting IFF_PROMISC on tdma vaps; we don't want the underyling device
to be in promiscuous mode as we have a h/w bssid.

Approved by:	re (kib)
2009-07-31 19:12:19 +00:00
Rui Paulo
3ca80f0dbc Mesh fixes, namely:
* don't clobber proxy entries
* HWMP seq number processing, including discard of old frames
* flush routing table entries based on nexthop
* print route flags in ifconfig
* more debugging messages and comments

Proxy changes submitted by sam.

Approved by:	re (kib)
2009-07-27 14:22:09 +00:00
Sam Leffler
8ed1835dea revert OACTIVE part of r195845; instead fix the comment so it does not refer
to the old hack removed in r193312

Approved by:	re (implicit)
2009-07-24 15:37:02 +00:00
Sam Leffler
ff5aac8eb7 correct handling of IFF_PROMISC; this should not be pushed to the parent
device except for monitor and ahdemo mode vaps

Reviewed by:	rpaulo
Approved by:	re (kensmith)
2009-07-24 15:28:29 +00:00
Sam Leffler
983a2c892b monitor mode vaps are meant to be read-only so they can operate on any
frequency w/o regulatory issues, do this by hooking if_transmit and
if_output with routines that discard all transmits

Reviewed by:	thompsa, cbzimmer (intent)
Approved by:	re (kensmith)
2009-07-24 15:27:02 +00:00
Sam Leffler
224881b466 o kill old code no longer needed after r193312
o count output packets+errors for frames sent through ieee80211_output

Approved by:	re (kensmith)
2009-07-24 15:22:12 +00:00
Sam Leffler
e50821abe7 store mesh timers as ticks and sysctls for changing the defaults
Reviewed by:	rpaulo
Approved by:	re (kib)
2009-07-21 19:38:22 +00:00
Sam Leffler
411ccf5f63 Correct handling of keys that already have a hardware/device key index:
this was broken in r183248 when the check of wk_keyix was replaced by
a check of IEEE80211_KEY_DEVKEY (because the flag was clobbered).  Define
IEEE80211_KEY_DEVICE to specify flags that are owned by net80211/driver
and use this to preserve IEEE80211_KEY_DEVKEY so we don't ask the driver
for another key index when we already have one.

Testing by:	Daniel Thiele, Wes Morgan
Reviewed by:	rpaulo
Approved by:	re (kib)
2009-07-21 19:36:32 +00:00
Rui Paulo
c104cff26e More mesh bits, namely:
* bridge support (sam)
* handling of errors (sam)
* deletion of inactive routing entries
* more debug msgs (sam)
* fixed some inconsistencies with the spec.
* decap is now specific to mesh (sam)
* print mesh seq. no. on ifconfig list mesh
* small perf. improvements

Reviewed by:	sam
Approved by:	re (kib)
2009-07-20 19:12:08 +00:00
Sam Leffler
519f677aff Move code that does payload realigment to a new routine, ieee80211_realign,
so it can be reused.  While here rewrite the logic to always use a single mbuf.

Reviewed by:	rpaulo
Approved by:	re (kib)
2009-07-18 20:19:53 +00:00
Robert Watson
eddfbb763d Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator.  Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...).  This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.

Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack.  Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory.  Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.

Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy.  Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address.  When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.

This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.

Bump __FreeBSD_version and update UPDATING.

Portions submitted by:  bz
Reviewed by:            bz, zec
Discussed with:         gnn, jamie, jeff, jhb, julian, sam
Suggested by:           peter
Approved by:            re (kensmith)
2009-07-14 22:48:30 +00:00
Rui Paulo
aec0289d59 Fix inline function declaration and prototype.
Approved by:	re (kensmith)
2009-07-13 18:23:58 +00:00
Rui Paulo
59aa14a91d Implementation of the upcoming Wireless Mesh standard, 802.11s, on the
net80211 wireless stack. This work is based on the March 2009 D3.0 draft
standard. This standard is expected to become final next year.
This includes two main net80211 modules, ieee80211_mesh.c
which deals with peer link management, link metric calculation,
routing table control and mesh configuration and ieee80211_hwmp.c
which deals with the actually routing process on the mesh network.
HWMP is the mandatory routing protocol on by the mesh standard, but
others, such as RA-OLSR, can be implemented.

Authentication and encryption are not implemented.

There are several scripts under tools/tools/net80211/scripts that can be
used to test different mesh network topologies and they also teach you
how to setup a mesh vap (for the impatient: ifconfig wlan0 create
wlandev ... wlanmode mesh).

A new build option is available: IEEE80211_SUPPORT_MESH and it's enabled
by default on GENERIC kernels for i386, amd64, sparc64 and pc98.

Drivers that support mesh networks right now are: ath, ral and mwl.

More information at: http://wiki.freebsd.org/WifiMesh

Please note that this work is experimental. Also, please note that
bridging a mesh vap with another network interface is not yet supported.

Many thanks to the FreeBSD Foundation for sponsoring this project and to
Sam Leffler for his support.
Also, I would like to thank Gateworks Corporation for sending me a
Cambria board which was used during the development of this project.

Reviewed by:	sam
Approved by:	re (kensmith)
Obtained from:	projects/mesh11s
2009-07-11 15:02:45 +00:00
Sam Leffler
8b10ecb67c mark struct ieee80211req_maclist packed so sizeof works as intended on arm;
fixes "list mac"

Approved by:	re (kensmith)
2009-07-10 15:26:33 +00:00
Sam Leffler
f6c09dd6a8 correctly set the tailq ptr when removing the last item in the q
Approved by:	re (kensmith)
2009-07-10 02:19:57 +00:00
Sam Leffler
5b16c28c42 Add ieee80211_ageq; a facility for staging packets that require
long-term work before they can be serviced.  Packets are tagged and
assigned an age (in seconds) at the point they are added to the
queue.  If a packet is not retrieved before it's age expires it is
reclaimed.  Tagging can take two forms: a reference to an ieee80211_node
(as happens in the tx path) or an opaque token in cases where there
is no reference or the node structure is not stable (i.e. it's going
to be destroyed).

o add ic_stageq to replace the per-node wds staging queue used for
  dynamic wds
o add ieee80211_mac_hash for building ageq tokens; this computes a
  32-bit hash from an 802.11 mac address (copied from the bridge)
o while here fix a stray ';' noticed in IEEE80211_PSQ_INIT

Reviewed by:	rpaulo
Approved by:	re (kensmith)
2009-07-05 18:17:37 +00:00
Sam Leffler
7634012302 Revamp 802.11 action frame handling:
o add a new facility for components to register send+recv handlers
o ieee80211_send_action and ieee80211_recv_action now use the registered
  handlers to dispatch operations
o rev ieee80211_send_action api to enable passing arbitrary data
o rev ieee80211_recv_action api to pass the 802.11 frame header as it may
  be difficult to locate
o update existing IEEE80211_ACTION_CAT_BA and IEEE80211_ACTION_CAT_HT handling
o update mwl for api rev

Reviewed by:	rpaulo
Approved by:	re (kensmith)
2009-07-05 17:59:19 +00:00
Robert Watson
8c0fec805f Modify most routines returning 'struct ifaddr *' to return references
rather than pointers, requiring callers to properly dispose of those
references.  The following routines now return references:

  ifaddr_byindex
  ifa_ifwithaddr
  ifa_ifwithbroadaddr
  ifa_ifwithdstaddr
  ifa_ifwithnet
  ifaof_ifpforaddr
  ifa_ifwithroute
  ifa_ifwithroute_fib
  rt_getifa
  rt_getifa_fib
  IFP_TO_IA
  ip_rtaddr
  in6_ifawithifp
  in6ifa_ifpforlinklocal
  in6ifa_ifpwithaddr
  in6_ifadd
  carp_iamatch6
  ip6_getdstifaddr

Remove unused macro which didn't have required referencing:

  IFP_TO_IA6

This closes many small races in which changes to interface
or address lists while an ifaddr was in use could lead to use of freed
memory (etc).  In a few cases, add missing if_addr_list locking
required to safely acquire references.

Because of a lack of deep copying support, we accept a race in which
an in6_ifaddr pointed to by mbuf tags and extracted with
ip6_getdstifaddr() doesn't hold a reference while in transmit.  Once
we have mbuf tag deep copy support, this can be fixed.

Reviewed by:	bz
Obtained from:	Apple, Inc. (portions)
MFC after:	6 weeks (portions)
2009-06-23 20:19:09 +00:00
Bjoern A. Zeeb
5736e6fb9d After cleaning up rt_tables from vnet.h and cleaning up opt_route.h
a lot of files no longer need route.h either. Garbage collect them.
While here remove now unneeded vnet.h #includes as well.
2009-06-23 17:03:45 +00:00
Rui Paulo
9d0a7bee3b ieee80211_dwds_mcast(): check the correct mbuf ptr after encap. 2009-06-18 21:15:41 +00:00
Sam Leffler
4fbdba9588 Rev IEEE80211_IOC_STA_INFO abi: ni_flags grew from 16 bits to 32
bits but isi_state did not follow; expand it to 32 bits and pad to
maintain alignment.  Note this is an incompatible change that
requires rebuilding of user applications.

Submitted by:	rpaulo, cbzimmer, avatar
2009-06-13 23:43:00 +00:00
Sam Leffler
385a7316b4 make implicit pad visible 2009-06-11 17:10:21 +00:00
Sam Leffler
6ac5ee4a22 use negotiated short gi to calculate the tx rate; using the htcaps
does not take into account local state (e.g. manual disable of sgi)
2009-06-11 17:09:39 +00:00
Sam Leffler
d77148fbca When associating to an AP we don't know if HT is negotiated until
we receive the AssocResp, so we can only set ni_txparms properly
at that point.  To make this possible make node_setuptxparms public
as ieee80211_node_setuptxparms.
2009-06-11 04:43:42 +00:00
Sam Leffler
92c4a81cc1 protect callouts with the com lock
Prodded by:	jhb
2009-06-09 17:12:19 +00:00
Sam Leffler
e95e0edba9 add missing calls to ieee80211_dfs_attach/detach 2009-06-09 17:11:41 +00:00