From d06529686f89074fd4fa574ac6012f8a873e7857 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 17 Nov 2023 20:23:56 +0000 Subject: Prepare for 2.3.7.0; ignore link-local addresses in /etc/hosts Signed-off-by: Laurent Bercot --- src/clients/s6-dnsip.c | 13 +++---------- src/clients/s6-dnsip4.c | 13 +++---------- src/clients/s6-dnsip6.c | 13 +++---------- src/clients/s6-dnsname.c | 9 ++------- 4 files changed, 11 insertions(+), 37 deletions(-) (limited to 'src/clients') diff --git a/src/clients/s6-dnsip.c b/src/clients/s6-dnsip.c index 68ce62b..b0d724c 100644 --- a/src/clients/s6-dnsip.c +++ b/src/clients/s6-dnsip.c @@ -12,9 +12,7 @@ #include #include -#include -#include -#include +#include #define USAGE "s6-dnsip [ -q ] [ -H | -h ] [ -r ] [ -t timeout ] domain" #define dieusage() strerr_dieusage(100, USAGE) @@ -54,13 +52,8 @@ int main (int argc, char const *const *argv) if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; - if (!s6dns_rci_init(&s6dns_rci_here, "/etc/resolv.conf")) - strerr_diefu1sys(111, "initialize structures from /etc/resolv.conf") ; - if (flaghosts) - { - flaghosts = s6dns_hosts_init(&s6dns_hosts_here, "/etc/hosts", "/etc/hosts.cdb", "/tmp/hosts.cdb") ; - if (flaghosts == -1) strerr_diefu1sys(111, "initialize hosts database from /etc/hosts or /etc/hosts.cdb") ; - } + if (!s6dns_init_options(flaghosts)) + strerr_diefu1sys(111, "parse /etc/resolv.conf or /etc/hosts") ; if (flaghosts) { diff --git a/src/clients/s6-dnsip4.c b/src/clients/s6-dnsip4.c index 370c006..6112e14 100644 --- a/src/clients/s6-dnsip4.c +++ b/src/clients/s6-dnsip4.c @@ -11,9 +11,7 @@ #include #include -#include -#include -#include +#include #define USAGE "s6-dnsip4 [ -q ] [ -H | -h ] [ -r ] [ -t timeout ] domain" #define dieusage() strerr_dieusage(100, USAGE) @@ -53,13 +51,8 @@ int main (int argc, char const *const *argv) if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; - if (!s6dns_rci_init(&s6dns_rci_here, "/etc/resolv.conf")) - strerr_diefu1sys(111, "initialize structures from /etc/resolv.conf") ; - if (flaghosts) - { - flaghosts = s6dns_hosts_init(&s6dns_hosts_here, "/etc/hosts", "/etc/hosts.cdb", "/tmp/hosts.cdb") ; - if (flaghosts == -1) strerr_diefu1sys(111, "initialize hosts database from /etc/hosts or /etc/hosts.cdb") ; - } + if (!s6dns_init_options(flaghosts)) + strerr_diefu1sys(111, "parse from /etc/resolv.conf or /etc/hosts") ; if (flaghosts) { diff --git a/src/clients/s6-dnsip6.c b/src/clients/s6-dnsip6.c index 2fb2f6f..2a7ce8b 100644 --- a/src/clients/s6-dnsip6.c +++ b/src/clients/s6-dnsip6.c @@ -11,9 +11,7 @@ #include #include -#include -#include -#include +#include #define USAGE "s6-dnsip6 [ -q ] [ -H | -h ] [ -r ] [ -t timeout ] domain" #define dieusage() strerr_dieusage(100, USAGE) @@ -53,13 +51,8 @@ int main (int argc, char const *const *argv) if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; - if (!s6dns_rci_init(&s6dns_rci_here, "/etc/resolv.conf")) - strerr_diefu1sys(111, "initialize structures from /etc/resolv.conf") ; - if (flaghosts) - { - flaghosts = s6dns_hosts_init(&s6dns_hosts_here, "/etc/hosts", "/etc/hosts.cdb", "/tmp/hosts.cdb") ; - if (flaghosts == -1) strerr_diefu1sys(111, "initialize hosts database from /etc/hosts or /etc/hosts.cdb") ; - } + if (!s6dns_init_options(flaghosts)) + strerr_diefu1sys(111, "parse /etc/resolv.conf or /etc/hosts") ; if (flaghosts) { diff --git a/src/clients/s6-dnsname.c b/src/clients/s6-dnsname.c index 7c35f06..6531534 100644 --- a/src/clients/s6-dnsname.c +++ b/src/clients/s6-dnsname.c @@ -67,13 +67,8 @@ int main (int argc, char const *const *argv) if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add_g(&deadline, &deadline) ; - if (!s6dns_rci_init(&s6dns_rci_here, "/etc/resolv.conf")) - strerr_diefu1sys(111, "initialize structures from /etc/resolv.conf") ; - if (flaghosts) - { - flaghosts = s6dns_hosts_init(&s6dns_hosts_here, "/etc/hosts", "/etc/hosts.cdb", "/tmp/hosts.cdb") ; - if (flaghosts == -1) strerr_diefu1sys(111, "initialize hosts database from /etc/hosts or /etc/hosts.cdb") ; - } + if (!s6dns_init_options(flaghosts)) + strerr_diefu1sys(111, "parse /etc/resolv.conf or /etc/hosts") ; if (flaghosts) { -- cgit v1.3.1