haesbaert / mdnsd

Mdns daemon for OpenBSD.
www.haesbaert.org/openmdns
136 stars 27 forks source link

Supporting T_OPT (extended DNS) #11

Closed kristapsdz closed 7 years ago

kristapsdz commented 7 years ago

I'd noticed lots of invalid packet classes (packet.c, pkt_parse_rr() checking rr->rrs.class) on my machine. Turns out this comes from T_OPT packets, which are different from others.

I'm still working on a patch, but in short, rr->rrs.type needs to be checked for T_OPT (41) before reading for cacheflush and rr->rrs.class. (I.e., after the dname read, which will be blank.) Otherwise, these values are not meaningful, as the T_OPT (RFC 2671) doesn't set the fields appropriately.

haesbaert commented 7 years ago

That would be nice to have.

kristapsdz commented 7 years ago

See enclosed. This parses EDNS (T_OPT) queries and recognises one of them. On debug output, it notes:

pkt_parse_rr: OPT: EDNSD0 'Owner'

Or if the code type is unknown (see the list for all codes):

pkt_parse_rr: OPT: 14 bytes in RDATA section 0, code 4

I still get the following error message, though, with this new parsing in place:

Unprocessed rr in Additional Section

edns0.diff.txt

kristapsdz commented 7 years ago

This is now a pull request.