3 ms·
One of my first 'learning a language' projects was to write a DNS query in python from scratch. Basically, writing and reading bytes directly. Read the RFCs,
by silisili 4y ago
One of my first 'learning a language' projects was to write a DNS query in python from scratch. Basically, writing and reading bytes directly. Read the RFCs, made sure the format was right, wrote a parser for the reply and...fail. I remember pouring over every detail for about an hour before realizing the qname was missing the trailing dot. So, apparently at least some number of resolvers really demand it.
- lultimouomo 4y agoYou are probably misremembering, as DNS queries and responses don't contain dots (as the article points out). Maybe you were missing the \0 terminator after the last name segment? In which case it's quite clear why the request was failing, as it would have not been unambiguously parseable.
- silisili 4y agoYou're probably right, this was nearly 20 years ago. I only remember because my wife remembered my excitement and always used it to call me a nerd, adjusting her nonexistent glasses, snorting, and say 'i was missing a dot.' In good fun. If I had to guess, I had the function that accepted the query name call a function that split on dots to do the encoding, meaning a missing trailing dot means a missing null terminator.
- ricklamers 4y agoThat’s a really neat project to teach yourself more about the underlying concepts of DNS. Way to go!