Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of options in a block with respect to option code?#152

Open
daluu opened this issue Jan 18, 2024 · 1 comment
Open

Order of options in a block with respect to option code? #152

daluu opened this issue Jan 18, 2024 · 1 comment

Comments

@daluu
Copy link

daluu commented Jan 18, 2024

I was looking at the spec, https://github.com/IETF-OPSAWG-WG/draft-ietf-opsawg-pcap/blob/master/draft-ietf-opsawg-pcapng.md, let me know if I'm viewing the wrong/outdated version.

I didn't find any mention on ordering of options within the options section of a block. Does/should order matter (in terms of order by option code)? Does the spec offer any guidance on this matter?

I'm assuming that this currently is open ended, and readers should be able to handle processing options in any order and writers can write the options in any order. I did some tests in this area and found that Wireshark seems to be able to handle options in any order.

Personally though, for readability, and in cases of working with unit tests around pcapng read/write of options, I'd prefer to write options ordered by option code, and if the reader code were to display/visualize them, I'd also sort and order them (if not needing to render the data as it is exactly written). It's easier to read/skim/look them over in (ascending) order than some undefined order.

I just wanted to pose this question to get the matter clarified. If the spec does mention ordering, please point me to it. Thanks.

@guyharris
Copy link
Collaborator

I didn't find any mention on ordering of options within the options section of a block. Does/should order matter (in terms of order by option code)?

No/no.

I'm assuming that this currently is open ended,

Yes.

and readers should be able to handle processing options in any order

Yes.

and writers can write the options in any order.

Yes.

Personally though, for readability, and in cases of working with unit tests around pcapng read/write of options, I'd prefer to write options ordered by option code,

You're welcome to do so, but other writers are not and will not be required to do so.

Note that, as option codes are assigned sequentially, that order has no significance other than the oder in which options happened to be assigned.

and if the reader code were to display/visualize them, I'd also sort and order them.

Your reader is welcome to do so, but other readers are not and will not be required to do so. A reader may, for example, group them as it chooses, or treat some as more likely to be interesting and put those first, etc..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants