From 8a5cd8c249bd2179a5646fe4c7ad6ef7fb6c9b09 Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 2 May 2019 16:11:32 +0100 Subject: [PATCH] Fix default source Set the default source for a vl server list extracted from the configuration to kafs_record_from_config. Signed-off-by: David Howells --- src/lib_dns_lookup.c | 10 +++++----- src/lib_object.c | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib_dns_lookup.c b/src/lib_dns_lookup.c index d1b7852..01449a2 100644 --- a/src/lib_dns_lookup.c +++ b/src/lib_dns_lookup.c @@ -315,9 +315,6 @@ static int dns_query_AFSDB(struct kafs_server_list *vsl, u_char buf[NS_PACKETSZ]; } response; /* response buffers */ - vsl->source = kafs_record_from_dns_afsdb; - vsl->status = kafs_lookup_good; - verbose("Get AFSDB RR for cell name:'%s'", cell_name); /* query the dns for an AFSDB resource record */ @@ -346,6 +343,8 @@ static int dns_query_AFSDB(struct kafs_server_list *vsl, return 0; } + vsl->source = kafs_record_from_dns_afsdb; + if (ns_initparse(response.buf, response_len, &handle) < 0) { ctx->report.error("%s: ns_initparse: %s", cell_name, hstrerror(h_errno)); @@ -354,6 +353,7 @@ static int dns_query_AFSDB(struct kafs_server_list *vsl, } /* look up the hostnames we've obtained to get the actual addresses */ + vsl->status = kafs_lookup_good; return kafs_parse_afsdb(vsl, cell_name, subtype, handle, ns_s_an, ctx); } @@ -478,8 +478,6 @@ static int dns_query_SRV(struct kafs_server_list *vsl, enum dns_payload_protocol_type protocol; char name[1024]; - vsl->source = kafs_record_from_dns_srv; - snprintf(name, sizeof(name), "_%s._%s.%s", service_name, proto_name, domain_name); @@ -510,6 +508,8 @@ static int dns_query_SRV(struct kafs_server_list *vsl, return 0; } + vsl->source = kafs_record_from_dns_srv; + if (ns_initparse(response.buf, response_len, &handle) < 0) { ctx->report.error("%s: ns_initparse: %s", domain_name, hstrerror(h_errno)); diff --git a/src/lib_object.c b/src/lib_object.c index 3fad06a..63fa829 100644 --- a/src/lib_object.c +++ b/src/lib_object.c @@ -113,6 +113,8 @@ int kafs_transfer_server_list(struct kafs_server_list *to, { unsigned int i, nr = from->nr_servers; + to->source = from->source; + to->status = from->status; to->nr_servers = nr; to->max_servers = from->max_servers; to->ttl = from->ttl; -- 2.50.1