BUG/MINOR: dns: add missing sent counter and parent id to dns counters.

Resolv callbacks are also updated to rely on counters and not on
nameservers.
"show stat domain dns" will now show the parent id (i.e. resolvers
section name).
diff --git a/src/action.c b/src/action.c
index 5f4d7c1..a7e5a49 100644
--- a/src/action.c
+++ b/src/action.c
@@ -117,7 +117,7 @@
 	return 1;
 }
 
-int act_resolution_cb(struct dns_requester *requester, struct dns_nameserver *nameserver)
+int act_resolution_cb(struct dns_requester *requester, struct dns_counters *counters)
 {
 	struct stream *stream;
 
diff --git a/src/dns.c b/src/dns.c
index 69045ce..d589f9e 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -59,6 +59,8 @@
 
 enum {
 	DNS_STAT_ID,
+	DNS_STAT_PID,
+	DNS_STAT_SENT,
 	DNS_STAT_SND_ERROR,
 	DNS_STAT_VALID,
 	DNS_STAT_UPDATE,
@@ -78,6 +80,8 @@
 
 static struct name_desc dns_stats[] = {
 	[DNS_STAT_ID]          = { .name = "id",          .desc = "ID" },
+	[DNS_STAT_PID]         = { .name = "pid",         .desc = "Parent ID" },
+	[DNS_STAT_SENT]        = { .name = "sent",        .desc = "Sent" },
 	[DNS_STAT_SND_ERROR]   = { .name = "send_error",  .desc = "Send error" },
 	[DNS_STAT_VALID]       = { .name = "valid",       .desc = "Valid" },
 	[DNS_STAT_UPDATE]      = { .name = "update",      .desc = "Update" },
@@ -100,6 +104,8 @@
 {
 	struct dns_counters *counters = d;
 	stats[DNS_STAT_ID]          = mkf_str(FO_CONFIG, counters->id);
+	stats[DNS_STAT_PID]         = mkf_str(FO_CONFIG, counters->pid);
+	stats[DNS_STAT_SENT]        = mkf_u64(FN_GAUGE, counters->sent);
 	stats[DNS_STAT_SND_ERROR]   = mkf_u64(FN_GAUGE, counters->snd_error);
 	stats[DNS_STAT_VALID]       = mkf_u64(FN_GAUGE, counters->valid);
 	stats[DNS_STAT_UPDATE]      = mkf_u64(FN_GAUGE, counters->update);
@@ -1865,7 +1871,8 @@
  */
 static void dns_resolve_recv(struct dgram_conn *dgram)
 {
-	struct dns_nameserver *ns, *tmpns;
+	struct dns_nameserver *ns;
+	struct dns_counters   *tmpcounters;
 	struct dns_resolvers  *resolvers;
 	struct dns_resolution *res;
 	struct dns_query_item *query;
@@ -2039,16 +2046,16 @@
 	report_res_success:
 		/* Only the 1rst requester s managed by the server, others are
 		 * from the cache */
-		tmpns = ns;
+		tmpcounters = ns->counters;
 		list_for_each_entry(req, &res->requesters, list) {
 			struct server *s = objt_server(req->owner);
 
 			if (s)
 				HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
-			req->requester_cb(req, tmpns);
+			req->requester_cb(req, tmpcounters);
 			if (s)
 				HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
-			tmpns = NULL;
+			tmpcounters = NULL;
 		}
 
 		dns_reset_resolution(res);
@@ -2311,6 +2318,7 @@
 			if (ns->extra_counters) {
 				ns->counters = EXTRA_COUNTERS_GET(ns->extra_counters, &dns_stats_module);
 				ns->counters->id = ns->id;
+				ns->counters->pid = ns->resolvers->id;
 			}
 		}
 
@@ -2500,6 +2508,7 @@
 				if (strcmp(mod->name, "dns") == 0) {
 					ns->counters = (struct dns_counters *)ns->extra_counters->data + mod->counters_off[COUNTERS_DNS];
 					ns->counters->id = ns->id;
+					ns->counters->pid = ns->resolvers->id;
 				}
 			}
 		}
diff --git a/src/server.c b/src/server.c
index cafa7fd..5e63266 100644
--- a/src/server.c
+++ b/src/server.c
@@ -3974,7 +3974,7 @@
  *
  * Must be called with server lock held
  */
-int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *nameserver)
+int snr_resolution_cb(struct dns_requester *requester, struct dns_counters *counters)
 {
 	struct server *s = NULL;
 	struct dns_resolution *resolution = NULL;
@@ -4043,10 +4043,10 @@
 	}
 
  save_ip:
-	if (nameserver) {
-		nameserver->counters->update++;
+	if (counters) {
+		counters->update++;
 		/* save the first ip we found */
-		chunk_printf(chk, "%s/%s", nameserver->resolvers->id, nameserver->id);
+		chunk_printf(chk, "%s/%s", counters->pid, counters->id);
 	}
 	else
 		chunk_printf(chk, "DNS cache");
@@ -4057,8 +4057,8 @@
 	return 1;
 
  invalid:
-	if (nameserver) {
-		nameserver->counters->invalid++;
+	if (counters) {
+		counters->invalid++;
 		goto update_status;
 	}
 	snr_update_srv_status(s, has_no_ip);