Commit 8a8e91e0 authored by Marek Vavrusa's avatar Marek Vavrusa Committed by Ondřej Surý

build: fixed build with libknot<2.3 without cookies

the cookies require libknot>=2.3, Makefile didn't
check for that, and turning cookies off wasn't
possible either
parent 6e49e057
......@@ -65,8 +65,11 @@ endif
BUILD_CFLAGS += $(libknot_CFLAGS) $(libuv_CFLAGS) $(nettle_CFLAGS) $(cmocka_CFLAGS) $(lua_CFLAGS) $(libdnssec_CFLAGS) $(libsystemd_CFLAGS)
BUILD_CFLAGS += $(addprefix -I,$(wildcard contrib/ccan/*) contrib/murmurhash3)
ifeq ($(HAS_nettle),yes)
# Check if it has libknot 2.3.0 and nettle to support DNS cookies
$(eval $(call find_alt,knot230,libknot,2.3))
ifeq ($(HAS_nettle)|$(HAS_knot230),yes|yes)
BUILD_CFLAGS += -DENABLE_COOKIES
ENABLE_COOKIES := yes
endif
# Overview
......
......@@ -16,11 +16,17 @@
#pragma once
#include <libknot/rrtype/opt.h>
#include <libknot/rrtype/opt-cookie.h>
#include <netinet/in.h>
#include <stdint.h>
#if defined(ENABLE_COOKIES)
#include <libknot/rrtype/opt.h>
#include <libknot/rrtype/opt-cookie.h>
#else
#define KNOT_OPT_COOKIE_CLNT 8
#define KNOT_OPT_COOKIE_SRVR_MAX 32
#endif /* defined(ENABLE_COOKIES) */
#include "lib/defines.h"
#include "lib/generic/lru.h"
......
......@@ -44,7 +44,7 @@ libkres_CFLAGS := -fvisibility=hidden -fPIC $(lmdb_CFLAGS)
libkres_LIBS := $(contrib_TARGET) $(libknot_LIBS) $(libdnssec_LIBS) $(lmdb_LIBS)
libkres_TARGET := -L$(abspath lib) -lkres
ifeq ($(HAS_nettle),yes)
ifeq ($(ENABLE_COOKIES),yes)
libkres_SOURCES += \
lib/cookies/alg_containers.c \
lib/cookies/alg_sha.c \
......
......@@ -31,6 +31,8 @@
#include "lib/cookies/control.h"
#include "lib/cookies/helper.h"
#include "lib/cookies/nonce.h"
#else /* Define compatibility macros */
#define KNOT_EDNS_OPTION_COOKIE 10
#endif /* defined(ENABLE_COOKIES) */
#define DEBUG_MSG(qry, fmt...) QRDEBUG((qry), "resl", fmt)
......
......@@ -3,7 +3,7 @@ modules_TARGETS := hints \
stats
# DNS cookies
ifeq ($(HAS_nettle),yes)
ifeq ($(ENABLE_COOKIES),yes)
modules_TARGETS += cookies
endif
......
Markdown is supported
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