From: Vladimír Čunát Date: Mon, 30 Jan 2017 14:58:00 +0000 (+0100) Subject: NO_0X20: add a new query flag X-Git-Tag: v1.3.0~23^2~75^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6c47db2ca5e65830b72acd21ddc541d538ded7d;p=thirdparty%2Fknot-resolver.git NO_0X20: add a new query flag --- diff --git a/daemon/lua/kres-gen.lua b/daemon/lua/kres-gen.lua index 8b3205bfd..f69a33760 100644 --- a/daemon/lua/kres-gen.lua +++ b/daemon/lua/kres-gen.lua @@ -152,7 +152,7 @@ struct kr_context { struct kr_zonecut root_hints; char _stub[]; }; -struct query_flag {static const int NO_MINIMIZE = 1; static const int NO_THROTTLE = 2; static const int NO_IPV6 = 4; static const int NO_IPV4 = 8; static const int TCP = 16; static const int RESOLVED = 32; static const int AWAIT_IPV4 = 64; static const int AWAIT_IPV6 = 128; static const int AWAIT_CUT = 256; static const int SAFEMODE = 512; static const int CACHED = 1024; static const int NO_CACHE = 2048; static const int EXPIRING = 4096; static const int ALLOW_LOCAL = 8192; static const int DNSSEC_WANT = 16384; static const int DNSSEC_BOGUS = 32768; static const int DNSSEC_INSECURE = 65536; static const int STUB = 131072; static const int ALWAYS_CUT = 262144; static const int DNSSEC_WEXPAND = 524288; static const int PERMISSIVE = 1048576; static const int STRICT = 2097152; static const int BADCOOKIE_AGAIN = 4194304; static const int CNAME = 8388608; static const int REORDER_RR = 16777216; static const int TRACE = 33554432;}; +struct query_flag {static const int NO_MINIMIZE = 1; static const int NO_THROTTLE = 2; static const int NO_IPV6 = 4; static const int NO_IPV4 = 8; static const int TCP = 16; static const int RESOLVED = 32; static const int AWAIT_IPV4 = 64; static const int AWAIT_IPV6 = 128; static const int AWAIT_CUT = 256; static const int SAFEMODE = 512; static const int CACHED = 1024; static const int NO_CACHE = 2048; static const int EXPIRING = 4096; static const int ALLOW_LOCAL = 8192; static const int DNSSEC_WANT = 16384; static const int DNSSEC_BOGUS = 32768; static const int DNSSEC_INSECURE = 65536; static const int STUB = 131072; static const int ALWAYS_CUT = 262144; static const int DNSSEC_WEXPAND = 524288; static const int PERMISSIVE = 1048576; static const int STRICT = 2097152; static const int BADCOOKIE_AGAIN = 4194304; static const int CNAME = 8388608; static const int REORDER_RR = 16777216; static const int TRACE = 33554432; static const int NO_0X20 = 67108864;}; int knot_dname_size(const knot_dname_t *); knot_dname_t *knot_dname_from_str(uint8_t *, const char *, size_t); char *knot_dname_to_str(char *, const knot_dname_t *, size_t); diff --git a/lib/resolve.c b/lib/resolve.c index 5666758c7..72c5b7aab 100644 --- a/lib/resolve.c +++ b/lib/resolve.c @@ -1058,8 +1058,9 @@ ns_election: return KR_STATE_PRODUCE; } - /* Randomize query case (if not in safemode) */ - qry->secret = (qry->flags & QUERY_SAFEMODE) ? 0 : kr_rand_uint(UINT32_MAX); + /* Randomize query case (if not in safemode or turned off) */ + qry->secret = (qry->flags & (QUERY_SAFEMODE | QUERY_NO_0X20)) + ? 0 : kr_rand_uint(UINT32_MAX); knot_dname_t *qname_raw = (knot_dname_t *)knot_pkt_qname(packet); randomized_qname_case(qname_raw, qry->secret); diff --git a/lib/rplan.h b/lib/rplan.h index d3bf90012..92f94d09e 100644 --- a/lib/rplan.h +++ b/lib/rplan.h @@ -34,7 +34,7 @@ X(AWAIT_IPV4, 1 << 6) /**< Query is waiting for A address. */ \ X(AWAIT_IPV6, 1 << 7) /**< Query is waiting for AAAA address. */ \ X(AWAIT_CUT, 1 << 8) /**< Query is waiting for zone cut lookup */ \ - X(SAFEMODE, 1 << 9) /**< Don't use fancy stuff (EDNS...) */ \ + X(SAFEMODE, 1 << 9) /**< Don't use fancy stuff (EDNS, 0x20, ...) */ \ X(CACHED, 1 << 10) /**< Query response is cached. */ \ X(NO_CACHE, 1 << 11) /**< No cache for lookup; exception: finding NSs and subqueries. */ \ X(EXPIRING, 1 << 12) /**< Query response is cached, but expiring. */ \ @@ -51,7 +51,8 @@ X(BADCOOKIE_AGAIN, 1 << 22) /**< Query again because bad cookie returned. */ \ X(CNAME, 1 << 23) /**< Query response contains CNAME in answer section. */ \ X(REORDER_RR, 1 << 24) /**< Reorder cached RRs. */ \ - X(TRACE, 1 << 25) /**< Log answer with kr_verbose_log(), unless -DNDEBUG. */ + X(TRACE, 1 << 25) /**< Log answer with kr_verbose_log(), unless -DNDEBUG. */ \ + X(NO_0X20, 1 << 26) /**< Disable query case randomization . */ \ /* 1 << 31 Used by ../modules/dns64/dns64.lua */ /** Query flags */