fctx:id is uninitialized and effectively unused
On Support #17250 customer contact has another suggestion for us based on his review of the code:
I've just noticed the 'id' field of struct fctx (defined in lib/dns/resolver.c) is not initialized, and the uninitialized value is used only for logging (so effectively unused). This field seems to be introduced in 2018 at commit f2af336d with initialization, but has been effectively removed at some point (I've not figured out exactly when). I suspect it's really unnecessary today and it should have been cleaned up. The attached patch is one trivial way to clean it up (the fact that it compiles should also prove it's unused otherwise).
Pretty minor though, except that a bogus 'id' value could be included in a debug log message.
He suggests the following patch:
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index 1dd82a0300..020399db80 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -400,7 +400,6 @@ struct fetchctx {
unsigned int valfail;
bool timeout;
dns_adbaddrinfo_t *addrinfo;
- dns_messageid_t id;
unsigned int depth;
char clientstr[ISC_SOCKADDR_FORMATSIZE];
};
@@ -3446,8 +3445,8 @@ findname(fetchctx_t *fctx, const dns_name_t *name, in_port_t port,
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3),
- "fctx %p(%s): createfind for %s/%d - %s", fctx,
- fctx->info, fctx->clientstr, fctx->id,
+ "fctx %p(%s): createfind for %s - %s", fctx,
+ fctx->info, fctx->clientstr,
isc_result_totext(result));
if (result != ISC_R_SUCCESS) {