### Description To avoid extra DNS requests I want to use absolute DNS names instead of relative. To do this I configured ``` modparam("siptrace", "duplicate_uri", "sip:sip-trace6.example.com.:9060" ``` And now I can see errors ``` CRITICAL: <core> [core/proxy.c:264]: mk_proxy(): could not resolve hostname: "sip-trace6.example.com." ERROR: siptrace [siptrace_hep.c:178]: trace_send_hep3_duplicate(): bad host name in uri CRITICAL: <core> [core/proxy.c:264]: mk_proxy(): could not resolve hostname: "sip-trace6.example.com." ERROR: siptrace [siptrace_hep.c:178]: trace_send_hep3_duplicate(): bad host name in uri CRITICAL: <core> [core/proxy.c:264]: mk_proxy(): could not resolve hostname: "sip-trace6.example.com." ERROR: siptrace [siptrace_hep.c:178]: trace_send_hep3_duplicate(): bad host name in uri ``` I am expecting "sip-trace6.example.com." DNS name resolution without errors in Kamailio log.
used current master.
To test absolute DNS name us can use `curl` ``` [root@safarov-server ~]# curl -v telnet://ipv6.test-ipv6.com.:80 * Rebuilt URL to: telnet://ipv6.test-ipv6.com.:80/ * Trying 2001:470:1:18::115... * TCP_NODELAY set * Connected to ipv6.test-ipv6.com (2001:470:1:18::115) port 80 (#0) ```
What are the extra DNS requests that can happen and you want to avoid them?
In one config I use ``` dns_cache_flags = 4 dns_cache_init = off ```
Looks as when Kamailio try to resolve DNS hostname sended two DNS requests: 1. A for IPv4 address resolving; 2. AAAA for IPv6 address resolving.
When DNS hostname has only AAAA record and do not has A record, then 1. AAAA request will be successful; 2. A request will return `NXDomain`.
Looks as when Kamailio received `NXDomain`, then takes the server hostname domain and adds this part to searched DNS name and repeated request. Example: 1. I need to send a packet to `ipv6.test-ipv6.com` that has only AAAA dns record. 2. Kamailio hostname `proxy.example.com`; 3. Kamailio send `ipv6.test-ipv6.com` AAAA request, successful; 4. Kamailio send `ipv6.test-ipv6.com` A request, `NXDomain`; 3. Kamailio send `ipv6.test-ipv6.com.example.com` AAAA request, `NXDomain`; 4. Kamailio send `ipv6.test-ipv6.com.example.com` A request, `NXDomain`.
Using absolute DNS name, I want Kamailio to not modify DNS name and not send extra requests.
Tested on master.
Kamailio is using the libc dns resolver, it is not appending the local hostname by itself (afaik), that is done by the library. See the manual for resolv.conf, probably there should be options to configure this behaviour.
yes, you are right. This name modification made by linux core libs.
I have checked the `resolve.conf` settings and this managed by `domain` directive in `/etc/resolv.conf`. *example* ``` domain . ``` I now fixed extra DNS request generation.
But the original request still actual. Should Kamailio resolve absolute DNS names and do not generate error messages like `bad host name in uri`?
As I said, kamailio uses libc functions for resolving, you can dig in the code and see if anything is missing, Kamailio shouldn't do anything special here, if the libc function supports that kind of domain, it should work. But maybe other checks are done till the dns resolve function ... absolute domain format is not something that I saw in sip messages. Pull requests are welcome of course.
Closed #2706.
I am closing this one, because it is not a standard/common requirement to deal with such domains. Obviously, if someone wants to add the option to cope with such format, just make a pull request.