diff options
author | John Denker <jsd@av8n.com> | 2012-07-26 11:00:48 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-07-29 15:32:37 -0700 |
commit | 01ef1d365e5776b130e8b65772a80b6adcb0ed46 (patch) | |
tree | f0e7d3e161f82180e834a6368d41b79272ab013a /ucspi-tcp-0.88/dns_sortip6.c | |
parent | 9aa998757a8736cef02fd92050eacbb2a6fb5180 (diff) |
files added by IPv6 patch
Diffstat (limited to 'ucspi-tcp-0.88/dns_sortip6.c')
-rw-r--r-- | ucspi-tcp-0.88/dns_sortip6.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ucspi-tcp-0.88/dns_sortip6.c b/ucspi-tcp-0.88/dns_sortip6.c new file mode 100644 index 0000000..7e752e9 --- /dev/null +++ b/ucspi-tcp-0.88/dns_sortip6.c @@ -0,0 +1,20 @@ +#include "byte.h" +#include "dns.h" + +/* XXX: sort servers by configurable notion of closeness? */ +/* XXX: pay attention to competence of each server? */ + +void dns_sortip6(char *s,unsigned int n) +{ + unsigned int i; + char tmp[16]; + + n >>= 4; + while (n > 1) { + i = dns_random(n); + --n; + byte_copy(tmp,16,s + (i << 4)); + byte_copy(s + (i << 4),16,s + (n << 4)); + byte_copy(s + (n << 4),16,tmp); + } +} |