From a99055f0819c64a2fd61712f6b9856ba3bf7f634 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 29 Mar 2019 20:46:36 +0100 Subject: [PATCH] fixup! WIP: DoH experiment --- daemon/lua/kres-gen.lua | 2 +- daemon/lua/kres-gen.sh | 2 ++ modules/http/http_doh.lua | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/lua/kres-gen.lua b/daemon/lua/kres-gen.lua index 9d8d970bb..c369c6499 100644 --- a/daemon/lua/kres-gen.lua +++ b/daemon/lua/kres-gen.lua @@ -345,6 +345,7 @@ int kr_cache_insert_rr(struct kr_cache *, const knot_rrset_t *, const knot_rrset int kr_cache_remove(struct kr_cache *, const knot_dname_t *, uint16_t); int kr_cache_remove_subtree(struct kr_cache *, const knot_dname_t *, _Bool, int); int kr_cache_commit(struct kr_cache *); +uint32_t packet_ttl(const knot_pkt_t *, _Bool); typedef struct { uint8_t bitmap[32]; uint8_t length; @@ -440,5 +441,4 @@ int zs_parse_record(zs_scanner_t *); int zs_set_input_file(zs_scanner_t *, const char *); int zs_set_input_string(zs_scanner_t *, const char *, size_t); const char *zs_strerror(const int); -uint32_t packet_ttl(const knot_pkt_t *pkt, bool is_negative); ]] diff --git a/daemon/lua/kres-gen.sh b/daemon/lua/kres-gen.sh index 1f626beb1..83d46c069 100755 --- a/daemon/lua/kres-gen.sh +++ b/daemon/lua/kres-gen.sh @@ -210,6 +210,8 @@ ${CDEFS} ${LIBKRES} functions <<-EOF kr_cache_remove kr_cache_remove_subtree kr_cache_commit + # FIXME: perhaps rename this exported symbol + packet_ttl EOF diff --git a/modules/http/http_doh.lua b/modules/http/http_doh.lua index 705505721..9c7b71b05 100644 --- a/modules/http/http_doh.lua +++ b/modules/http/http_doh.lua @@ -6,7 +6,6 @@ local function get_http_ttl(pkt) if true then local an_records = pkt:section(kres.section.ANSWER) local is_negative = #an_records <= 0 - -- FIXME: does not work for positive answers return ffi.C.packet_ttl(pkt, is_negative) end @@ -61,7 +60,7 @@ local function serve_doh(h, stream) end -- Resolve query - wire = ffi.cast("void *", input) + local wire = ffi.cast("void *", input) local pkt = ffi.C.knot_pkt_new(wire, #input, nil); if not pkt then output = 'shit happened in knot_pkt_new' -- 2.47.2