From 3fef7c626abdc97ee64fa864206004ca5ea8d0ba Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Fri, 16 Dec 2022 10:19:16 +0000 Subject: [PATCH 1/3] Move bind9_getaddresses() to isc_getaddresses() No need to have a whole library for one function. --- bin/dig/dighost.c | 12 +++++------- bin/nsupdate/nsupdate.c | 7 +++---- bin/rndc/rndc.c | 5 ++--- bin/tools/mdig.c | 5 ++--- lib/bind9/Makefile.am | 6 ++---- lib/isc/Makefile.am | 2 ++ lib/{bind9 => isc}/getaddresses.c | 7 +++---- .../include/bind9 => isc/include/isc}/getaddresses.h | 4 ++-- lib/isccfg/parser.c | 2 +- 9 files changed, 22 insertions(+), 28 deletions(-) rename lib/{bind9 => isc}/getaddresses.c (96%) rename lib/{bind9/include/bind9 => isc/include/isc}/getaddresses.h (92%) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 5c73e28522..8c30438cc2 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -79,8 +80,6 @@ #include -#include - #include "dighost.h" #define systemlocale(l) (void)setlocale(l, "") @@ -534,8 +533,7 @@ set_nameserver(char *opt) { } isc_loopmgr_blocking(loopmgr); - result = bind9_getaddresses(opt, 0, sockaddrs, DIG_MAX_ADDRESSES, - &count); + result = isc_getaddresses(opt, 0, sockaddrs, DIG_MAX_ADDRESSES, &count); isc_loopmgr_nonblocking(loopmgr); if (result != ISC_R_SUCCESS) { fatal("couldn't get address for '%s': %s", opt, @@ -4528,7 +4526,7 @@ get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) { isc_result_t result; isc_loopmgr_blocking(loopmgr); - result = bind9_getaddresses(host, myport, sockaddr, 1, &count); + result = isc_getaddresses(host, myport, sockaddr, 1, &count); isc_loopmgr_nonblocking(loopmgr); if (result != ISC_R_SUCCESS) { return (result); @@ -4549,8 +4547,8 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) { char tmp[ISC_NETADDR_FORMATSIZE]; isc_loopmgr_blocking(loopmgr); - result = bind9_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES, - &count); + result = isc_getaddresses(host, 0, sockaddrs, DIG_MAX_ADDRESSES, + &count); isc_loopmgr_nonblocking(loopmgr); if (resultp != NULL) { *resultp = result; diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 58b36619a4..60a3874a6a 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -91,8 +92,6 @@ #endif /* HAVE_GSSAPI */ -#include - #include "../dig/readline.h" #define MAXCMD (128 * 1024) @@ -104,7 +103,7 @@ #define DNSDEFAULTPORT 53 -/* Number of addresses to request from bind9_getaddresses() */ +/* Number of addresses to request from isc_getaddresses() */ #define MAX_SERVERADDRS 4 static uint16_t dnsport = DNSDEFAULTPORT; @@ -1008,7 +1007,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr, isc_result_t result; isc_loopmgr_blocking(loopmgr); - result = bind9_getaddresses(host, port, sockaddr, naddrs, &count); + result = isc_getaddresses(host, port, sockaddr, naddrs, &count); isc_loopmgr_nonblocking(loopmgr); if (result != ISC_R_SUCCESS) { error("couldn't get address for '%s': %s", host, diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 3d226ac03c..c2d128b5cb 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -48,8 +49,6 @@ #include -#include - #include "util.h" #define SERVERADDRS 10 @@ -278,7 +277,7 @@ get_addresses(const char *host, in_port_t port) { } } else { count = SERVERADDRS - nserveraddrs; - result = bind9_getaddresses( + result = isc_getaddresses( host, port, &serveraddrs[nserveraddrs], count, &found); nserveraddrs += found; } diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index f519696af4..b8aa675c83 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -51,8 +52,6 @@ #include #include -#include - #define CHECK(str, x) \ { \ if ((x) != ISC_R_SUCCESS) { \ @@ -2109,7 +2108,7 @@ main(int argc, char *argv[]) { } ns = 0; - result = bind9_getaddresses(server, port, &dstaddr, 1, &ns); + result = isc_getaddresses(server, port, &dstaddr, 1, &ns); if (result != ISC_R_SUCCESS) { fatal("couldn't get address for '%s': %s", server, isc_result_totext(result)); diff --git a/lib/bind9/Makefile.am b/lib/bind9/Makefile.am index c48018a906..dc8888f1a0 100644 --- a/lib/bind9/Makefile.am +++ b/lib/bind9/Makefile.am @@ -4,12 +4,10 @@ lib_LTLIBRARIES = libbind9.la libbind9_ladir = $(includedir)/bind9 -libbind9_la_HEADERS = \ - include/bind9/getaddresses.h +libbind9_la_HEADERS = libbind9_la_SOURCES = \ - $(libbind9_la_HEADERS) \ - getaddresses.c + $(libbind9_la_HEADERS) libbind9_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am index dff12e76c9..77a667700c 100644 --- a/lib/isc/Makefile.am +++ b/lib/isc/Makefile.am @@ -31,6 +31,7 @@ libisc_la_HEADERS = \ include/isc/formatcheck.h \ include/isc/fsaccess.h \ include/isc/fuzz.h \ + include/isc/getaddresses.h \ include/isc/glob.h \ include/isc/hash.h \ include/isc/hashmap.h \ @@ -130,6 +131,7 @@ libisc_la_SOURCES = \ fsaccess.c \ fsaccess_common.c \ fsaccess_common_p.h \ + getaddresses.c \ glob.c \ hash.c \ hashmap.c \ diff --git a/lib/bind9/getaddresses.c b/lib/isc/getaddresses.c similarity index 96% rename from lib/bind9/getaddresses.c rename to lib/isc/getaddresses.c index 9e2e9d3d79..bed59b483a 100644 --- a/lib/bind9/getaddresses.c +++ b/lib/isc/getaddresses.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -26,11 +27,9 @@ #include #include -#include - isc_result_t -bind9_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs, - int addrsize, int *addrcount) { +isc_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs, + int addrsize, int *addrcount) { struct in_addr in4; struct in6_addr in6; bool have_ipv4, have_ipv6; diff --git a/lib/bind9/include/bind9/getaddresses.h b/lib/isc/include/isc/getaddresses.h similarity index 92% rename from lib/bind9/include/bind9/getaddresses.h rename to lib/isc/include/isc/getaddresses.h index b9a431b581..9bb2435075 100644 --- a/lib/bind9/include/bind9/getaddresses.h +++ b/lib/isc/include/isc/getaddresses.h @@ -22,8 +22,8 @@ ISC_LANG_BEGINDECLS isc_result_t -bind9_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs, - int addrsize, int *addrcount); +isc_getaddresses(const char *hostname, in_port_t port, isc_sockaddr_t *addrs, + int addrsize, int *addrcount); /*%< * Use the system resolver to get the addresses associated with a hostname. * If successful, the number of addresses found is returned in 'addrcount'. diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 933b6cf0df..d2e777ba00 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -2926,7 +2926,7 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) { } } if ((flags & CFG_ADDR_V6OK) != 0 && strlen(s) <= 127U) { - char buf[128]; /* see lib/bind9/getaddresses.c */ + char buf[128]; /* see isc_getaddresses() */ char *d; /* zone delimiter */ uint32_t zone = 0; /* scope zone ID */ From 4da9c582b8ef97ac7f26e91956718947b3246f43 Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Fri, 16 Dec 2022 10:51:36 +0000 Subject: [PATCH 2/3] Remove libbind9 It is now empty. --- Makefile.top | 6 ------ bin/check/Makefile.am | 6 ++---- bin/dig/Makefile.am | 2 -- bin/named/Makefile.am | 2 -- bin/nsupdate/Makefile.am | 2 -- bin/rndc/Makefile.am | 6 ++---- bin/tools/Makefile.am | 10 ---------- configure.ac | 3 +-- doc/dev/dev.md | 5 +---- doc/doxygen/Doxyfile.in | 1 - lib/Makefile.am | 2 +- lib/bind9/Makefile.am | 33 --------------------------------- lib/bind9/include/.clang-format | 1 - 13 files changed, 7 insertions(+), 72 deletions(-) delete mode 100644 lib/bind9/Makefile.am delete mode 120000 lib/bind9/include/.clang-format diff --git a/Makefile.top b/Makefile.top index 62c5293c2c..93047dc313 100644 --- a/Makefile.top +++ b/Makefile.top @@ -57,9 +57,3 @@ LIBISCCC_CFLAGS = \ LIBISCCC_LIBS = \ $(top_builddir)/lib/isccc/libisccc.la - -LIBBIND9_CFLAGS = \ - -I$(top_srcdir)/lib/bind9/include - -LIBBIND9_LIBS = \ - $(top_builddir)/lib/bind9/libbind9.la diff --git a/bin/check/Makefile.am b/bin/check/Makefile.am index 8f63c3506a..c25dc4d3bf 100644 --- a/bin/check/Makefile.am +++ b/bin/check/Makefile.am @@ -4,8 +4,7 @@ AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ $(LIBDNS_CFLAGS) \ $(LIBNS_CFLAGS) \ - $(LIBISCCFG_CFLAGS) \ - $(LIBBIND9_CFLAGS) + $(LIBISCCFG_CFLAGS) AM_CPPFLAGS += \ -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\" @@ -21,8 +20,7 @@ LDADD += \ $(LIBISC_LIBS) \ $(LIBDNS_LIBS) \ $(LIBNS_LIBS) \ - $(LIBISCCFG_LIBS) \ - $(LIBBIND9_LIBS) + $(LIBISCCFG_LIBS) bin_PROGRAMS = named-checkconf named-checkzone diff --git a/bin/dig/Makefile.am b/bin/dig/Makefile.am index b36f0f4525..a14e418e45 100644 --- a/bin/dig/Makefile.am +++ b/bin/dig/Makefile.am @@ -5,7 +5,6 @@ AM_CPPFLAGS += \ $(LIBDNS_CFLAGS) \ $(LIBISCCFG_CFLAGS) \ $(LIBIRS_CFLAGS) \ - $(LIBBIND9_CFLAGS) \ $(LIBIDN2_CFLAGS) \ $(LIBUV_CFLAGS) @@ -15,7 +14,6 @@ LDADD += \ $(LIBDNS_LIBS) \ $(LIBISCCFG_LIBS) \ $(LIBIRS_LIBS) \ - $(LIBBIND9_LIBS) \ $(LIBIDN2_LIBS) noinst_LTLIBRARIES = libdighost.la diff --git a/bin/named/Makefile.am b/bin/named/Makefile.am index 38045f00aa..5c861b3ca6 100644 --- a/bin/named/Makefile.am +++ b/bin/named/Makefile.am @@ -7,7 +7,6 @@ AM_CPPFLAGS += \ $(LIBNS_CFLAGS) \ $(LIBISCCC_CFLAGS) \ $(LIBISCCFG_CFLAGS) \ - $(LIBBIND9_CFLAGS) \ $(OPENSSL_CFLAGS) \ $(LIBCAP_CFLAGS) \ $(LMDB_CFLAGS) \ @@ -103,7 +102,6 @@ named_LDADD = \ $(LIBNS_LIBS) \ $(LIBISCCC_LIBS) \ $(LIBISCCFG_LIBS) \ - $(LIBBIND9_LIBS) \ $(OPENSSL_LIBS) \ $(LIBCAP_LIBS) \ $(LMDB_LIBS) \ diff --git a/bin/nsupdate/Makefile.am b/bin/nsupdate/Makefile.am index 18c8645f82..f76efed6f6 100644 --- a/bin/nsupdate/Makefile.am +++ b/bin/nsupdate/Makefile.am @@ -5,7 +5,6 @@ AM_CPPFLAGS += \ $(LIBDNS_CFLAGS) \ $(LIBISCCFG_CFLAGS) \ $(LIBIRS_CFLAGS) \ - $(LIBBIND9_CFLAGS) \ $(GSSAPI_CFLAGS) \ $(KRB5_CFLAGS) \ $(READLINE_CFLAGS) @@ -18,7 +17,6 @@ LDADD += \ $(LIBDNS_LIBS) \ $(LIBISCCFG_LIBS) \ $(LIBIRS_LIBS) \ - $(LIBBIND9_LIBS) \ $(GSSAPI_LIBS) \ $(KRB5_LIBS) diff --git a/bin/rndc/Makefile.am b/bin/rndc/Makefile.am index a668522bc2..f8f0ac96d5 100644 --- a/bin/rndc/Makefile.am +++ b/bin/rndc/Makefile.am @@ -4,8 +4,7 @@ AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ $(LIBDNS_CFLAGS) \ $(LIBISCCFG_CFLAGS) \ - $(LIBISCCC_CFLAGS) \ - $(LIBBIND9_CFLAGS) + $(LIBISCCC_CFLAGS) AM_CPPFLAGS += \ -DRNDC_CONFFILE=\"${sysconfdir}/rndc.conf\" \ @@ -22,5 +21,4 @@ rndc_LDADD = \ $(LIBISC_LIBS) \ $(LIBDNS_LIBS) \ $(LIBISCCC_LIBS) \ - $(LIBISCCFG_LIBS) \ - $(LIBBIND9_LIBS) + $(LIBISCCFG_LIBS) diff --git a/bin/tools/Makefile.am b/bin/tools/Makefile.am index d7b8e4a331..0df1c7409b 100644 --- a/bin/tools/Makefile.am +++ b/bin/tools/Makefile.am @@ -18,16 +18,6 @@ bin_PROGRAMS = \ arpaname_LDADD = \ $(LIBISC_LIBS) -mdig_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(LIBBIND9_CFLAGS) - -mdig_LDADD = \ - $(LIBBIND9_LIBS) \ - $(LIBISCCFG_LIBS) \ - $(LIBDNS_LIBS) \ - $(LIBISC_LIBS) - if HAVE_DNSTAP bin_PROGRAMS += \ dnstap-read diff --git a/configure.ac b/configure.ac index c180364dfb..2fb9541514 100644 --- a/configure.ac +++ b/configure.ac @@ -1560,8 +1560,7 @@ AC_CONFIG_FILES([lib/Makefile lib/ns/Makefile lib/irs/Makefile lib/isccfg/Makefile - lib/isccc/Makefile - lib/bind9/Makefile]) + lib/isccc/Makefile]) # Documentation diff --git a/doc/dev/dev.md b/doc/dev/dev.md index 3ee7c3c937..3dbc90618b 100644 --- a/doc/dev/dev.md +++ b/doc/dev/dev.md @@ -268,11 +268,8 @@ libraries. * `bind9/lib/dns`: implements higher-level DNS functionality: red-black trees, rdatasets, views, zones, ACLs, resolver, validator, etc * `bind9/lib/dns/tests`: unit tests for libdns - * `bind9/lib/bind9`: library implementing bind9-specific functionality, - principally configuration validity checking (used in `named` and - `named-checkconf` when reading `named.conf`). * `bind9/lib/isccfg`: library implementing the `named.conf` - configuration parser. + configuration parser and checker. * `bind9/lib/isccc`: library implementing the control channel used by `rndc` * `bind9/lib/irs`: provides mechanisms for reading `/etc/resolv.conf` diff --git a/doc/doxygen/Doxyfile.in b/doc/doxygen/Doxyfile.in index 8fab9caa80..3dd23e78f8 100644 --- a/doc/doxygen/Doxyfile.in +++ b/doc/doxygen/Doxyfile.in @@ -475,7 +475,6 @@ INPUT = @BIND9_TOP_BUILDDIR@/lib/isc \ @BIND9_TOP_BUILDDIR@/lib/isccfg \ @BIND9_TOP_BUILDDIR@/lib/isccc \ @BIND9_TOP_BUILDDIR@/lib/ns \ - @BIND9_TOP_BUILDDIR@/lib/bind9 \ @BIND9_TOP_BUILDDIR@/bin/check \ @BIND9_TOP_BUILDDIR@/bin/dig \ @BIND9_TOP_BUILDDIR@/bin/dnssec \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 39741a427f..3f3b451d1d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,3 +1,3 @@ include $(top_srcdir)/Makefile.top -SUBDIRS = isc dns isccc ns isccfg bind9 irs +SUBDIRS = isc dns isccc ns isccfg irs diff --git a/lib/bind9/Makefile.am b/lib/bind9/Makefile.am deleted file mode 100644 index dc8888f1a0..0000000000 --- a/lib/bind9/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -include $(top_srcdir)/Makefile.top - -lib_LTLIBRARIES = libbind9.la - -libbind9_ladir = $(includedir)/bind9 - -libbind9_la_HEADERS = - -libbind9_la_SOURCES = \ - $(libbind9_la_HEADERS) - -libbind9_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(LIBISC_CFLAGS) \ - $(LIBDNS_CFLAGS) \ - $(LIBISCCFG_CFLAGS) \ - $(LIBNS_CFLAGS) \ - $(LIBBIND9_CFLAGS) \ - $(OPENSSL_CFLAGS) - -libbind9_la_LIBADD = \ - $(LIBNS_LIBS) \ - $(LIBISCCFG_LIBS) \ - $(LIBDNS_LIBS) \ - $(LIBISC_LIBS) - -libbind9_la_LDFLAGS = \ - $(AM_LDFLAGS) \ - -release "$(PACKAGE_VERSION)" - -if HAVE_DNSTAP -libbind9_la_CPPFLAGS += $(DNSTAP_CFLAGS) -endif diff --git a/lib/bind9/include/.clang-format b/lib/bind9/include/.clang-format deleted file mode 120000 index 0e62f72bcf..0000000000 --- a/lib/bind9/include/.clang-format +++ /dev/null @@ -1 +0,0 @@ -../../../.clang-format.headers \ No newline at end of file From 8bb5f37fd42d5f74deeedfb90e0dfb9a7fe47851 Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Fri, 16 Dec 2022 12:57:36 +0000 Subject: [PATCH 3/3] Add CHANGES and release note [cleanup] Move bind9_getaddresses() to isc_getaddresses() and remove the now empty libbind9. --- CHANGES | 3 +++ doc/notes/notes-current.rst | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index cccd100926..2df6ee9421 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +6106. [cleanup] Move bind9_getaddresses() to isc_getaddresses() + and remove the now empty libbind9. [GL !7462] + 6105. [bug] Detach 'rpzs' and 'catzs' from the previous view in configure_rpz() and configure_catz(), respectively, just after attaching it to the new view. [GL #3880] diff --git a/doc/notes/notes-current.rst b/doc/notes/notes-current.rst index 033c079aa6..b504c3aa78 100644 --- a/doc/notes/notes-current.rst +++ b/doc/notes/notes-current.rst @@ -29,6 +29,10 @@ Removed Features A C11 compliant compiler (or better) is now required to compile BIND 9. :gl:`#3729` +- The functions that were in the ``libbind9`` shared library have been + moved to the ``libisc`` and ``libisccfg`` libraries, and the + now-empty ``libbind9`` has been removed and is no longer installed. + Feature Changes ~~~~~~~~~~~~~~~