summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-11-18 23:09:46 +0000
committerLaurent Bercot <ska@appnovation.com>2023-11-18 23:09:46 +0000
commit20d8277451d8fd7cbce316b80a0018bc2639335d (patch)
tree925753f6acdf8afc7e9877db2e9d2d88f1c0f47c
parentd06529686f89074fd4fa574ac6012f8a873e7857 (diff)
downloads6-dns-20d8277451d8fd7cbce316b80a0018bc2639335d.tar.xz
Fix old _BSD_SOURCE definitions
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--NEWS7
-rw-r--r--doc/libs6dns/hosts.html3
-rw-r--r--doc/libs6dns/index.html5
-rw-r--r--src/include/s6-dns/hosts.h2
-rw-r--r--src/libs6dns/s6dns_debug_dumpdt_pre_send.c8
-rw-r--r--src/skadns/skadns_cancel.c7
-rw-r--r--src/skadns/skadns_release.c7
7 files changed, 21 insertions, 18 deletions
diff --git a/NEWS b/NEWS
index 669b8ce..3656f2a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,10 +3,11 @@ Changelog for s6-dns.
In 2.3.7.0
----------
- - New s6dns_init_options() function,
-to choose whether to support /etc/hosts or not.
- - Properly ignore link-local addresses in /etc/hosts
+ - New s6dns_init_options() function, to choose whether
+to support /etc/hosts or not.
+ - Properly ignore link-local addresses in hosts files
instead of erroring out on them.
+ - New s6dns_hosts_name46() macro.
In 2.3.6.0
diff --git a/doc/libs6dns/hosts.html b/doc/libs6dns/hosts.html
index b9a03bf..00da38f 100644
--- a/doc/libs6dns/hosts.html
+++ b/doc/libs6dns/hosts.html
@@ -80,7 +80,8 @@ which should be in <tt>/etc/hosts</tt> format, into a cdb file
written to file descriptor <tt>fdw</tt>. <tt>fdr</tt> must be
open for reading, and <tt>fdw</tt> must be open for writing and
seekable. The function returns 1 on success and 0 (and sets errno)
-on failure.
+on failure. A syntax error in the text file results in failure,
+but link-local addresses are silently ignored.
</p>
<p>
diff --git a/doc/libs6dns/index.html b/doc/libs6dns/index.html
index 6320376..6dcb408 100644
--- a/doc/libs6dns/index.html
+++ b/doc/libs6dns/index.html
@@ -98,8 +98,9 @@ header:
s6dns_init() calls <a href="s6dns-rci.html">s6dns_rci_init()</a>,
extracting <tt>resolv.conf</tt> information to an internal global
variable. The function returns 1 on success, and 0 (and sets errno)
-on failure. </li>
- <li> Call <tt>s6dns_finish()</tt> when you're done with the libs6dns.
+on failure. To also use the hosts database, you can call
+<tt>s6dns_init_options(1)</tt> instead. </li>
+ <li> Call <tt>s6dns_finish()</tt> when you're done with libs6dns.
It frees the resources used. </li>
</ul>
diff --git a/src/include/s6-dns/hosts.h b/src/include/s6-dns/hosts.h
index f9ac48e..4d7f1c8 100644
--- a/src/include/s6-dns/hosts.h
+++ b/src/include/s6-dns/hosts.h
@@ -3,6 +3,7 @@
#ifndef S6DNS_HOSTS_H
#define S6DNS_HOSTS_H
+#include <skalibs/ip46.h>
#include <skalibs/cdb.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
@@ -26,6 +27,7 @@ extern int s6dns_hosts_name_r (cdb const *, char const *, stralloc *, genalloc *
#define s6dns_hosts_name(ip, sa, ga, is6) s6dns_hosts_name_r(&s6dns_hosts_here, (ip), sa, ga, is6)
#define s6dns_hosts_name4(ip, sa, ga) s6dns_hosts_name4_r(&s6dns_hosts_here, (ip), sa, ga)
#define s6dns_hosts_name6(ip, sa, ga) s6dns_hosts_name6_r(&s6dns_hosts_here, (ip), sa, ga)
+#define s6dns_hosts_name46(i, sa, ga) s6dns_hosts_name((i)->ip, sa, (ga), (i)->is6)
/* name to IP. noq: name is an fqdn. unq: name is unqualified. */
diff --git a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c
index 0d4ae19..c64f2ca 100644
--- a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c
+++ b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c
@@ -1,17 +1,17 @@
/* ISC license */
-/* For EOVERFLOW in OpenBSD */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
+/* For EOVERFLOW */
+#include <skalibs/bsdsnowflake.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
+
#include <skalibs/uint16.h>
#include <skalibs/genwrite.h>
#include <skalibs/djbtime.h>
#include <skalibs/ip46.h>
+
#include <s6-dns/s6dns-ip46.h>
#include <s6-dns/s6dns-analyze.h>
#include <s6-dns/s6dns-debug.h>
diff --git a/src/skadns/skadns_cancel.c b/src/skadns/skadns_cancel.c
index 3b8eff6..2b3753f 100644
--- a/src/skadns/skadns_cancel.c
+++ b/src/skadns/skadns_cancel.c
@@ -1,15 +1,14 @@
/* ISC license. */
-/* OpenBSD sucks. In other news, the sky is blue. */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
+
#include <skalibs/uint16.h>
#include <skalibs/error.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/textclient.h>
+
#include <s6-dns/skadns.h>
int skadns_cancel (skadns_t *a, uint16_t id, tain const *deadline, tain *stamp)
diff --git a/src/skadns/skadns_release.c b/src/skadns/skadns_release.c
index 26c9c4f..c64016c 100644
--- a/src/skadns/skadns_release.c
+++ b/src/skadns/skadns_release.c
@@ -1,13 +1,12 @@
/* ISC license. */
-/* OpenBSD sucks. More news at 11. */
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
-#endif
+#include <skalibs/bsdsnowflake.h>
#include <errno.h>
+
#include <skalibs/alloc.h>
#include <skalibs/gensetdyn.h>
+
#include <s6-dns/skadns.h>
int skadns_release (skadns_t *a, uint16_t id)