[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DNS A record resolution pseudo-code


Looks good to start with! Minor comments:

- Send DNSPacket to port 53, not 453, I guess.
- This is a stub resolver, so no iterative resolution required (hence just a 
single resolution is fine). 

The next step is to start building it up from the inside out: generate a single 
packet for a hardcoded domain (with all the RRsets in the query), and send it 
to a local resolver and see if you get the response back. Once that's working, 
then the rest of the logic can be built up around that function.

In particular, our stack doesn't do a particularly robust job of DNS ID 
selection at the moment (deliberately), but this can be saved till last as it 
only affects security when deployed in production, and not functionality for 
the purposes of a fit prototype resolver.


On 11 Aug 2011, at 13:24, Eireann Leverett wrote:

> Hi all,
> I have mocked up some basic experiments with Mirage and UDP packets and
> DNS packets. However, now it's time to roll up my sleeves and think about
> the structure of the pseudo-code, and what I'd like to eventually commit
> to the project. I think better with a group, out loud as it were so I hope
> you don't mind my leaving this here:
> Initialise PRNG
> Generate Random Port #
> Query Input (initially command line later as args to function)
> Start UDP Listener on Random Port
> Start Timeout Clock
> Determine NSServer to query (Initially hardcoded but later a list from
> config)
> Generate Random Packet ID # and store for reference later
> Construct Query for A record
> Send DNSPacket to NSServer port 453
> If arrive before timeout
>    Parse the reply or report parsing error
>    If good Id #
>        Report resolved name or handle data dependant errors
>    Else bad id #
>        Report potential spoofery
> else timed out
>    Report no results due to timeout
> Close UDP Listener
> Please ask questions and make suggestions/revisions...
> Eireann



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.