During the reading rfc1035 I faced the questions.
Here is resource record format section.
Here is message compression section.
4.1.3. Resource record format
The answer, authority, and additional sections all share the same
format: a variable number of resource records, where the number of
records is specified in the corresponding count field in the header.
Each resource record has the following format:
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| |
/ /
/ NAME /
| |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| TYPE |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| CLASS |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| TTL |
| |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| RDLENGTH |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
/ RDATA /
/ /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
where:
NAME a domain name to which this resource record pertains.
Questions:
- Why
NAME
field is presented as at least 2 bytes field, but indeed, it can be 1 byte forROOT
. - Is there a case when
NAME
doesn't use compression? If yes, could you please provide a dump. - Is there a case when
NAME
field is mixed - e.g. sequenve of labels and pointers.
Related 1. and 2. questions I assume it the answers are yes. E.g. Message compression section provides an example where domain name is presented as mix of label sequences and pointers. However, I couldn't find pcap dumps with real examples.
UPD.0: Replace Resource record format image with quote from rfc