dnsjnio, TCP and port randomisation
Well, I suppose we can all be too hasty. It doesn’t stop the embarrassment, though…
After Dan Kaminsky reported his DNS vulnerability, it seemed that port randomisation was A Good Thing. So, I removed the useSinglePort feature from dnsjnio (even though it had been one of the original selling points!).
Then, a potential new dnsjnio user downloaded the beta release, and found that the demo (DemoClient.java) broke horribly. This had been my second mistake - not to test the demo code along with the test code in my automated tests. It had been a long time since I looked at the demo code; it showed how to use dnsjnio to perform 50,000 concurrent lookups over a single TCP port (not a conventional use of the DNS, but still a valid one). Of course, since I’d removed the ability to use a single TCP port (my first mistake), this resulted in the poor demo code attempting to run 50,000 queries on a port each!
I’ve now reinstated the useSinglePort feature for dnsjnio, but have only enabled it for TCP. If you try to use it for UDP, it will be ignored, and a new, dnsjnio-chosen random port will be used. I guess I should briefly note that a TCP session will be continued for as long as there are outstanding queries. It will be closed when all queries are complete, and a new, random port will be used for the next query session.
Please let me know if you see a problem with this! I’d quite like to put this issue to rest…

