# Have you seen DNS TYPE0 CLASS256?
There seems to be a defect-attractor in DNS-packet construction. When people writes `.`-ending in a DNS name in config (eg in order to avoid search-suffix behaviour), some software will construct an invalid DNS question:
- haproxy < 1.8
- gnupg dirmngr
- nongnu LWIP
The sequence is potentially like this:
1. Split name by `.`
2. For each item, construct `${length}${label}` segments. The final empty `label` gets converted to its own `0x0` byte
3. Concat the segments together, then append the empty label `0x0`
4. Append the DNS type & class (always IN/`0x1` for internet)
Thus, now we have a name that ends with `\0\0` (or `00 00` in hexdump view). The question now appends usual Type A (`00 01`), Class IN (`00 01`), but those become misaligned:
```text
Okay:
03 ?? ?? ?? 00 00 01 00 01
ll c o m . TYPE A CLASS IN
Wrong:
03 ?? ?? ?? 00 00 00 01 00 01
ll c o m . TYPE 0 CLASS 256 FORMAT ERROR, idk?
```
I want to generate those wrong Questions on-demand, to observe and quote the various DNS servers' log lines about them.
As well as putting all kind of TYPEs in the Q and see what they get pushed out to https://www.netmeister.org/blog/dns-rrs.html#srv . For example TYPE0 CLASS8448 is a corruption of SRV rr
The core code is
```rust
fn naughty_question(rtype: Rtype) -> Question<Dname<Vec<u8>>> {
let name = Dname::vec_from_str("example.").unwrap();
let mut bytes = name.into_octets();
bytes.push(0);
Question::new_in(
// Safety: I want to do it wrong
unsafe { Dname::from_octets_unchecked(bytes) },
rtype,
)
}
```