]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: dns: make SRV record processing more verbose
authorBaptiste Assmann <bassmann@haproxy.com>
Fri, 18 Aug 2017 21:36:07 +0000 (23:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 09:40:00 +0000 (11:40 +0200)
For troubleshooting purpose, it may be important to know when a server
got its fqdn updated by a SRV record.
This patch makes HAProxy to report such events through stderr and logs.

src/dns.c

index 52e02026ffcd3b998748a22a65f52e379e75d8a7..bc463ee6304de21c9a1399b66a7d78c04a38f486 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -615,13 +615,16 @@ void dns_resolve_recv(struct dgram_conn *dgram)
                                                }
                                                if (srv) {
                                                        char weight[9];
-
+                                                       const char *msg = NULL;
                                                        char hostname[DNS_MAX_NAME_SIZE];
 
                                                        if (item1->data_len > DNS_MAX_NAME_SIZE)
                                                                continue;
                                                        dns_dn_label_to_str(item1->target, hostname, item1->data_len);
-                                                       update_server_fqdn(srv, hostname, "SRV record");
+                                                       msg = update_server_fqdn(srv, hostname, "SRV record");
+                                                       if (msg)
+                                                               send_log(srv->proxy, LOG_NOTICE, "%s", msg);
+
                                                        srv->svc_port = item1->port;
                                                        srv->flags &= ~SRV_F_MAPPORTS;
                                                        if ((srv->check.state & CHK_ST_CONFIGURED) && !(srv->flags & SRV_F_CHECKPORT))