From: Ondřej Surý Date: Mon, 19 Aug 2024 13:41:43 +0000 (+0200) Subject: Remove old cruft from dnsrps code X-Git-Tag: v9.21.2~32^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7bff3c0f9c9d7365e5dedbd306aed80600741e8;p=thirdparty%2Fbind9.git Remove old cruft from dnsrps code There was some old cruft for ancient compilers checking for attributes that we regularly use, etc. Just remove the cruft. --- diff --git a/bin/tests/system/rpz/testlib/Makefile.am b/bin/tests/system/rpz/testlib/Makefile.am index 6271fdb3fab..313a56d3d63 100644 --- a/bin/tests/system/rpz/testlib/Makefile.am +++ b/bin/tests/system/rpz/testlib/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ $(LIBDNS_CFLAGS) -AM_CFLAGS += -Wall -pedantic +AM_CFLAGS += -Wall -pedantic -Wno-zero-length-array noinst_LTLIBRARIES = libdummyrpz.la libdummyrpz_la_SOURCES= dummylib.c test-data.c trpz.h test-data.h diff --git a/bin/tests/system/rpz/testlib/dummylib.c b/bin/tests/system/rpz/testlib/dummylib.c index 71e3de6c1c5..1bba21bd8ec 100644 --- a/bin/tests/system/rpz/testlib/dummylib.c +++ b/bin/tests/system/rpz/testlib/dummylib.c @@ -42,6 +42,10 @@ #include #include +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +#include +#endif /* HAVE_ARPA_NAMESER_COMPAT_H */ + #include #include @@ -2124,7 +2128,7 @@ trpz_rsp_rr(librpz_emsg_t *emsg, uint16_t *typep, uint16_t *classp, /* If there's CNAME wild card expansion */ if (qname != NULL && qname_size != 0 && - (this_rr->type == ns_t_cname) && + (this_rr->type == T_CNAME) && (this_rr->rdlength > 2)) { if (this_rr->rdata[0] == 1 && @@ -2199,7 +2203,7 @@ trpz_rsp_rr(librpz_emsg_t *emsg, uint16_t *typep, uint16_t *classp, trsp->rstack[0].result.next_rr = this_rr->rrn; last_result->rridx++; } else { - SET_IF_NOT_NULL(typep, ns_t_invalid); + SET_IF_NOT_NULL(typep, 0); if (rrp != NULL) { *rrp = NULL; diff --git a/bin/tests/system/rpz/testlib/test-data.c b/bin/tests/system/rpz/testlib/test-data.c index 91237d4fef6..8db9bb2555d 100644 --- a/bin/tests/system/rpz/testlib/test-data.c +++ b/bin/tests/system/rpz/testlib/test-data.c @@ -37,6 +37,10 @@ #include #include +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +#include +#endif /* HAVE_ARPA_NAMESER_COMPAT_H */ + #include #include @@ -397,7 +401,7 @@ add_other_rr(trpz_result_t *node, const char *rrtype, const char *val, *modified = 0; - nrec.class = ns_c_in; + nrec.class = C_IN; nrec.ttl = ttl; nrec.rrn = atomic_fetch_add_relaxed(&rrn, 1); @@ -412,7 +416,7 @@ add_other_rr(trpz_result_t *node, const char *rrtype, const char *val, return (-1); } - nrec.type = ns_t_a; + nrec.type = T_A; nrec.rdlength = sizeof(uint32_t); nrec.rdata = malloc(nrec.rdlength); @@ -433,7 +437,7 @@ add_other_rr(trpz_result_t *node, const char *rrtype, const char *val, return (-1); } - nrec.type = ns_t_aaaa; + nrec.type = T_AAAA; nrec.rdlength = sizeof(addr); nrec.rdata = malloc(nrec.rdlength); @@ -444,7 +448,7 @@ add_other_rr(trpz_result_t *node, const char *rrtype, const char *val, memmove(nrec.rdata, addr, nrec.rdlength); } else if (!strcasecmp(rrtype, "TXT")) { - nrec.type = ns_t_txt; + nrec.type = T_TXT; nrec.rdlength = 1 + strlen(val); nrec.rdata = calloc(nrec.rdlength, 1); @@ -458,7 +462,7 @@ add_other_rr(trpz_result_t *node, const char *rrtype, const char *val, } else if (!strcasecmp(rrtype, "CNAME")) { int ret; - nrec.type = ns_t_cname; + nrec.type = T_CNAME; ret = wdns_str_to_name(val, &(nrec.rdata), 1); if (ret <= 0) { @@ -473,7 +477,7 @@ add_other_rr(trpz_result_t *node, const char *rrtype, const char *val, } else if (!strcasecmp(rrtype, "DNAME")) { int ret; - nrec.type = ns_t_dname; + nrec.type = T_DNAME; ret = wdns_str_to_name(val, &(nrec.rdata), 1); if (ret <= 0) { diff --git a/bin/tests/system/rpz/testlib/test-data.h b/bin/tests/system/rpz/testlib/test-data.h index 63ae0f6cca8..b43d26d3ac9 100644 --- a/bin/tests/system/rpz/testlib/test-data.h +++ b/bin/tests/system/rpz/testlib/test-data.h @@ -28,25 +28,8 @@ * limitations under the License. */ -#define LIBRPZ_LIB_OPEN 2 #include -#if __NAMESER < 19991006 -/* - * If the new API is not available define the values we use. - */ - -#define ns_c_in 1 - -#define ns_t_invalid 0 -#define ns_t_a 1 -#define ns_t_cname 5 -#define ns_t_txt 16 -#define ns_t_aaaa 28 -#define ns_t_dname 39 - -#endif - #include "trpz.h" #define NODE_FLAG_IPV6_ADDRESS 0x1 diff --git a/configure.ac b/configure.ac index c3c77f603de..80b98ac9488 100644 --- a/configure.ac +++ b/configure.ac @@ -360,6 +360,11 @@ AC_CHECK_HEADERS([fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sy # AC_CHECK_HEADERS([threads.h]) +# +# Also missing from OpenBSD +# +AC_CHECK_HEADERS([arpa/nameser_compat.h]) + # # C11 Atomic Operations # @@ -1361,22 +1366,6 @@ AC_DEFINE_UNQUOTED([VALIDATION_DEFAULT], ["$validation_default"], [the default v # modern C compiler. It is enabled on systems with dlopen() and librpz.so. # dnsrps_avail=yes -AC_MSG_CHECKING([for librpz __attribute__s]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[]], - [[ - extern void f(char *p __attribute__((unused)), ...) - __attribute__((format(printf,1,2))) __attribute__((__noreturn__)); - ]])], - [ - librpz_have_attr=yes - AC_DEFINE([LIBRPZ_HAVE_ATTR], [1], [have __attribute__s used in librpz.h]) - AC_MSG_RESULT([yes]) - ],[ - librpz_have_attr=no - AC_MSG_RESULT([no]) - ]) # [pairwise: --enable-dnsrps --enable-dnsrps-dl, --disable-dnsrps] AC_ARG_ENABLE([dnsrps-dl], @@ -1385,9 +1374,6 @@ AC_ARG_ENABLE([dnsrps-dl], [default=yes]])], [enable_dnsrps_dl="$enableval"], [enable_dnsrps_dl="yes"]) -AS_IF([test "$enable_dnsrps_dl" = "yes" -a "$with_dlopen" = "no"], - [AC_MSG_ERROR([DNS Response Policy Service delayed link requires dlopen to be enabled])]) - # [pairwise: skip] AC_ARG_WITH([dnsrps-libname], [AS_HELP_STRING([--with-dnsrps-libname], diff --git a/lib/dns/include/dns/librpz.h b/lib/dns/include/dns/librpz.h index 79f307f7019..aee8d0fbf51 100644 --- a/lib/dns/include/dns/librpz.h +++ b/lib/dns/include/dns/librpz.h @@ -214,15 +214,9 @@ typedef struct { char c[120]; } librpz_emsg_t; -#ifdef LIBRPZ_HAVE_ATTR -#define LIBRPZ_UNUSED ISC_ATTR_UNUSED -#define LIBRPZ_PF(f, l) __attribute__((format(printf, f, l))) +#define LIBRPZ_UNUSED __attribute__((__unused__)) +#define LIBRPZ_PF(f, l) __attribute__((__format__(printf, f, l))) #define LIBRPZ_NORET __attribute__((__noreturn__)) -#else /* ifdef LIBRPZ_HAVE_ATTR */ -#define LIBRPZ_UNUSED -#define LIBRPZ_PF(f, l) -#define LIBRPZ_NORET -#endif /* ifdef LIBRPZ_HAVE_ATTR */ typedef bool(librpz_parse_log_opt_t)(librpz_emsg_t *emsg, const char *arg); LIBDEF_F(parse_log_opt)