diff --git a/CHANGES b/CHANGES index d4c753d8d5..e280532e3d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5519. [cleanup] Unused source code was removed: lib/dns/dbtable.c, + lib/dns/portlist.c, lib/isc/bufferlist.c, and code + related to those files. [GL #2060] + 5518. [bug] Fix stub zone not transferring nameserver addresses from masters configured with 'minimal-responses yes'. [GL #1736] diff --git a/bin/dig/dighost.h b/bin/dig/dighost.h index bc280e540e..d27e40481d 100644 --- a/bin/dig/dighost.h +++ b/bin/dig/dighost.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include diff --git a/bin/named/server.c b/bin/named/server.c index b25d258bef..db84a2c164 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -76,7 +76,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/dns/Makefile.am b/lib/dns/Makefile.am index 73e6bc2f73..78bd453f90 100644 --- a/lib/dns/Makefile.am +++ b/lib/dns/Makefile.am @@ -64,7 +64,6 @@ libdns_la_HEADERS = \ include/dns/compress.h \ include/dns/db.h \ include/dns/dbiterator.h \ - include/dns/dbtable.h \ include/dns/diff.h \ include/dns/dispatch.h \ include/dns/dlz.h \ @@ -106,7 +105,6 @@ libdns_la_HEADERS = \ include/dns/opcode.h \ include/dns/order.h \ include/dns/peer.h \ - include/dns/portlist.h \ include/dns/private.h \ include/dns/rbt.h \ include/dns/rcode.h \ @@ -168,7 +166,6 @@ libdns_la_SOURCES = \ compress.c \ db.c \ dbiterator.c \ - dbtable.c \ diff.c \ dispatch.c \ dlz.c \ @@ -213,7 +210,6 @@ libdns_la_SOURCES = \ order.c \ peer.c \ private.c \ - portlist.c \ rbt.c \ rbtdb.h \ rbtdb.c \ diff --git a/lib/dns/dbtable.c b/lib/dns/dbtable.c deleted file mode 100644 index e237fd6333..0000000000 --- a/lib/dns/dbtable.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -#include -#include -#include - -#include -#include -#include -#include - -struct dns_dbtable { - /* Unlocked. */ - unsigned int magic; - isc_mem_t *mctx; - dns_rdataclass_t rdclass; - isc_rwlock_t tree_lock; - /* Protected by atomics */ - isc_refcount_t references; - /* Locked by tree_lock. */ - dns_rbt_t *rbt; - dns_db_t *default_db; -}; - -#define DBTABLE_MAGIC ISC_MAGIC('D', 'B', '-', '-') -#define VALID_DBTABLE(dbtable) ISC_MAGIC_VALID(dbtable, DBTABLE_MAGIC) - -static void -dbdetach(void *data, void *arg) { - dns_db_t *db = data; - - UNUSED(arg); - - dns_db_detach(&db); -} - -isc_result_t -dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, - dns_dbtable_t **dbtablep) { - dns_dbtable_t *dbtable; - isc_result_t result; - - REQUIRE(mctx != NULL); - REQUIRE(dbtablep != NULL && *dbtablep == NULL); - - dbtable = isc_mem_get(mctx, sizeof(*dbtable)); - - dbtable->rbt = NULL; - result = dns_rbt_create(mctx, dbdetach, NULL, &dbtable->rbt); - if (result != ISC_R_SUCCESS) { - goto clean1; - } - - result = isc_rwlock_init(&dbtable->tree_lock, 0, 0); - if (result != ISC_R_SUCCESS) { - goto clean3; - } - - dbtable->default_db = NULL; - dbtable->mctx = NULL; - isc_mem_attach(mctx, &dbtable->mctx); - dbtable->rdclass = rdclass; - dbtable->magic = DBTABLE_MAGIC; - isc_refcount_init(&dbtable->references, 1); - - *dbtablep = dbtable; - - return (ISC_R_SUCCESS); - -clean3: - dns_rbt_destroy(&dbtable->rbt); - -clean1: - isc_mem_putanddetach(&mctx, dbtable, sizeof(*dbtable)); - - return (result); -} - -static inline void -dbtable_free(dns_dbtable_t *dbtable) { - /* - * Caller must ensure that it is safe to call. - */ - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - - if (dbtable->default_db != NULL) { - dns_db_detach(&dbtable->default_db); - } - - dns_rbt_destroy(&dbtable->rbt); - - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - - isc_rwlock_destroy(&dbtable->tree_lock); - - dbtable->magic = 0; - - isc_mem_putanddetach(&dbtable->mctx, dbtable, sizeof(*dbtable)); -} - -void -dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp) { - REQUIRE(VALID_DBTABLE(source)); - REQUIRE(targetp != NULL && *targetp == NULL); - - isc_refcount_increment(&source->references); - - *targetp = source; -} - -void -dns_dbtable_detach(dns_dbtable_t **dbtablep) { - dns_dbtable_t *dbtable; - - REQUIRE(dbtablep != NULL); - dbtable = *dbtablep; - *dbtablep = NULL; - REQUIRE(VALID_DBTABLE(dbtable)); - - if (isc_refcount_decrement(&dbtable->references) == 1) { - dbtable_free(dbtable); - } -} - -isc_result_t -dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db) { - isc_result_t result; - dns_db_t *dbclone; - - REQUIRE(VALID_DBTABLE(dbtable)); - REQUIRE(dns_db_class(db) == dbtable->rdclass); - - dbclone = NULL; - dns_db_attach(db, &dbclone); - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - result = dns_rbt_addname(dbtable->rbt, dns_db_origin(dbclone), dbclone); - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - - return (result); -} - -void -dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db) { - dns_db_t *stored_data = NULL; - isc_result_t result; - dns_name_t *name; - - REQUIRE(VALID_DBTABLE(dbtable)); - - name = dns_db_origin(db); - - /* - * There is a requirement that the association of name with db - * be verified. With the current rbt.c this is expensive to do, - * because effectively two find operations are being done, but - * deletion is relatively infrequent. - * XXXDCL ... this could be cheaper now with dns_rbt_deletenode. - */ - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - - result = dns_rbt_findname(dbtable->rbt, name, 0, NULL, - (void **)(void *)&stored_data); - - if (result == ISC_R_SUCCESS) { - INSIST(stored_data == db); - - (void)dns_rbt_deletename(dbtable->rbt, name, false); - } - - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); -} - -void -dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db) { - REQUIRE(VALID_DBTABLE(dbtable)); - REQUIRE(dbtable->default_db == NULL); - REQUIRE(dns_name_compare(dns_db_origin(db), dns_rootname) == 0); - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - - dbtable->default_db = NULL; - dns_db_attach(db, &dbtable->default_db); - - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); -} - -void -dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **dbp) { - REQUIRE(VALID_DBTABLE(dbtable)); - REQUIRE(dbp != NULL && *dbp == NULL); - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_read); - - dns_db_attach(dbtable->default_db, dbp); - - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_read); -} - -void -dns_dbtable_removedefault(dns_dbtable_t *dbtable) { - REQUIRE(VALID_DBTABLE(dbtable)); - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write); - - dns_db_detach(&dbtable->default_db); - - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); -} - -isc_result_t -dns_dbtable_find(dns_dbtable_t *dbtable, const dns_name_t *name, - unsigned int options, dns_db_t **dbp) { - dns_db_t *stored_data = NULL; - isc_result_t result; - unsigned int rbtoptions = 0; - - REQUIRE(dbp != NULL && *dbp == NULL); - - if ((options & DNS_DBTABLEFIND_NOEXACT) != 0) { - rbtoptions |= DNS_RBTFIND_NOEXACT; - } - - RWLOCK(&dbtable->tree_lock, isc_rwlocktype_read); - - result = dns_rbt_findname(dbtable->rbt, name, rbtoptions, NULL, - (void **)(void *)&stored_data); - - if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { - dns_db_attach(stored_data, dbp); - } else if (dbtable->default_db != NULL) { - dns_db_attach(dbtable->default_db, dbp); - result = DNS_R_PARTIALMATCH; - } else { - result = ISC_R_NOTFOUND; - } - - RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_read); - - return (result); -} diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 91a392b4a1..c4265aa5c9 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -61,7 +60,6 @@ struct dns_dispatchmgr { unsigned int magic; isc_mem_t *mctx; dns_acl_t *blackhole; - dns_portlist_t *portlist; isc_stats_t *stats; /* Locked by "lock". */ @@ -1901,22 +1899,6 @@ dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr) { return (mgr->blackhole); } -void -dns_dispatchmgr_setblackportlist(dns_dispatchmgr_t *mgr, - dns_portlist_t *portlist) { - REQUIRE(VALID_DISPATCHMGR(mgr)); - UNUSED(portlist); - - /* This function is deprecated: use dns_dispatchmgr_setavailports(). */ - return; -} - -dns_portlist_t * -dns_dispatchmgr_getblackportlist(dns_dispatchmgr_t *mgr) { - REQUIRE(VALID_DISPATCHMGR(mgr)); - return (NULL); /* this function is deprecated */ -} - isc_result_t dns_dispatchmgr_setavailports(dns_dispatchmgr_t *mgr, isc_portset_t *v4portset, isc_portset_t *v6portset) { diff --git a/lib/dns/include/dns/dbtable.h b/lib/dns/include/dns/dbtable.h deleted file mode 100644 index 3b78c412ef..0000000000 --- a/lib/dns/include/dns/dbtable.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#ifndef DNS_DBTABLE_H -#define DNS_DBTABLE_H 1 - -/***** -***** Module Info -*****/ - -/*! \file dns/dbtable.h - * \brief - * DNS DB Tables - * - * XXX TBS XXX - * - * MP: - *\li The module ensures appropriate synchronization of data structures it - * creates and manipulates. - * - * Reliability: - *\li No anticipated impact. - * - * Resources: - *\li None. - * - * Security: - *\li No anticipated impact. - * - * Standards: - *\li None. - */ - -#include - -#include - -#define DNS_DBTABLEFIND_NOEXACT 0x01 - -ISC_LANG_BEGINDECLS - -isc_result_t -dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, - dns_dbtable_t **dbtablep); -/*%< - * Make a new dbtable of class 'rdclass' - * - * Requires: - *\li mctx != NULL - * \li dbtablep != NULL && *dptablep == NULL - *\li 'rdclass' is a valid class - * - * Returns: - *\li #ISC_R_SUCCESS - *\li #ISC_R_NOMEMORY - *\li #ISC_R_UNEXPECTED - */ - -void -dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp); -/*%< - * Attach '*targetp' to 'source'. - * - * Requires: - * - *\li 'source' is a valid dbtable. - * - *\li 'targetp' points to a NULL dns_dbtable_t *. - * - * Ensures: - * - *\li *targetp is attached to source. - */ - -void -dns_dbtable_detach(dns_dbtable_t **dbtablep); -/*%< - * Detach *dbtablep from its dbtable. - * - * Requires: - * - *\li '*dbtablep' points to a valid dbtable. - * - * Ensures: - * - *\li *dbtablep is NULL. - * - *\li If '*dbtablep' is the last reference to the dbtable, - * all resources used by the dbtable will be freed - */ - -isc_result_t -dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db); -/*%< - * Add 'db' to 'dbtable'. - * - * Requires: - *\li 'dbtable' is a valid dbtable. - * - *\li 'db' is a valid database with the same class as 'dbtable' - */ - -void -dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db); -/*%< - * Remove 'db' from 'dbtable'. - * - * Requires: - *\li 'db' was previously added to 'dbtable'. - */ - -void -dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db); -/*%< - * Use 'db' as the result of a dns_dbtable_find() if no better match is - * available. - */ - -void -dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **db); -/*%< - * Get the 'db' used as the result of a dns_dbtable_find() - * if no better match is available. - */ - -void -dns_dbtable_removedefault(dns_dbtable_t *dbtable); -/*%< - * Remove the default db from 'dbtable'. - */ - -isc_result_t -dns_dbtable_find(dns_dbtable_t *dbtable, const dns_name_t *name, - unsigned int options, dns_db_t **dbp); -/*%< - * Find the deepest match to 'name' in the dbtable, and return it - * - * Notes: - *\li If the DNS_DBTABLEFIND_NOEXACT option is set, the best partial - * match (if any) to 'name' will be returned. - * - * Returns: - * \li #ISC_R_SUCCESS on success - *\li something else: no default and match - */ - -ISC_LANG_ENDDECLS - -#endif /* DNS_DBTABLE_H */ diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h index 5e3cc85f02..c82b6c6ce4 100644 --- a/lib/dns/include/dns/dispatch.h +++ b/lib/dns/include/dns/dispatch.h @@ -196,25 +196,6 @@ dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr); *\li A pointer to the current blackhole list, or NULL. */ -void -dns_dispatchmgr_setblackportlist(dns_dispatchmgr_t *mgr, - dns_portlist_t * portlist); -/*%< - * This function is deprecated. Use dns_dispatchmgr_setavailports() instead. - * - * Requires: - *\li mgr is a valid dispatchmgr - */ - -dns_portlist_t * -dns_dispatchmgr_getblackportlist(dns_dispatchmgr_t *mgr); -/*%< - * This function is deprecated and always returns NULL. - * - * Requires: - *\li mgr is a valid dispatchmgr - */ - isc_result_t dns_dispatchmgr_setavailports(dns_dispatchmgr_t *mgr, isc_portset_t *v4portset, isc_portset_t *v6portset); diff --git a/lib/dns/include/dns/portlist.h b/lib/dns/include/dns/portlist.h deleted file mode 100644 index 30705acc73..0000000000 --- a/lib/dns/include/dns/portlist.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file dns/portlist.h */ - -#include - -#include -#include -#include - -#include - -#ifndef DNS_PORTLIST_H -#define DNS_PORTLIST_H 1 - -ISC_LANG_BEGINDECLS - -isc_result_t -dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp); -/*%< - * Create a port list. - * - * Requires: - *\li 'mctx' to be valid. - *\li 'portlistp' to be non NULL and '*portlistp' to be NULL; - * - * Returns: - *\li #ISC_R_SUCCESS - *\li #ISC_R_NOMEMORY - *\li #ISC_R_UNEXPECTED - */ - -isc_result_t -dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port); -/*%< - * Add the given tuple to the portlist. - * - * Requires: - *\li 'portlist' to be valid. - *\li 'af' to be AF_INET or AF_INET6 - * - * Returns: - *\li #ISC_R_SUCCESS - *\li #ISC_R_NOMEMORY - */ - -void -dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port); -/*%< - * Remove the given tuple to the portlist. - * - * Requires: - *\li 'portlist' to be valid. - *\li 'af' to be AF_INET or AF_INET6 - */ - -bool -dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port); -/*%< - * Find the given tuple to the portlist. - * - * Requires: - *\li 'portlist' to be valid. - *\li 'af' to be AF_INET or AF_INET6 - * - * Returns - * \li #true if the tuple is found, false otherwise. - */ - -void -dns_portlist_attach(dns_portlist_t *portlist, dns_portlist_t **portlistp); -/*%< - * Attach to a port list. - * - * Requires: - *\li 'portlist' to be valid. - *\li 'portlistp' to be non NULL and '*portlistp' to be NULL; - */ - -void -dns_portlist_detach(dns_portlist_t **portlistp); -/*%< - * Detach from a port list. - * - * Requires: - *\li '*portlistp' to be valid. - */ - -ISC_LANG_ENDDECLS - -#endif /* DNS_PORTLIST_H */ diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index d918cf39cc..49e92108bb 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -57,7 +57,6 @@ typedef struct dns_dbiterator dns_dbiterator_t; typedef void dns_dbload_t; typedef void dns_dbnode_t; typedef struct dns_dbonupdatelistener dns_dbonupdatelistener_t; -typedef struct dns_dbtable dns_dbtable_t; typedef void dns_dbversion_t; typedef struct dns_dlzimplementation dns_dlzimplementation_t; typedef struct dns_dlzdb dns_dlzdb_t; @@ -117,7 +116,6 @@ typedef unsigned char dns_offsets_t[128]; typedef struct dns_order dns_order_t; typedef struct dns_peer dns_peer_t; typedef struct dns_peerlist dns_peerlist_t; -typedef struct dns_portlist dns_portlist_t; typedef struct dns_rbt dns_rbt_t; typedef uint16_t dns_rcode_t; typedef struct dns_rdata dns_rdata_t; diff --git a/lib/dns/portlist.c b/lib/dns/portlist.c deleted file mode 100644 index 5f25be2a48..0000000000 --- a/lib/dns/portlist.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DNS_PORTLIST_MAGIC ISC_MAGIC('P', 'L', 'S', 'T') -#define DNS_VALID_PORTLIST(p) ISC_MAGIC_VALID(p, DNS_PORTLIST_MAGIC) - -typedef struct dns_element { - in_port_t port; - uint16_t flags; -} dns_element_t; - -struct dns_portlist { - unsigned int magic; - isc_mem_t *mctx; - isc_refcount_t refcount; - isc_mutex_t lock; - dns_element_t *list; - unsigned int allocated; - unsigned int active; -}; - -#define DNS_PL_INET 0x0001 -#define DNS_PL_INET6 0x0002 -#define DNS_PL_ALLOCATE 16 - -static int -compare(const void *arg1, const void *arg2) { - const dns_element_t *e1 = (const dns_element_t *)arg1; - const dns_element_t *e2 = (const dns_element_t *)arg2; - - if (e1->port < e2->port) { - return (-1); - } - if (e1->port > e2->port) { - return (1); - } - return (0); -} - -isc_result_t -dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp) { - dns_portlist_t *portlist; - - REQUIRE(portlistp != NULL && *portlistp == NULL); - - portlist = isc_mem_get(mctx, sizeof(*portlist)); - isc_mutex_init(&portlist->lock); - isc_refcount_init(&portlist->refcount, 1); - portlist->list = NULL; - portlist->allocated = 0; - portlist->active = 0; - portlist->mctx = NULL; - isc_mem_attach(mctx, &portlist->mctx); - portlist->magic = DNS_PORTLIST_MAGIC; - *portlistp = portlist; - return (ISC_R_SUCCESS); -} - -static dns_element_t * -find_port(dns_element_t *list, unsigned int len, in_port_t port) { - unsigned int xtry = len / 2; - unsigned int min = 0; - unsigned int max = len - 1; - unsigned int last = len; - - for (;;) { - if (list[xtry].port == port) { - return (&list[xtry]); - } - if (port > list[xtry].port) { - if (xtry == max) { - break; - } - min = xtry; - xtry = xtry + (max - xtry + 1) / 2; - INSIST(xtry <= max); - if (xtry == last) { - break; - } - last = min; - } else { - if (xtry == min) { - break; - } - max = xtry; - xtry = xtry - (xtry - min + 1) / 2; - INSIST(xtry >= min); - if (xtry == last) { - break; - } - last = max; - } - } - return (NULL); -} - -isc_result_t -dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port) { - dns_element_t *el; - isc_result_t result; - - REQUIRE(DNS_VALID_PORTLIST(portlist)); - REQUIRE(af == AF_INET || af == AF_INET6); - - LOCK(&portlist->lock); - if (portlist->active != 0) { - el = find_port(portlist->list, portlist->active, port); - if (el != NULL) { - if (af == AF_INET) { - el->flags |= DNS_PL_INET; - } else { - el->flags |= DNS_PL_INET6; - } - result = ISC_R_SUCCESS; - goto unlock; - } - } - - if (portlist->allocated <= portlist->active) { - unsigned int allocated; - allocated = portlist->allocated + DNS_PL_ALLOCATE; - el = isc_mem_get(portlist->mctx, sizeof(*el) * allocated); - if (portlist->list != NULL) { - memmove(el, portlist->list, - portlist->allocated * sizeof(*el)); - isc_mem_put(portlist->mctx, portlist->list, - portlist->allocated * sizeof(*el)); - } - portlist->list = el; - portlist->allocated = allocated; - } - portlist->list[portlist->active].port = port; - if (af == AF_INET) { - portlist->list[portlist->active].flags = DNS_PL_INET; - } else { - portlist->list[portlist->active].flags = DNS_PL_INET6; - } - portlist->active++; - qsort(portlist->list, portlist->active, sizeof(*el), compare); - result = ISC_R_SUCCESS; -unlock: - UNLOCK(&portlist->lock); - return (result); -} - -void -dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port) { - dns_element_t *el; - - REQUIRE(DNS_VALID_PORTLIST(portlist)); - REQUIRE(af == AF_INET || af == AF_INET6); - - LOCK(&portlist->lock); - if (portlist->active != 0) { - el = find_port(portlist->list, portlist->active, port); - if (el != NULL) { - if (af == AF_INET) { - el->flags &= ~DNS_PL_INET; - } else { - el->flags &= ~DNS_PL_INET6; - } - if (el->flags == 0) { - *el = portlist->list[portlist->active]; - portlist->active--; - qsort(portlist->list, portlist->active, - sizeof(*el), compare); - } - } - } - UNLOCK(&portlist->lock); -} - -bool -dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port) { - dns_element_t *el; - bool result = false; - - REQUIRE(DNS_VALID_PORTLIST(portlist)); - REQUIRE(af == AF_INET || af == AF_INET6); - LOCK(&portlist->lock); - if (portlist->active != 0) { - el = find_port(portlist->list, portlist->active, port); - if (el != NULL) { - if (af == AF_INET && (el->flags & DNS_PL_INET) != 0) { - result = true; - } - if (af == AF_INET6 && (el->flags & DNS_PL_INET6) != 0) { - result = true; - } - } - } - UNLOCK(&portlist->lock); - return (result); -} - -void -dns_portlist_attach(dns_portlist_t *portlist, dns_portlist_t **portlistp) { - REQUIRE(DNS_VALID_PORTLIST(portlist)); - REQUIRE(portlistp != NULL && *portlistp == NULL); - - isc_refcount_increment(&portlist->refcount); - *portlistp = portlist; -} - -void -dns_portlist_detach(dns_portlist_t **portlistp) { - REQUIRE(portlistp != NULL && DNS_VALID_PORTLIST(*portlistp)); - dns_portlist_t *portlist = *portlistp; - *portlistp = NULL; - - if (isc_refcount_decrement(&portlist->refcount) == 1) { - portlist->magic = 0; - isc_refcount_destroy(&portlist->refcount); - if (portlist->list != NULL) { - isc_mem_put(portlist->mctx, portlist->list, - portlist->allocated * - sizeof(*portlist->list)); - } - isc_mutex_destroy(&portlist->lock); - isc_mem_putanddetach(&portlist->mctx, portlist, - sizeof(*portlist)); - } -} diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in index e446d4dc23..6567fa4ced 100644 --- a/lib/dns/win32/libdns.def.in +++ b/lib/dns/win32/libdns.def.in @@ -240,15 +240,6 @@ dns_dbiterator_pause dns_dbiterator_prev dns_dbiterator_seek dns_dbiterator_setcleanmode -dns_dbtable_add -dns_dbtable_adddefault -dns_dbtable_attach -dns_dbtable_create -dns_dbtable_detach -dns_dbtable_find -dns_dbtable_getdefault -dns_dbtable_remove -dns_dbtable_removedefault dns_decompress_edns dns_decompress_getmethods dns_decompress_init @@ -289,10 +280,8 @@ dns_dispatch_starttcp dns_dispatchmgr_create dns_dispatchmgr_destroy dns_dispatchmgr_getblackhole -dns_dispatchmgr_getblackportlist dns_dispatchmgr_setavailports dns_dispatchmgr_setblackhole -dns_dispatchmgr_setblackportlist dns_dispatchmgr_setstats dns_dispatchset_cancelall dns_dispatchset_create @@ -742,12 +731,6 @@ dns_peerlist_currpeer dns_peerlist_detach dns_peerlist_new dns_peerlist_peerbyaddr -dns_portlist_add -dns_portlist_attach -dns_portlist_create -dns_portlist_detach -dns_portlist_match -dns_portlist_remove dns_private_chains dns_private_totext dns_rbt_addname diff --git a/lib/dns/win32/libdns.vcxproj.filters.in b/lib/dns/win32/libdns.vcxproj.filters.in index 5ba61623f0..a7de95a273 100644 --- a/lib/dns/win32/libdns.vcxproj.filters.in +++ b/lib/dns/win32/libdns.vcxproj.filters.in @@ -63,9 +63,6 @@ Library Source Files - - Library Source Files - Library Source Files @@ -161,9 +158,6 @@ Library Source Files - - Library Source Files - Library Source Files @@ -380,9 +374,6 @@ Library Header Files - - Library Header Files - Library Header Files @@ -505,9 +496,6 @@ Library Header Files - - Library Header Files - Library Header Files diff --git a/lib/dns/win32/libdns.vcxproj.in b/lib/dns/win32/libdns.vcxproj.in index 9af373e06c..6c9fbd62b8 100644 --- a/lib/dns/win32/libdns.vcxproj.in +++ b/lib/dns/win32/libdns.vcxproj.in @@ -130,7 +130,6 @@ - @@ -184,7 +183,6 @@ @END PKCS11 - @@ -246,7 +244,6 @@ - @@ -289,7 +286,6 @@ - diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am index c6b63a410b..717da02e56 100644 --- a/lib/isc/Makefile.am +++ b/lib/isc/Makefile.am @@ -15,7 +15,6 @@ libisc_la_HEADERS = \ include/isc/base64.h \ include/isc/bind9.h \ include/isc/buffer.h \ - include/isc/bufferlist.h \ include/isc/cmocka.h \ include/isc/commandline.h \ include/isc/counter.h \ @@ -159,7 +158,6 @@ libisc_la_SOURCES = \ base64.c \ bind9.c \ buffer.c \ - bufferlist.c \ commandline.c \ counter.c \ crc64.c \ diff --git a/lib/isc/bufferlist.c b/lib/isc/bufferlist.c deleted file mode 100644 index 8393d1da08..0000000000 --- a/lib/isc/bufferlist.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -#include - -#include -#include -#include - -unsigned int -isc_bufferlist_usedcount(isc_bufferlist_t *bl) { - isc_buffer_t *buffer; - unsigned int length; - - REQUIRE(bl != NULL); - - length = 0; - buffer = ISC_LIST_HEAD(*bl); - while (buffer != NULL) { - REQUIRE(ISC_BUFFER_VALID(buffer)); - length += isc_buffer_usedlength(buffer); - buffer = ISC_LIST_NEXT(buffer, link); - } - - return (length); -} - -unsigned int -isc_bufferlist_availablecount(isc_bufferlist_t *bl) { - isc_buffer_t *buffer; - unsigned int length; - - REQUIRE(bl != NULL); - - length = 0; - buffer = ISC_LIST_HEAD(*bl); - while (buffer != NULL) { - REQUIRE(ISC_BUFFER_VALID(buffer)); - length += isc_buffer_availablelength(buffer); - buffer = ISC_LIST_NEXT(buffer, link); - } - - return (length); -} diff --git a/lib/isc/include/isc/bufferlist.h b/lib/isc/include/isc/bufferlist.h deleted file mode 100644 index 8fe6e36abf..0000000000 --- a/lib/isc/include/isc/bufferlist.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#ifndef ISC_BUFFERLIST_H -#define ISC_BUFFERLIST_H 1 - -/***** -***** Module Info -*****/ - -/*! \file isc/bufferlist.h - * - * - *\brief Buffer lists have no synchronization. Clients must ensure - * exclusive * access. - * - * \li Reliability: - * No anticipated impact. - * - * \li Security: - * No anticipated impact. - * - * \li Standards: - * None. - */ - -/*** - *** Imports - ***/ - -#include -#include - -ISC_LANG_BEGINDECLS - -/*** - *** Functions - ***/ - -unsigned int -isc_bufferlist_usedcount(isc_bufferlist_t *bl); -/*!< - * \brief Return the length of the sum of all used regions of all buffers in - * the buffer list 'bl' - * - * Requires: - * - *\li 'bl' is not NULL. - * - * Returns: - *\li sum of all used regions' lengths. - */ - -unsigned int -isc_bufferlist_availablecount(isc_bufferlist_t *bl); -/*!< - * \brief Return the length of the sum of all available regions of all buffers - * in the buffer list 'bl' - * - * Requires: - * - *\li 'bl' is not NULL. - * - * Returns: - *\li sum of all available regions' lengths. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_BUFFERLIST_H */ diff --git a/lib/isc/win32/libisc.def.in b/lib/isc/win32/libisc.def.in index 8c2ba39c90..6ce39f6fef 100644 --- a/lib/isc/win32/libisc.def.in +++ b/lib/isc/win32/libisc.def.in @@ -161,8 +161,6 @@ isc_buffer_putdecint isc_buffer_reinit isc_buffer_reserve isc_buffer_setautorealloc -isc_bufferlist_availablecount -isc_bufferlist_usedcount isc_commandline_parse isc_commandline_strtoargv isc_condition_broadcast diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 80f17237d7..216be2f3a3 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -59,9 +59,6 @@ Library Header Files - - Library Header Files - Library Header Files @@ -470,9 +467,6 @@ Library Source Files - - Library Source Files - Library Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index 17d292fb46..9da70435f0 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -266,7 +266,6 @@ copy InstallFiles ..\Build\Release\ - @@ -383,7 +382,6 @@ copy InstallFiles ..\Build\Release\ - diff --git a/util/copyrights b/util/copyrights index 772ad87b86..20d0240542 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1279,7 +1279,6 @@ ./lib/dns/compress.c C 1999,2000,2001,2004,2005,2006,2007,2015,2016,2017,2018,2019,2020 ./lib/dns/db.c C 1999,2000,2001,2003,2004,2005,2007,2008,2009,2011,2012,2013,2015,2016,2017,2018,2019 ./lib/dns/dbiterator.c C 1999,2000,2001,2004,2005,2007,2016,2018,2019,2020 -./lib/dns/dbtable.c C 1999,2000,2001,2004,2005,2007,2013,2016,2018,2019,2020 ./lib/dns/diff.c C 2000,2001,2002,2003,2004,2005,2007,2008,2009,2011,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/dispatch.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/dlz.c C.PORTION 1999,2000,2001,2005,2007,2009,2010,2011,2012,2013,2015,2016,2018,2019,2020 @@ -1321,7 +1320,6 @@ ./lib/dns/include/dns/compress.h C 1999,2000,2001,2002,2004,2005,2006,2007,2009,2015,2016,2017,2018,2019,2020 ./lib/dns/include/dns/db.h C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019 ./lib/dns/include/dns/dbiterator.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020 -./lib/dns/include/dns/dbtable.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/dns/include/dns/diff.h C 2000,2001,2004,2005,2006,2007,2008,2009,2010,2013,2016,2018,2019,2020 ./lib/dns/include/dns/dispatch.h C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/include/dns/dlz.h C.PORTION 1999,2000,2001,2005,2006,2007,2009,2010,2011,2012,2013,2016,2018,2019,2020 @@ -1363,7 +1361,6 @@ ./lib/dns/include/dns/opcode.h C 2002,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/dns/include/dns/order.h C 2002,2004,2005,2006,2007,2016,2017,2018,2019,2020 ./lib/dns/include/dns/peer.h C 2000,2001,2003,2004,2005,2006,2007,2008,2009,2013,2014,2015,2016,2017,2018,2019,2020 -./lib/dns/include/dns/portlist.h C 2003,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/dns/include/dns/private.h C 2009,2011,2012,2016,2018,2019,2020 ./lib/dns/include/dns/rbt.h C 1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/include/dns/rcode.h C 1999,2000,2001,2004,2005,2006,2007,2008,2016,2018,2019,2020 @@ -1437,7 +1434,6 @@ ./lib/dns/pkcs11ecdsa_link.c C 2014,2015,2016,2017,2018,2019,2020 ./lib/dns/pkcs11eddsa_link.c C 2017,2018,2019,2020 ./lib/dns/pkcs11rsa_link.c C 2014,2015,2016,2017,2018,2019,2020 -./lib/dns/portlist.c C 2003,2004,2005,2006,2007,2014,2016,2018,2019,2020 ./lib/dns/private.c C 2009,2011,2012,2015,2016,2017,2018,2019,2020 ./lib/dns/rbt.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/rbtdb.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -1763,7 +1759,6 @@ ./lib/isc/base64.c C 1998,1999,2000,2001,2003,2004,2005,2007,2009,2013,2014,2015,2016,2018,2019,2020 ./lib/isc/bind9.c C 2013,2016,2018,2019,2020 ./lib/isc/buffer.c C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2012,2014,2015,2016,2017,2018,2019,2020 -./lib/isc/bufferlist.c C 1999,2000,2001,2004,2005,2007,2016,2018,2019,2020 ./lib/isc/commandline.c C.PORTION 1999,2000,2001,2004,2005,2007,2008,2014,2015,2016,2018,2019,2020 ./lib/isc/counter.c C 2014,2016,2018,2019,2020 ./lib/isc/crc64.c C 2013,2016,2018,2019,2020 @@ -1792,7 +1787,6 @@ ./lib/isc/include/isc/base64.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isc/include/isc/bind9.h C 2009,2013,2016,2018,2019,2020 ./lib/isc/include/isc/buffer.h C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2010,2012,2014,2016,2017,2018,2019,2020 -./lib/isc/include/isc/bufferlist.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isc/include/isc/cmocka.h C 2020 ./lib/isc/include/isc/commandline.h C 1999,2000,2001,2004,2005,2006,2007,2015,2016,2018,2019,2020 ./lib/isc/include/isc/counter.h C 2014,2016,2018,2019,2020