Skip to content

doc: update explanation of DNS output#1421

Open
jvns wants to merge 1 commit intothe-tcpdump-group:masterfrom
jvns:output-dns
Open

doc: update explanation of DNS output#1421
jvns wants to merge 1 commit intothe-tcpdump-group:masterfrom
jvns:output-dns

Conversation

@jvns
Copy link
Copy Markdown
Contributor

@jvns jvns commented Mar 12, 2026

The goal here is to structure the output explanation into a bulleted list, to make it easier for users to find the field they're interested in instead of having to search through paragraphs of text. I'm especially interested in making this explanation more accessible to users who are DNS users but haven't read RFC 1035.

There are more details in the commit message. Some things that I'm considering changing, as a kind of self-review:

  • I separated out the fields into "most commonly used fields" and "all the rest of the fields, in order". It's a little weird that they're not all in order, but personally I'm almost always looking for something very simple like "What's the DNS response code?", and I think showing people the most important fields first makes a big difference to folks who have not read RFC 1035 but do know what an NXDOMAIN or a SERVFAIL is.
  • There are some formatting inconsistencies in here still around how I'm using quotes, but decided to make a PR first to see whether this change is actually of interest before fixing them all.
  • I don't necessarily love the Google reference with 8.8.8.8 but it is a short IP address that is a DNS server. I used 192.0.2.1 from the example IP range as a source IP.
  • I think it would be good to say what "DNS" stands for at some point but I haven't worked out where yet.

On the roff formatting:

  • the dns.md file isn't actually intended to be merged, I just had some inline things in there I wanted to point out by commenting on it during review and I felt like it was impossible to read the roff diff so I'm including it for now. I'll delete dns.md and force push before this is merged. I generated the roff from dns.md with lowdown -t man.
  • There's some weirdness where there's an extra newline in the nested list. I'm hoping to find a way to resolve that but I haven't figured it out yet. I find bulleted lists are always a bit challenging in roff but I think it's a lot more readable than paragraphs of prose.
image


DNS requests are formatted as:

> src > dst: id op? flags qtype qclass name (len)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from the current version of the man page, but I'm not sure if it's accurate: I think the ? is intended to mean that op? may not be printed, but qclass and flags also may not be printed and don't have a question mark.

And there's also an option "additional records" section, like [1au]

So maybe this should be:

id op? flags? addl_records? qtype qclass? name (len)

.sp -1
.if t \
.sp -0.25v
.IP "\(bu" 3
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 5 lines are generated by lowdown and I'm not sure whether it's the "right" way to structure a bulleted list in the context of this man page.

pandoc generates a list more like this, which leaves a blank line in between every list item, which takes up a lot of space.

.IP \(bu 2
1
.IP \(bu 2
2
.RS 2
.IP \(bu 2
2.1

* \`\[*n*au\]' means "*n* additional records"
* **Class**: The query class was the normal one, *C_IN*, so it was omitted.
Any other query class would have been printed immediately after the \`A'
* **Other anomalies**: If any of the response bits are set (AA, RA, TC or response code)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous explanation didn't include TC here, I haven't tested whether TC being set is printed in this way or not yet so this might be wrong. Will check.

@fxlb
Copy link
Copy Markdown
Member

fxlb commented Mar 12, 2026

"This branch is 1 commit ahead of and 13 commits behind the-tcpdump-group/tcpdump:master."

Structure the output explanation into a bulleted list, to make it easier
for users to find the field they're interested in.

- Rename the section titles to "DNS Requests" and "DNS Responses"
  because it was hard for me to tell that "TCP and UDP Name Server" were
  meant to refer to DNS.
- Remove the "written in Greek" disclaimer and instead just make it more
  clear for folks who may not have read RFC 1035
- Use IP addresses instead of hostnames in the output examples, since
  that's the recommended way to use tcpdump

Query section:

- In "Other Anomalies", say that tcpdump will also print the hex value
  if "TC" is set in the query

Response section:

- Add a more complete description of how the flags are represented
  (including AA and AD, not just TC and RA). Verified by running some
  test DNS queries.
@jvns
Copy link
Copy Markdown
Contributor Author

jvns commented Mar 12, 2026

Oops, should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants