From 795ffc5e62e8ba383575dbcd9943a580d4bd3358 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 15:50:21 +0200 Subject: formatting changes Manual format adjustments. Comment adjustments. Remove usage of the register keyword. --- src/dnsstub/dns_rcip.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/dnsstub/dns_rcip.c') diff --git a/src/dnsstub/dns_rcip.c b/src/dnsstub/dns_rcip.c index fd86df9..2d6ad08 100644 --- a/src/dnsstub/dns_rcip.c +++ b/src/dnsstub/dns_rcip.c @@ -7,10 +7,10 @@ #include "taia.h" /** - @file dns_rcip.c - @author djb, fefe, feh - @source ucspi-tcp - @brief DNS receive for query + @file dns_rcip.c + @author djb, fefe, feh + @source ucspi-tcp + @brief DNS receive for query */ static stralloc data = {0}; @@ -26,25 +26,26 @@ static int init(char ip[QUERY_MAXIPLEN], uint32 sid[QUERY_MAXNS]) char ip4[4]; /* Read (compactified) IPv4|v6 addresses of resolvers - Store them in array IP with fixed length : - ip(64) -> 16 IPv4 addresses (not used anymore) - ip(512) -> 16*2 IPv6 addresses (we use IPv4 mapped IPv6 addresses) - sid(32) -> the scope for the respective IPv6 or 0 -*/ + Store them in array IP with fixed length: + ip(64) -> 16 IPv4 addresses (not used anymore) + ip(512) -> 16*2 IPv6 addresses (we use IPv4 mapped IPv6 addresses) + sid(32) -> the scope for the respective IPv6 or 0 + */ for (i = 0; i < QUERY_MAXNS; ++i) sid[i] = 0; x = env_get("DNSCACHEIP"); - if (x) + if (x) { while (iplen <= 240 && *x != '\0') { - if (*x == ' ') + if (*x == ' ') { ++x; - else if ((i = ip6_ifscan(x, ip + iplen, &ifname))) { + } else if ((i = ip6_ifscan(x, ip + iplen, &ifname))) { if (ifname.len > 2) sid[k] = socket_getifidx(ifname.s); iplen += 16; k++; if (*(x += i) == '\0') break; } } + } if (!iplen) { i = openreadclose("/etc/resolv.conf", &data, 64); @@ -52,7 +53,7 @@ static int init(char ip[QUERY_MAXIPLEN], uint32 sid[QUERY_MAXNS]) if (i) { if (!stralloc_append(&data, "\n")) return DNS_MEM; i = 0; - for (j = 0; j < data.len; ++j) + for (j = 0; j < data.len; ++j) { if (data.s[j] == '\n') { if (byte_equal("nameserver ", 11, data.s + i) || byte_equal("nameserver\t", 11, data.s + i)) { i += 10; @@ -75,6 +76,7 @@ static int init(char ip[QUERY_MAXIPLEN], uint32 sid[QUERY_MAXNS]) } i = j + 1; } + } } } -- cgit v1.2.3