]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: set rcode before finishing overlay
authorMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 21 May 2015 17:51:12 +0000 (19:51 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 25 May 2015 11:49:17 +0000 (13:49 +0200)
this fixes a bug where resolution failed, but the finish callbacks thought the answer is noerror

lib/resolve.c

index 7de4f3c2a133c25284ad90c353cf13074fd7a624..29237e5e7d6544dfd4a573cda6801ff9016f32d4 100644 (file)
@@ -443,13 +443,13 @@ int kr_resolve_finish(struct kr_request *request, int state)
                state = KNOT_STATE_FAIL;
        }
        /* Error during procesing, internal failure */
-       knot_overlay_finish(&request->overlay);
        if (state != KNOT_STATE_DONE) {
                knot_pkt_t *answer = request->answer;
                if (knot_wire_get_rcode(answer->wire) == KNOT_RCODE_NOERROR) {
                        knot_wire_set_rcode(answer->wire, KNOT_RCODE_SERVFAIL);
                }
        }
+       knot_overlay_finish(&request->overlay);
        /* Clean up. */
        knot_overlay_deinit(&request->overlay);
        request->overlay.state = KNOT_STATE_NOOP;