On Fri, Feb 12, 2010 at 8:58 AM, der Mouse <[email protected]> wrote: >> Ryan, How do you propose to choose nodes "randomly" ? > > Well, I didn't write that, but I assumed it meant something like > > sin.sin_addr = my_favourite_32bit_rng(); > > The v4 Internet is getting populated enough that that is becoming a > sane technique for doing that kind of statistical work (well, sane from > a statistical POV; it's often not so hot from an abuse POV).
As I mentioned, only searching "assigned" address space would be an easy and important optimization. The current list of allocations is here: http://www.iana.org/assignments/ipv4-address-space/ You would want to eliminate all the /8 blocks marked as "UNALLOCATED" or "RESERVED" from that file. You would also want to eliminate the RFC1918 "private" blocks (the 10.x.x.x would be caught by the above RESERVED check also): 10.0.0.0 - 10.255.255.255 (10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) So basically, you would just generate a random 32 bit number as mouse describes, and then "skip" it if it fell into an unallocated/reserved/private address ranges. I would suggest not using rand(), but a statistically good random number generator like Mersenne Twister (from whatever library), /dev/urandom on Linux, or the Windows CryptoAPI's CryptGenRandom. -- RPM _______________________________________________ timekeepers mailing list [email protected] https://fortytwo.ch/mailman/cgi-bin/listinfo/timekeepers
