RadioTap Archive on lore.kernel.org
 help / color / Atom feed
* [RFA v3] TLV fields for radiotap
@ 2019-04-09 11:15 Johannes Berg
       [not found] ` <d1429268e48cd744bf4ed5fca04959821de2cda6.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2019-04-09 11:15 UTC (permalink / raw)
  To: radiotap-S783fYmB3Ccdnm+yROfE0A

Small change to add some padding to the vendor data, so the vendor data
itself also starts at a 4-byte boundary and alignment can be done
properly if needed.

--
title: TLV fields in radiotap
categories: [suggested]
--
Bit Number:
: 28

Structure:
: list of TLVs detailed below

Required alignment
: 4

Unit(s)
: unspecified

If this bit is set higher bits may not be set (as they cannot be
parsed, given the variable length of this field) and the data of this
field fills the remaining radiotap data (as indicated by the length
field in the header); the data is understood as a type-length-value item
list with the following item structure:

 * u16 type
 * u16 length
 * data ("length" bytes)
 * 0-3 padding bytes
   The whole item is padded to a multiple of 4 bytes length, but that
   padding is not taken into account in the 'length' field.

The type is taken from the regular radiotap type (bit) allocation, but
the special values 29 and 31 are not valid.

The vendor namespace type (30) may be used as a TLV field, but has the
following modified format as a TLV:
 - u16 type (30)
 - u16 length (length of data, as usual)
 - data containing
   - u8 OUI[3]
   - u8 subtype
   - u16 presence type (index of the bit previously used in the
                        presence bitmap, e.g. 0 for BIT(0))
   - u16 reserved (padding for 4-byte alignment of vendor data)
   - vendor data
 - padding (if needed)
As a consequence, multiple TLV fields are needed for multiple vendor
data items.


If field alignment is necessary beyond the 4-byte alignment, type 28
(i.e. this field value) shall be used as padding with an appropriate
length (which would likely often be 0 for 8-byte alignment). This
ensures parser simplicity, it doesn't need to be aware of alignment
rules.


Generators should generate data in fields with type < 28 in regular non-
TLV fields, this ensures backward compatibility.

Generators shall use TLV fields for all fields with type >= 32.

Parsers shall be able to parse TLV fields with partial data present as
indicated by the length of the data, i.e. producers can omit bytes they
don't fill at the end of the data. Such bytes are assumed to be 0.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA v3] TLV fields for radiotap
       [not found] ` <d1429268e48cd744bf4ed5fca04959821de2cda6.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
@ 2019-04-09 11:21   ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2019-04-09 11:21 UTC (permalink / raw)
  To: radiotap-S783fYmB3Ccdnm+yROfE0A

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

Some code to back this up :-)

Here's a preliminary wireshark patch:
https://p.sipsolutions.net/0ad94ec27dbe26ad.txt

It works, but it's debatable if we really should add everything inside
the TLV. I guess we sort of should, but it makes looking for things a
bit tricky, so I guess at least we should resolve the name of the field
in the item_tree.

I should probably also rename item -> field here and in the proposed
spec text.

Here's a very rudimentary - and sort of wrong - patch for hwsim to
generate a sample capture file.

https://p.sipsolutions.net/83c6ff1e85e3e678.txt

It's wrong because it shouldn't put the channel field into a TLV, but
that's good for demonstrating what happens.

Finally, attached is a single packet capture from a test run over hwsim,
which can be used with wireshark.


Once this is adopted I'd try to get the wireshark base changes in, and
then really using it will only happen with future fields, e.g. S1G.

johannes

[-- Attachment #2: tlv-example.pcap --]
[-- Type: application/vnd.tcpdump.pcap, Size: 372 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 11:15 [RFA v3] TLV fields for radiotap Johannes Berg
     [not found] ` <d1429268e48cd744bf4ed5fca04959821de2cda6.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2019-04-09 11:21   ` Johannes Berg

RadioTap Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/radiotap/0 radiotap/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 radiotap radiotap/ https://lore.kernel.org/radiotap \
		radiotap@radiotap.org
	public-inbox-index radiotap

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.netbsd.radiotap


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git