From 7256f5af32774584ebcb5c4953d3c72c5aa7cde2 Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Sun, 12 Feb 2023 12:29:21 +0800 Subject: [PATCH] cname: fix cname recursive query issue --- src/Makefile | 11 ++++++++--- src/dns_server.c | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index 76652de..a8ede62 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,12 @@ OBJS=smartdns.o fast_ping.o dns_client.o dns_server.o dns.o util.o tlog.o dns_co # cflags ifndef CFLAGS -CFLAGS =-g -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing -funwind-tables -Wmissing-prototypes -Wshadow -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough + ifdef DEBUG + CFLAGS = -g + else + CFLAGS = -O2 -g + endif +CFLAGS +=-Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing -funwind-tables -Wmissing-prototypes -Wshadow -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough endif override CFLAGS +=-Iinclude override CFLAGS += -DBASE_FILE_NAME='"$(notdir $<)"' @@ -34,9 +39,9 @@ override CXXFLAGS +=-Iinclude # ldflags ifeq ($(STATIC), yes) -override LDFLAGS += -lssl -lcrypto -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -ldl -static + override LDFLAGS += -lssl -lcrypto -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -ldl -static else -override LDFLAGS += -lssl -lcrypto -lpthread -ldl + override LDFLAGS += -lssl -lcrypto -lpthread -ldl endif .PHONY: all clean diff --git a/src/dns_server.c b/src/dns_server.c index ee30694..3ce4b97 100644 --- a/src/dns_server.c +++ b/src/dns_server.c @@ -1588,6 +1588,7 @@ static int _dns_result_child_post(struct dns_server_post_context *context) parent_context.reply_ttl = context->reply_ttl; parent_context.skip_notify_count = context->skip_notify_count; parent_context.select_all_best_ip = 1; + parent_context.no_release_parent = context->no_release_parent; _dns_request_post(&parent_context); ret = _dns_server_reply_all_pending_list(parent_request, &parent_context); @@ -1721,13 +1722,13 @@ static int _dns_server_reply_all_pending_list(struct dns_request *request, struc struct dns_server_post_context context_pending; _dns_server_post_context_init_from(&context_pending, req, context->packet, context->inpacket, context->inpacket_len); - _dns_server_get_answer(&context_pending); req->dualstack_selection = request->dualstack_selection; req->dualstack_selection_query = request->dualstack_selection_query; req->dualstack_selection_force_soa = request->dualstack_selection_force_soa; req->dualstack_selection_has_ip = request->dualstack_selection_has_ip; req->dualstack_selection_ping_time = request->dualstack_selection_ping_time; req->ping_time = request->ping_time; + _dns_server_get_answer(&context_pending); context_pending.do_cache = 0; context_pending.do_audit = context->do_audit; @@ -1735,6 +1736,7 @@ static int _dns_server_reply_all_pending_list(struct dns_request *request, struc context_pending.do_force_soa = context->do_force_soa; context_pending.do_ipset = 0; context_pending.reply_ttl = request->ip_ttl; + context_pending.no_release_parent = context->no_release_parent; _dns_server_reply_passthrough(&context_pending); req->request_pending_list = NULL;