Skip to content

Commit

Permalink
ldns: fix the build in FreeBSD's base system
Browse files Browse the repository at this point in the history
This adds a copy of the function prototypes for internal functions where
necessary.

It effectively works around the following compilation error:
error: no previous prototype for function [-Werror,-Wmissing-prototypes]

Tested on FreeBSD/amd64 (14.0-CURRENT).
  • Loading branch information
khorben committed May 23, 2023
1 parent 912987b commit e252c10
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 14 deletions.
7 changes: 5 additions & 2 deletions contrib/ldns/dnssec_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
#define LDNS_SIGN_WITH_ZONEMD ( LDNS_SIGN_WITH_ZONEMD_SIMPLE_SHA384 \
| LDNS_SIGN_WITH_ZONEMD_SIMPLE_SHA512 )

/* Internal helper function */
ldns_status
dnssec_zone_equip_zonemd(ldns_dnssec_zone *zone,
ldns_rr_list *new_rrs, ldns_key_list *key_list, int signflags);

ldns_rr *
ldns_create_empty_rrsig(const ldns_rr_list *rrset,
const ldns_key *current_key)
Expand Down Expand Up @@ -1367,8 +1372,6 @@ ldns_dnssec_zone_sign(ldns_dnssec_zone *zone,
return ldns_dnssec_zone_sign_flg(zone, new_rrs, key_list, func, arg, 0);
}

ldns_status dnssec_zone_equip_zonemd(ldns_dnssec_zone *zone,
ldns_rr_list *new_rrs, ldns_key_list *key_list, int flags);
ldns_status
ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone,
ldns_rr_list *new_rrs,
Expand Down
8 changes: 4 additions & 4 deletions contrib/ldns/dnssec_zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <ldns/config.h>

#include <ldns/ldns.h>
#include <ldns/net.h>

ldns_dnssec_rrs *
ldns_dnssec_rrs_new(void)
Expand Down Expand Up @@ -605,10 +606,6 @@ ldns_todo_nsec3_ents_node_free(ldns_rbnode_t *node, void *arg) {
LDNS_FREE(node);
}

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);

ldns_status
ldns_dnssec_zone_new_frm_fp_l(ldns_dnssec_zone** z, FILE* fp, const ldns_rdf* origin,
uint32_t default_ttl, ldns_rr_class ATTR_UNUSED(c), int* line_nr)
Expand Down Expand Up @@ -1914,6 +1911,9 @@ rr_list2dnssec_rrs(ldns_rr_list *rr_list, ldns_dnssec_rrs **rrs,
}


ldns_status
dnssec_zone_equip_zonemd(ldns_dnssec_zone *zone,
ldns_rr_list *new_rrs, ldns_key_list *key_list, int signflags);
ldns_status
dnssec_zone_equip_zonemd(ldns_dnssec_zone *zone,
ldns_rr_list *new_rrs, ldns_key_list *key_list, int signflags)
Expand Down
6 changes: 3 additions & 3 deletions contrib/ldns/edns.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ ldns_edns_get_wireformat_buffer(const ldns_edns_option *edns)
}

/* write */
void
static void
ldns_edns_set_size(ldns_edns_option *edns, size_t size)
{
assert(edns != NULL);
edns->_size = size;
}

void
static void
ldns_edns_set_code(ldns_edns_option *edns, ldns_edns_option_code code)
{
assert(edns != NULL);
edns->_code = code;
}

void
static void
ldns_edns_set_data(ldns_edns_option *edns, void *data)
{
/* only copy the pointer */
Expand Down
3 changes: 3 additions & 0 deletions contrib/ldns/packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ldns/config.h>

#include <ldns/ldns.h>
#include <ldns/util.h>

#include <strings.h>
#include <limits.h>
Expand Down Expand Up @@ -758,6 +759,8 @@ ldns_pkt_edns(const ldns_pkt *pkt)
);
}

ldns_edns_option_list*
pkt_edns_data2edns_option_list(const ldns_rdf *edns_data);
ldns_edns_option_list*
pkt_edns_data2edns_option_list(const ldns_rdf *edns_data)
{
Expand Down
5 changes: 5 additions & 0 deletions contrib/ldns/rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <ldns/config.h>

#include <ldns/ldns.h>
#include <ldns/util.h>

#include <strings.h>
#include <limits.h>
Expand Down Expand Up @@ -721,6 +722,10 @@ ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin,
return ldns_rr_new_frm_fp_l(newrr, fp, ttl, origin, prev, NULL);
}

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);
ldns_status
_ldns_rr_new_frm_fp_l_internal(ldns_rr **newrr, FILE *fp,
uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev,
Expand Down
3 changes: 2 additions & 1 deletion contrib/ldns/str2host.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ldns/config.h>

#include <ldns/ldns.h>
#include <ldns/util.h>

#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
Expand Down Expand Up @@ -2198,7 +2199,7 @@ static const size_t svcparam_key_defs_len = sizeof(svcparam_key_defs)
/* svcparam_key2buffer_str() should actually be in host2str.c, but we need the
* svcparam_key_defs for it and it is not an exposed symbol anyway.
*/
ldns_status svcparam_key2buffer_str(ldns_buffer *output, uint16_t key)
static ldns_status svcparam_key2buffer_str(ldns_buffer *output, uint16_t key)
{
if (key <= LDNS_SVCPARAM_KEY_LAST_KEY)
ldns_buffer_write_string(output, svcparam_key_defs[key].str);
Expand Down
2 changes: 2 additions & 0 deletions contrib/ldns/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ ldns_serial_arithmetics_gmtime_r(int32_t time, time_t now, struct tm *result)
#endif
/* alias function because of previously used wrong spelling */
struct tm *
ldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result);
struct tm *
ldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result)
{
return ldns_serial_arithmetics_gmtime_r(time, now, result);
Expand Down
10 changes: 6 additions & 4 deletions contrib/ldns/zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
#include <strings.h>
#include <limits.h>

/* Internal helper function */
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);

ldns_rr *
ldns_zone_soa(const ldns_zone *z)
{
Expand Down Expand Up @@ -189,10 +195,6 @@ ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, const ldns_rdf *origin, uint32_t t
return ldns_zone_new_frm_fp_l(z, fp, origin, ttl, c, NULL);
}

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);

/* XXX: class is never used */
ldns_status
ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, const ldns_rdf *origin,
Expand Down

0 comments on commit e252c10

Please sign in to comment.