From: Grigorii Demidov Date: Tue, 28 Feb 2017 12:30:25 +0000 (+0100) Subject: lib/resolve: forward +cd in stub mode; minor bugfix in debug output X-Git-Tag: v1.3.0~23^2~68^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=218f1b78b31ac4742f27a48027748e3989951bee;p=thirdparty%2Fknot-resolver.git lib/resolve: forward +cd in stub mode; minor bugfix in debug output --- diff --git a/lib/resolve.c b/lib/resolve.c index cfa8ed7ef..fe55019c5 100644 --- a/lib/resolve.c +++ b/lib/resolve.c @@ -560,8 +560,12 @@ static int query_finalize(struct kr_request *request, struct kr_query *qry, knot /* Stub resolution (ask for +rd and +do) */ if (qry->flags & QUERY_STUB) { knot_wire_set_rd(pkt->wire); - if (knot_pkt_has_dnssec(request->answer)) + if (knot_pkt_has_dnssec(request->answer)) { knot_edns_set_do(pkt->opt_rr); + } + if (knot_wire_get_cd(request->answer->wire)) { + knot_wire_set_cd(pkt->wire); + } /* Full resolution (ask for +cd and +do) */ } else if (qry->flags & QUERY_DNSSEC_WANT) { knot_edns_set_do(pkt->opt_rr); diff --git a/lib/utils.c b/lib/utils.c index a60b62438..6795a79b3 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -582,8 +582,8 @@ static void flags_to_str(char *dst, const knot_pkt_t *pkt, size_t maxlen) {knot_wire_get_rd, "rd"}, {knot_wire_get_ra, "ra"}, {knot_wire_get_tc, "tc"}, - {knot_wire_get_cd, "cd"}, - {knot_wire_get_ad, "ad"} + {knot_wire_get_ad, "ad"}, + {knot_wire_get_cd, "cd"} }; for (int i = 0; i < 7; ++i) { if (!flag[i].get(pkt->wire)) { @@ -595,7 +595,7 @@ static void flags_to_str(char *dst, const knot_pkt_t *pkt, size_t maxlen) return; } offset += ret; - maxlen -= offset; + maxlen -= ret; } dst[offset] = 0; }