]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove ns_listenlist_default()
authorPetr Menšík <pemensik@redhat.com>
Mon, 6 Dec 2021 12:44:51 +0000 (13:44 +0100)
committerEvan Hunt <each@isc.org>
Tue, 26 Nov 2024 23:22:30 +0000 (15:22 -0800)
It is not used anywhere in named and is no longer necessary
there.  It was called in some unit tests, but was not actually
needed by them.

lib/ns/include/ns/listenlist.h
lib/ns/listenlist.c
tests/ns/Makefile.am
tests/ns/listenlist_test.c [deleted file]

index 275be49a518e7f7f62f4a42e2ee0b1db2d4d5978..476df4c4ddf6b79ad51645c0f0a15114dd9a3cd2 100644 (file)
@@ -131,12 +131,3 @@ ns_listenlist_detach(ns_listenlist_t **listp);
 /*%<
  * Detach 'listp'.
  */
-
-isc_result_t
-ns_listenlist_default(isc_mem_t *mctx, in_port_t port, bool enabled,
-                     const uint16_t family, ns_listenlist_t **target);
-/*%<
- * Create a listen-on list with default contents, matching
- * all addresses with port 'port' (if 'enabled' is true),
- * or no addresses (if 'enabled' is false).
- */
index 1ef4a2918abf0a1a84f505356c29f6df8f107b15..b1bde1ad8291702bf4d3b65c0b18df640780b6c9 100644 (file)
@@ -322,45 +322,3 @@ ns_listenlist_detach(ns_listenlist_t **listp) {
                destroy(list);
        }
 }
-
-isc_result_t
-ns_listenlist_default(isc_mem_t *mctx, in_port_t port, bool enabled,
-                     const uint16_t family, ns_listenlist_t **target) {
-       isc_result_t result;
-       dns_acl_t *acl = NULL;
-       ns_listenelt_t *elt = NULL;
-       ns_listenlist_t *list = NULL;
-
-       REQUIRE(target != NULL && *target == NULL);
-       if (enabled) {
-               result = dns_acl_any(mctx, &acl);
-       } else {
-               result = dns_acl_none(mctx, &acl);
-       }
-       if (result != ISC_R_SUCCESS) {
-               goto cleanup;
-       }
-
-       result = ns_listenelt_create(mctx, port, acl, family, false, NULL, NULL,
-                                    ISC_NM_PROXY_NONE, &elt);
-       if (result != ISC_R_SUCCESS) {
-               goto cleanup_acl;
-       }
-
-       result = ns_listenlist_create(mctx, &list);
-       if (result != ISC_R_SUCCESS) {
-               goto cleanup_listenelt;
-       }
-
-       ISC_LIST_APPEND(list->elts, elt, link);
-
-       *target = list;
-       return ISC_R_SUCCESS;
-
-cleanup_listenelt:
-       ns_listenelt_destroy(elt);
-cleanup_acl:
-       dns_acl_detach(&acl);
-cleanup:
-       return result;
-}
index c26bec85e697119ae6d0a3f60735c6c16694fb1e..655bdc835c53af80557f7c3b127b5fb40c7a12d3 100644 (file)
@@ -15,7 +15,6 @@ LDADD +=                      \
        $(LIBUV_LIBS)
 
 check_PROGRAMS =               \
-       listenlist_test         \
        notify_test             \
        plugin_test             \
        query_test
diff --git a/tests/ns/listenlist_test.c b/tests/ns/listenlist_test.c
deleted file mode 100644 (file)
index 327526d..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * 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 <inttypes.h>
-#include <sched.h> /* IWYU pragma: keep */
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define UNIT_TESTING
-#include <cmocka.h>
-
-#include <isc/list.h>
-#include <isc/random.h>
-#include <isc/util.h>
-
-#include <dns/acl.h>
-
-#include <ns/listenlist.h>
-
-#include <tests/ns.h>
-
-/* test that ns_listenlist_default() works */
-ISC_RUN_TEST_IMPL(ns_listenlist_default) {
-       isc_result_t result;
-       in_port_t port = 5300 + isc_random8();
-       ns_listenlist_t *list = NULL;
-       ns_listenelt_t *elt;
-       int count;
-
-       UNUSED(state);
-
-       result = ns_listenlist_default(mctx, port, false, AF_INET, &list);
-       assert_int_equal(result, ISC_R_SUCCESS);
-       assert_non_null(list);
-
-       assert_false(ISC_LIST_EMPTY(list->elts));
-
-       count = 0;
-       elt = ISC_LIST_HEAD(list->elts);
-       while (elt != NULL) {
-               ns_listenelt_t *next = ISC_LIST_NEXT(elt, link);
-               dns_acl_t *acl = NULL;
-
-               dns_acl_attach(elt->acl, &acl);
-               ISC_LIST_UNLINK(list->elts, elt, link);
-               ns_listenelt_destroy(elt);
-               elt = next;
-
-               assert_true(dns_acl_isnone(acl));
-               dns_acl_detach(&acl);
-               count++;
-       }
-
-       assert_true(ISC_LIST_EMPTY(list->elts));
-       assert_int_equal(count, 1);
-
-       ns_listenlist_detach(&list);
-
-       result = ns_listenlist_default(mctx, port, true, AF_INET, &list);
-       assert_int_equal(result, ISC_R_SUCCESS);
-
-       assert_false(ISC_LIST_EMPTY(list->elts));
-
-       /* This time just use ns_listenlist_detach() to destroy elements */
-       count = 0;
-       elt = ISC_LIST_HEAD(list->elts);
-       while (elt != NULL) {
-               ns_listenelt_t *next = ISC_LIST_NEXT(elt, link);
-               assert_true(dns_acl_isany(elt->acl));
-               elt = next;
-               count++;
-       }
-
-       assert_int_equal(count, 1);
-
-       ns_listenlist_detach(&list);
-}
-
-ISC_TEST_LIST_START
-ISC_TEST_ENTRY(ns_listenlist_default)
-ISC_TEST_LIST_END
-
-ISC_TEST_MAIN