#602 DNS Cache and SRV Records issue

1.8.x
closed-invalid
modules (454)
3
2015-04-06
2013-01-04
Pierre-Yves
No

DNS Cache module does not seems to handle properly DNS SRV records.

Example:
Opensips "dns cache" perform a lookup on mydomain.com.
The DNS answers : SRV gw1.mydomain.com and gw2.mydomain.com
Then Opensips perform an "A" query to "gw1.mydomain.com"
The DNS answers 1.2.3.4 for gw1.mydomain.com.
Finaly opensips forward the SIP request to 1.2.3.4

After that, on a new SIP request, Opensips continue to forward request directly to 1.2.3.4 (gw1.mydomain.com) and never trie to use gw2.mydomain.com

In my point of view, there is an issue in the DNS Cache module. Opensips should try randomly both mydomain.com SRV records gw1.mydomain.com and gw2.mydomain.com

Discussion

    • assigned_to: nobody --> vladut-paiu
     
  • Hello,

    Indeed this is an issue. The DNS cache module stores both the records, but it will only use the first one and will not try to randomly choose between them. Thus, the request will go to the second SRV record only in case of fail-over.

    I will take a look and see how this behavior can be fixed.

    Regards,
    Vlad

     
  • Hello,

    On further testing and code inspection, this seems to be working fine.
    The DNS core fetches the cached results and then calls the function that orders the DNS entries based on priority.

    Tested with a domain name with two equal priority SRV records, and ran multiple calls which reached both IP addresses.

    Regards,
    Vlad

     
    • priority: 5 --> 3
    • status: open --> open-works-for-me
     
    • status: open-works-for-me --> closed-invalid