--- src/share/man/man9/ieee80211_radiotap.9 2006/06/28 19:41:59 1.4 +++ src/share/man/man9/ieee80211_radiotap.9 2006/12/25 14:45:33 1.5 @@ -25,11 +25,11 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD$ +.\" $FreeBSD: src/share/man/man9/ieee80211_radiotap.9,v 1.3 2004/07/07 12:59:39 ru Exp $ +.\" $NetBSD: ieee80211_radiotap.9,v 1.9 2006/03/12 03:22:02 dyoung Exp $ .\" $DragonFly$ -.\" $Id: ieee80211_radiotap.9,v 1.4 2006/06/28 19:41:59 swildner Exp $ .\" -.Dd June 25, 2006 +.Dd December 25, 2006 .Dt IEEE80211_RADIOTAP 9 .Os .Sh NAME @@ -54,8 +54,7 @@ Radiotap was designed to balance the des that conserved CPU and memory bandwidth on embedded systems, with the desire for a hardware-independent, extensible format that would support the diverse capabilities of virtually all -802.11 -radios. +802.11 radios. .Pp These considerations led radiotap to settle on a format consisting of a standard preamble followed by an extensible bitmap indicating the @@ -63,17 +62,17 @@ presence of optional capture fields. .Pp The capture fields were packed into the header as compactly as possible, modulo the requirements that they had to be packed swiftly, -with suitable alignment, in the same order as the bits indicating -their presence. +with their natural alignment, +in the same order as the bits indicating their presence. .Pp This typically includes information such as signal quality and timestamps. This information may be used by a variety of user agents, including -.Xr tcpdump 1 . +.Xr tcpdump 8 . It is requested by using the .Xr bpf 4 data-link type -.Dv DLT_IEEE_80211_RADIO . +.Dv DLT_IEEE802_11_RADIO . .Pp .\" Each frame using this attachment has the following header prepended to it: @@ -89,15 +88,35 @@ struct ieee80211_radiotap_header { .\" A device driver implementing .Vt radiotap -typically defines a packed structure embedding an instance of +typically defines a structure embedding an instance of .Vt "struct ieee80211_radiotap_header" at the beginning, -with subsequent fields in the appropriate order, -and a macro to set the bits of the +with subsequent fields naturally aligned, +and in the appropriate order. Also, a driver defines +a macro to set the bits of the .Va it_present bitmap to indicate which fields exist and are filled in by the driver. .\" .Pp +Radiotap capture fields are in little-endian byte order. +.Pp +Radiotap capture fields +.Em must be naturally aligned . +That is, 16-, 32-, and 64-bit fields must begin on 16-, 32-, and +64-bit boundaries, respectively. +In this way, drivers can avoid unaligned accesses to radiotap +capture fields. +radiotap-compliant drivers must insert padding before a capture +field to ensure its natural alignment. +radiotap-compliant packet dissectors, such as +.Xr tcpdump 8 , +expect the padding. +.Pp +Developers beware: all compilers may not pack structs alike. +If a driver developer constructs their radiotap header with a packed +structure, in order to ensure natural alignment, then it is important +that they insert padding bytes by themselves. +.Pp Radiotap headers are copied to the userland via a separate bpf attachment. It is necessary for the driver to create this attachment after calling .Xr ieee80211_ifattach 9 @@ -107,7 +126,7 @@ with the data-link type set to .Dv DLT_IEEE_80211_RADIO . .Pp .\" -When the the information is available, +When the information is available, usually immediately before a link-layer transmission or after a receive, the driver copies it to the bpf layer using the .Fn bpf_ptap @@ -187,7 +206,17 @@ arbitrary, fixed reference. This bit is reserved for any future extensions to the .Vt radiotap structure. -It should not be used at this time. +A driver sets +.Dv IEEE80211_RADIOTAP_EXT +to extend the it_present bitmap +by another 64 bits. +The bitmap can be extended by multiples of 32 bits to 96, 128, 160 +bits or longer, by setting +.Dv IEEE80211_RADIOTAP_EXT +in the extensions. +The bitmap ends at the first extension field where +.Dv IEEE80211_RADIOTAP_EXT +is not set. .El .Sh EXAMPLES Radiotap header for the Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver @@ -229,6 +258,9 @@ The .Nm interface was designed and implemented by .An David Young Aq dyoung@pobox.com . +.An David Young +is the maintainer of the radiotap capture format. +Contact him to add new capture fields. .Pp This manual page was written by .An Bruce M. Simpson Aq bms@FreeBSD.org