SoftDNS 0.2

Paul Dickson paul at permanentmail.com
Wed Dec 7 15:58:40 MST 2005


On Mon, 05 Dec 2005 15:27:12 -0700, Joseph Sinclair wrote:

> Paul Dickson wrote:
> > Over the last two and half weeks I rewrote tinydns from djbdns in
> > Python.  I have most of the functionality.  I'm missing a bit of the
> > details, specifically the dns database optional parameters, but the core
> > functions pretty well (the first complete end-to-end tests were only done
> > a couple of hours ago, but I've doing module testing as I when along).
> > 
> ----
> What did you use for testing?  Did you use a framework, custom code,
> or manual testing?

I had "if __name__ == '__main__':" at the bottom of two modules/classes
(the server and the database reader). When I ran those files directly
(rather than being imported), that code was run and I could feed in
packets (this is for the server) I captured using ethereal, and compare
them against packets also captured by ethereal.  For the database reader,
I just feed it a test database and visually inspect the results (print
and pp.pprint).


> > In one C routine, I was able to compress it down from 24 lines to one line
> > (although it does have three expressions :-).  A lot of my code expansion
> > over the original is due to comments and debugging artifacts as well as a
> > bit of still emulating C code where I don't totally grok the C code's
> > intent.
> ----
> You can always post to this list with C questions (or any other language for that matter)
> There's bound to be an expert on the list who'd be happy to offer an answer or suggestion.

The problem is not understanding the C, but the overall semantic intent.
This project is a bit like disassembling machine code, but easier because
the block functionality is already exposed.  For example, djbdns uses a
hash table using database.  I had to run through the code by hand
"writing" a couple of entries to the database in order to figure out how
the data was laid out to determine what was being read.  In my code, I
use python's dictionary (with code to allow multiple data for the same
keys), but I still had to know what was being read when it copied the
"next" two bytes from the database, why the offset could change, and get
a list of all data items in the byte string retrieved.

	-Paul



More information about the PLUG-devel mailing list