[bind10-dev] Query ID generation?
Shane Kerr
shane at isc.org
Fri May 21 03:21:18 UTC 2010
All,
I noticed Jinmei made a minor correction here:
http://bind10.isc.org/changeset/1880
His commit message was:
"allow QID 0 (no test for this - I have no good idea to test this case)"
I guess this is quite tricky... in principle the "test" to catch this
would be to confirm that we have little or no bias in our query ID
generation, and that we indeed generate all possible query ID's with
some sort of mathematical definition of "random".
This is not really a problem for the xfrin program itself - it applies
anywhere we generate a query.
One solution would be to create a class to encapsulate query ID
generation, and to perform whatever tests for randomness we want to
there. This seems like a pretty textbook case of the kind of thing you
want in a separate class.
Initially this would be a very simple class, something like:
class DNSQueryIDGenerator:
def __init__(self):
pass
def next_qid(self):
return random.randint(0, 65535)
The question with such a class is always "is this too simple to bother?"
In C++ the answer is "probably not", in Python the answer is "maybe". :)
Any options? Is it worth adding this to the backlog?
--
Shane
More information about the bind10-dev
mailing list