From e3cbf2106e3d168b5feec98a0dc700a5193740e9 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 23 May 2023 00:12:49 +0200 Subject: [PATCH] ldns: fix the build in FreeBSD's base system This adds an ldns/internal.h C header, containing a copy of the function prototypes for internal functions not exposed in the API. It effectively works around the following compilation error: error: no previous prototype for function [-Werror,-Wmissing-prototypes] This header is not installed, and does not affect the API exposed. Tested on FreeBSD/amd64 (14.0-CURRENT). --- contrib/ldns/dnssec_zone.c | 1 + contrib/ldns/edns.c | 1 + contrib/ldns/ldns/internal.h | 65 ++++++++++++++++++++++++++++++++++++ contrib/ldns/packet.c | 1 + contrib/ldns/rr.c | 1 + contrib/ldns/str2host.c | 1 + contrib/ldns/util.c | 1 + 7 files changed, 71 insertions(+) create mode 100644 contrib/ldns/ldns/internal.h diff --git a/contrib/ldns/dnssec_zone.c b/contrib/ldns/dnssec_zone.c index 7be6791e7f5db6..0a745a0c75d9e7 100644 --- a/contrib/ldns/dnssec_zone.c +++ b/contrib/ldns/dnssec_zone.c @@ -5,6 +5,7 @@ #include #include +#include ldns_dnssec_rrs * ldns_dnssec_rrs_new(void) diff --git a/contrib/ldns/edns.c b/contrib/ldns/edns.c index 3d002d67ed8c8c..25819450c825ef 100644 --- a/contrib/ldns/edns.c +++ b/contrib/ldns/edns.c @@ -11,6 +11,7 @@ */ #include +#include #define LDNS_OPTIONLIST_INIT 8 diff --git a/contrib/ldns/ldns/internal.h b/contrib/ldns/ldns/internal.h new file mode 100644 index 00000000000000..1f258552fd532b --- /dev/null +++ b/contrib/ldns/ldns/internal.h @@ -0,0 +1,65 @@ +#ifndef LDNS_INTERNAL_H +#define LDNS_INTERNAL_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* dnssec_zone.c */ +ldns_status +dnssec_zone_equip_zonemd(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, ldns_key_list *key_list, int signflags); + +/* edns.c */ +void +ldns_edns_set_code(ldns_edns_option *edns, ldns_edns_option_code code); +void +ldns_edns_set_data(ldns_edns_option *edns, void *data); +void +ldns_edns_set_size(ldns_edns_option *edns, size_t size); + +/* net.c */ +int +ldns_tcp_bgsend2(ldns_buffer *qbin, + const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout); +int +ldns_tcp_connect2(const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout); +int +ldns_udp_bgsend2(ldns_buffer *qbin, + const struct sockaddr_storage *to , socklen_t tolen, + struct timeval timeout); +int +ldns_udp_connect2(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(timeout)); + +/* packet.c */ +ldns_edns_option_list* +pkt_edns_data2edns_option_list(const ldns_rdf *edns_data); + +/* rr.c */ +ldns_status +_ldns_rr_new_frm_fp_l_internal(ldns_rr **newrr, FILE *fp, + uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, + int *line_nr, bool *explicit_ttl); + +/* str2host.c */ +ldns_status svcparam_key2buffer_str(ldns_buffer *output, uint16_t key); + +/* util.c */ +struct tm * +ldns_serial_arithmetics_gmtime_r(int32_t time, time_t now, struct tm *result); +#undef ldns_serial_arithmitics_gmtime_r +struct tm * +ldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result); +#define ldns_serial_arithmitics_gmtime_r ldns_serial_arithmetics_gmtime_r + + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_INTERNAL_H */ diff --git a/contrib/ldns/packet.c b/contrib/ldns/packet.c index afa59005c3bda6..3c10a96b492772 100644 --- a/contrib/ldns/packet.c +++ b/contrib/ldns/packet.c @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/contrib/ldns/rr.c b/contrib/ldns/rr.c index 95ab71d349467c..cf565ba0b51d72 100644 --- a/contrib/ldns/rr.c +++ b/contrib/ldns/rr.c @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/contrib/ldns/str2host.c b/contrib/ldns/str2host.c index 5b78e5bc5907a4..02cbb19dad0e0f 100644 --- a/contrib/ldns/str2host.c +++ b/contrib/ldns/str2host.c @@ -13,6 +13,7 @@ #include #include +#include #ifdef HAVE_SYS_SOCKET_H #include diff --git a/contrib/ldns/util.c b/contrib/ldns/util.c index 807a99e2308d3b..79f0f5877abaf9 100644 --- a/contrib/ldns/util.c +++ b/contrib/ldns/util.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include