robur-coop / udns

[deprecated, developmeht moved to https://github.com/mirage/ocaml-dns] µDNS - an opinionated Domain Name System (DNS) library
BSD 2-Clause "Simplified" License
55 stars 5 forks source link

Client dns packet id uses Random.int #9

Open cfcs opened 5 years ago

cfcs commented 5 years ago

I took a shortcut here: https://github.com/roburio/udns/blob/master/client/udns_client.ml#L20

Leaving this issue here so we don't forget about it.

EDIT: Also it's off by one (should be 0x10000):

Random.int bound returns a random integer between 0 (inclusive)
and bound (exclusive). bound must be greater than 0 and less than 2^30.
hannesm commented 5 years ago

as noted in #31, there's as well weird random numbers in the server.