Re: rfc: "canonical" radiotap parser
David Young <[email protected]>
| Newsgroups | org.netbsd.radiotap |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Dec 10, 2007 at 01:37:30PM +0100, Johannes Berg wrote: > > > I was trying to give the compiler a hint to help it generate better > > code on architectures, such as ARM, where unaligned loads may take > > many instructions. > > Well, yes, but who guarantees that it actually *is* aligned that way? > Radiotap only specifies that the fields are aligned with respect to the > start of the header, but there's nothing that guarantees alignment of > that. The caller of radiotap_parse_first() must supply a 64-bit aligned ieee80211_radiotap_header in the first argument. If the header is not so aligned, then the parse fails right away with RADIOTAP_ERROR_ALIGNMENT. Really, radiotap_parse_first() should require either 32-bit alignment, or alignment as great as the maximum alignment of all of the fields that are present, whichever is greater. I copy radiotap headers to ensure 64-bit alignment in main.c:cap_cb(). Dave -- David Young OJC Technologies [email protected] Urbana, IL * (217) 278-3933 ext 24