Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
410 B

#include "byte.h"
#include "dns.h"
/* XXX: sort servers by configurable notion of closeness? */
/* XXX: pay attention to competence of each server? */
void dns_sortip(char *s,unsigned int n)
{
unsigned int i;
char tmp[4];
n >>= 2;
while (n > 1) {
i = dns_random(n);
--n;
byte_copy(tmp,4,s + (i << 2));
byte_copy(s + (i << 2),4,s + (n << 2));
byte_copy(s + (n << 2),4,tmp);
}
}