summaryrefslogtreecommitdiff
path: root/src/dnsstub/dns_sortip.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /src/dnsstub/dns_sortip.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/dnsstub/dns_sortip.c')
-rw-r--r--src/dnsstub/dns_sortip.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/dnsstub/dns_sortip.c b/src/dnsstub/dns_sortip.c
index 56742e0..886e989 100644
--- a/src/dnsstub/dns_sortip.c
+++ b/src/dnsstub/dns_sortip.c
@@ -1,6 +1,6 @@
#include "byte.h"
-#include "ip.h"
#include "dnsresolv.h"
+#include "ip.h"
/**
@file dns_sortip.c
@@ -14,32 +14,32 @@
/* XXX: pay attention to qualification (DNSSec, DNSCurve) of each server? */
/* YYY: we use a randomly sorted list of NS; not depending on answer */
-void dns_sortip4(char *s,unsigned int n)
+void dns_sortip4(char *s, unsigned int n)
{
unsigned int i;
char tmp[4];
- n >>= 2; /* 4 byte per IPv4 address */
+ n >>= 2; /* 4 byte per IPv4 address */
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);
+ byte_copy(tmp, 4, s + (i << 2));
+ byte_copy(s + (i << 2), 4, s + (n << 2));
+ byte_copy(s + (n << 2), 4, tmp);
}
}
-void dns_sortip6(char *s,unsigned int n)
+void dns_sortip6(char *s, unsigned int n)
{
unsigned int i;
char tmp[16];
- n >>= 4; /* 16 byte per IPv4 address */
+ n >>= 4; /* 16 byte per IPv4 address */
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);
+ byte_copy(tmp, 16, s + (i << 4));
+ byte_copy(s + (i << 4), 16, s + (n << 4));
+ byte_copy(s + (n << 4), 16, tmp);
}
}