]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove old cruft from dnsrps code
authorOndřej Surý <ondrej@isc.org>
Mon, 19 Aug 2024 13:41:43 +0000 (15:41 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 18 Sep 2024 15:24:13 +0000 (17:24 +0200)
There was some old cruft for ancient compilers checking for attributes
that we regularly use, etc.  Just remove the cruft.

bin/tests/system/rpz/testlib/Makefile.am
bin/tests/system/rpz/testlib/dummylib.c
bin/tests/system/rpz/testlib/test-data.c
bin/tests/system/rpz/testlib/test-data.h
configure.ac
lib/dns/include/dns/librpz.h

index 6271fdb3fab9a4ae6006cef619c8a54bdc040dd9..313a56d3d63789b2a01922964446e98eab44b65e 100644 (file)
@@ -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
index 71e3de6c1c5684a196ae8d02b0811aa7abd066a5..1bba21bd8ec2cc49964ce6645bc9c611c1fdc675 100644 (file)
 #include <time.h>
 #include <unistd.h>
 
+#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#include <arpa/nameser_compat.h>
+#endif /* HAVE_ARPA_NAMESER_COMPAT_H */
+
 #include <isc/endian.h>
 #include <isc/util.h>
 
@@ -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;
index 91237d4fef646cadf313f6cbdfecd1516ed6dc85..8db9bb2555d4a50d4c8d1524b676a13d271deeed 100644 (file)
 #include <stdlib.h>
 #include <unistd.h>
 
+#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#include <arpa/nameser_compat.h>
+#endif /* HAVE_ARPA_NAMESER_COMPAT_H */
+
 #include <isc/atomic.h>
 #include <isc/util.h>
 
@@ -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) {
index 63ae0f6cca8e862e94328a41df570d596b19095b..b43d26d3ac92c46621bef8958545f31abb37471d 100644 (file)
  * limitations under the License.
  */
 
-#define LIBRPZ_LIB_OPEN 2
 #include <dns/librpz.h>
 
-#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
index c3c77f603de657de53eff3bf7bc01321cb4f6fd3..80b98ac94889f0f6ac2c6b61f0bee417a354cf75 100644 (file)
@@ -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],
index 79f307f7019e49a32b70e1ab705b34209f8bcb4e..aee8d0fbf51acb3632ba3c1284251d3ace100f5e 100644 (file)
@@ -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)