Module: kamailio
Branch: 5.8
Commit: 7b7f3ee0d32682d5a75e33d2009823b337bdde25
URL: 
https://github.com/kamailio/kamailio/commit/7b7f3ee0d32682d5a75e33d2009823b337bdde25

Author: Matteo Brancaleoni <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2026-01-05T12:00:15Z

dmq: Fix DNS resolution corruption when search list is used

When `dns_use_search_list=1` (the default), `get_record()` may prepend a "fake 
CNAME" record to map short hostnames to their expanded form.

(cherry picked from commit 787bbe5c91e9fc02f741fdd26b06ccad87b4c19e)
(cherry picked from commit 28686b3561e5612f0b3e4ae86f7573747a06559d)

---

Modified: src/modules/dmq/notification_peer.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/7b7f3ee0d32682d5a75e33d2009823b337bdde25.diff
Patch: 
https://github.com/kamailio/kamailio/commit/7b7f3ee0d32682d5a75e33d2009823b337bdde25.patch

---

diff --git a/src/modules/dmq/notification_peer.c 
b/src/modules/dmq/notification_peer.c
index 5e9452a51f3..607e426df3b 100644
--- a/src/modules/dmq/notification_peer.c
+++ b/src/modules/dmq/notification_peer.c
@@ -225,6 +225,7 @@ int get_dmq_host_list(
        for(prec = phead; prec; prec = prec->next) {
                /**********
                * o check max
+               * o skip non-A records (e.g., CNAME)
                * o create URI
                **********/
 
@@ -233,6 +234,11 @@ int get_dmq_host_list(
                        free_rdata_list(phead);
                        return host_cnt;
                }
+               /* Skip non-A records - get_record may return CNAME records
+                * when DNS search list expansion is used */
+               if(prec->type != T_A) {
+                       continue;
+               }
                len = ip4tosbuf(
                                ((struct a_rdata *)prec->rdata)->ip, pIP, 
IP4_MAX_STR_SIZE);
                pIP[len] = '\0';

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to