Skip to content

[BUG] CName resolution breaks when using dns_cache #3709

@hafkensite

Description

@hafkensite

OpenSIPS version you are running

version: opensips 3.4.9 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 913dc92
main.c compiled on  with gcc 12

Describe the bug
DNS resolving used to work fine, once we enabled the dns_cache module we received complaints from customers. Error logs show:

Aug 20 15:56:27 [665831] CRITICAL:core:mk_proxy: could not resolve hostname: "cnametest.example.com" (0 results)

To Reproduce

  1. Add dns_cache to configuration:
loadmodule "cachedb_local.so"
loadmodule "dns_cache.so"
modparam("dns_cache", "cachedb_url","local://") #use internal cachedb_local module
modparam("dns_cache", "blacklist_timeout",120) # 2 minutes
  1. Setup CNAME dns record to SIP destination.
  2. Verify DNS correct with dig to see CNAME and A records.
  3. Perform INVITE with the CNAME in the URI (or other SIP request that triggers the dns lookup).

Expected behavior
DNS lookup resolves the CNAME and routes the message correctly.

Relevant System Logs

Aug 20 15:59:54 [665831] CRITICAL:core:mk_proxy: could not resolve hostname: "cnametest.example.com" (0 results)
Aug 20 15:59:54 [665831] ERROR:tm:uri2proxy: bad host name in URI <sip:[email protected];transport=udp>
Aug 20 15:59:54 [665831] ERROR:tm:t_forward_nonack: failure to add branches

OS/environment information

  • Operating System: Debian 12
  • OpenSIPS installation: Self build DEBs
  • other relevant information: -

Additional context
own_gethostbyname2 clearly lacks the implementation for anything other than A and AAAA, but if the CNAME resolution is to complex to integrate into OpenSIPS itself, then at least document this missing feature.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions