Skip to content
Snippets Groups Projects
Commit b4def593 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

better libknot-2.4 fixup

parent 38e1240c
1 merge request!161better libknot-2.4 fixup
Pipeline #1189 passed with stages
in 1 minute and 46 seconds
......@@ -26,6 +26,7 @@
#include <libknot/dname.h>
#include <libknot/rrtype/rrsig.h>
#include <libknot/rrset-dump.h>
#include <libknot/version.h>
#include "lib/defines.h"
#include "lib/utils.h"
......@@ -509,9 +510,17 @@ char *kr_module_call(struct kr_context *ctx, const char *module, const char *pro
void kr_rrset_print(const knot_rrset_t *rr)
{
#if KNOT_VERSION_HEX < ((2 << 16) | (4 << 8))
char rrtext[KNOT_DNAME_MAXLEN * 2] = {0};
knot_rrset_txt_dump(rr, rrtext, sizeof(rrtext), &KNOT_DUMP_STYLE_DEFAULT);
printf("%s", rrtext);
#else
size_t size = 4000;
char *rrtext = malloc(size);
knot_rrset_txt_dump(rr, &rrtext, &size, &KNOT_DUMP_STYLE_DEFAULT);
printf("%s", rrtext);
free(rrtext);
#endif
}
void kr_pkt_print(knot_pkt_t *pkt)
......
......@@ -20,6 +20,7 @@
#include <libknot/error.h>
#include <libknot/mm_ctx.h>
#include <libknot/rrtype/opt-cookie.h>
#include <libknot/version.h>
#include <stdlib.h>
#include <string.h>
......@@ -259,7 +260,11 @@ int check_response(kr_layer_t *ctx, knot_pkt_t *pkt)
return KR_STATE_FAIL;
}
#if KNOT_VERSION_HEX >= ((2 << 16) | (4 << 8)) // just renamed function since 2.4.0
uint16_t rcode = knot_pkt_ext_rcode(pkt);
#else
uint16_t rcode = knot_pkt_get_ext_rcode(pkt);
#endif
if (rcode == KNOT_RCODE_BADCOOKIE) {
struct kr_query *next = NULL;
if (!(qry->flags & QUERY_BADCOOKIE_AGAIN)) {
......
cookies_CFLAGS := -fvisibility=hidden -fPIC
# Compat with libknot < 2.4; the identifier got renamed since 2.4.0.
cookies_CFLAGS += $(shell pkg-config --atleast-version=2.4.0 libknot \
|| echo -Dknot_pkt_ext_rcode=knot_pkt_get_ext_rcode)
cookies_SOURCES := \
modules/cookies/cookiectl.c \
modules/cookies/cookiemonster.c \
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment