I am now ready to begin implementing recursion for Deadwood.
My plan is to write functions that handle the recursion, then revamp the code that handles in-flight requests to be able to handle recursive requests.
The first code I will write is a function that can compare DNS labels in a string to see if they are the same label. If they are, return a 1, otherwise return a 0 (-1 if some error happens while doing this processing).
After doing that, I will write a function that, if given a DNS reply with NS records, converts the NS records in to IPs if there is sufficient information in the AR section of a DNS reply to do so.
Once I do that, I will make a function that sees if a given reply is complete. A complete reply is a reply where the IP or whatever they asked for is in the answer they give us. A CNAME reply is complete if it includes the requested IP/whatever. A "not there" (SOA in NS section) reply is complete. A reply with an IP is complete.
A CNAME reply without the actual IP or whatever is incomplete. As is a NS referral.
Anyway, I hope to start work on this in a day or two.