<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I'll check this one as well. Is this patch in addition to the
    previous one or combined?<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 9/30/13 10:16 AM, Øyvind Kolbu
      wrote:<br>
    </div>
    <blockquote cite="mid:20130930081632.GA82929@putsch.kolbu.ws"
      type="cite">
      <pre wrap="">On 2013-09-30 at 09:36, Daniel-Constantin Mierla wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Hello,

thanks for digging further, I will check it and commit if all looks good.
</pre>
      </blockquote>
      <pre wrap="">
Found an unrelated bug while testing more. If using dns_cache and
use_dns_failover=off, it will not resolve A/AAAA-only hosts.

Note that srv-lookups is still broken in the use_dns_failover=on case, as
it only attempts one srv lookup, usually udp.

>From the logs of a stock Kamailio lastest 4.0:
DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(sip-services.uninett.no(23), 35), h=412
DEBUG: <core> [resolve.c:757]: get_record(): get_record: lookup(sip-services.uninett.no, 35) failed
DEBUG: <core> [dns_cache.c:897]: dns_cache_mk_bad_entry(): dns_cache_mk_bad_entry(sip-services.uninett.no, 35, 60, 1)
DEBUG: <core> [dns_cache.c:830]: dns_cache_add(): dns_cache_add: adding sip-services.uninett.no(23) 35 (flags=1) at 412
DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(_sip._udp.sip-services.uninett.no(33), 33), h=64
DEBUG: <core> [resolve.c:757]: get_record(): get_record: lookup(_sip._udp.sip-services.uninett.no, 33) failed
DEBUG: <core> [dns_cache.c:897]: dns_cache_mk_bad_entry(): dns_cache_mk_bad_entry(_sip._udp.sip-services.uninett.no, 33, 60, 1)
DEBUG: <core> [dns_cache.c:830]: dns_cache_add(): dns_cache_add: adding _sip._udp.sip-services.uninett.no(33) 33 (flags=1) at 64
ERROR: <core> [resolve.c:1728]: sip_hostport2su(): ERROR: sip_hostport2su: could not resolve hostname: "sip-services.uninett.no"
ERROR: tm [ut.h:337]: uri2dst2(): failed to resolve "sip-services.uninett.no"
ERROR: tm [t_fwd.c:1534]: t_forward_nonack(): ERROR: t_forward_nonack: failure to add branches
DEBUG: tm [t_funcs.c:357]: t_relay_to(): ERROR:tm:t_relay_to:  t_forward_nonack returned error
DEBUG: tm [t_funcs.c:374]: t_relay_to(): -478 error reply generation delayed

And corresponding tcpdump:
27971+ NAPTR? sip-services.uninett.no. (41)
27971 0/1/0 (93)
57279+ SRV? _sip._udp.sip-services.uninett.no. (51)
57279 NXDomain 0/1/0 (103)

With the attached patch, it works. See logs:

DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(sip-services.uninett.no(23), 35), h=412
DEBUG: <core> [resolve.c:757]: get_record(): get_record: lookup(sip-services.uninett.no, 35) failed
DEBUG: <core> [dns_cache.c:897]: dns_cache_mk_bad_entry(): dns_cache_mk_bad_entry(sip-services.uninett.no, 35, 60, 1)
DEBUG: <core> [dns_cache.c:830]: dns_cache_add(): dns_cache_add: adding sip-services.uninett.no(23) 35 (flags=1) at 412
DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(_sip._udp.sip-services.uninett.no(33), 33), h=64
DEBUG: <core> [resolve.c:757]: get_record(): get_record: lookup(_sip._udp.sip-services.uninett.no, 33) failed
DEBUG: <core> [dns_cache.c:897]: dns_cache_mk_bad_entry(): dns_cache_mk_bad_entry(_sip._udp.sip-services.uninett.no, 33, 60, 1)
DEBUG: <core> [dns_cache.c:830]: dns_cache_add(): dns_cache_add: adding _sip._udp.sip-services.uninett.no(33) 33 (flags=1) at 64
DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(_sip._tcp.sip-services.uninett.no(33), 33), h=871
DEBUG: <core> [resolve.c:757]: get_record(): get_record: lookup(_sip._tcp.sip-services.uninett.no, 33) failed
DEBUG: <core> [dns_cache.c:897]: dns_cache_mk_bad_entry(): dns_cache_mk_bad_entry(_sip._tcp.sip-services.uninett.no, 33, 60, 1)
DEBUG: <core> [dns_cache.c:830]: dns_cache_add(): dns_cache_add: adding _sip._tcp.sip-services.uninett.no(33) 33 (flags=1) at 871
DEBUG: <core> [dns_cache.c:569]: _dns_hash_find(): dns_hash_find(sip-services.uninett.no(23), 1), h=412
DEBUG: <core> [resolve.c:954]: get_record(): get_record: skipping 5 NS (p=0x82a6a59, end=0x82a6b86)
DEBUG: <core> [resolve.c:970]: get_record(): get_record: parsing 9 ARs (p=0x82a6ac6, end=0x82a6b86)
DEBUG: <core> [dns_cache.c:1779]: dns_get_related(): dns_get_related(0xb5d8a5f8 (sip-services.uninett.no, 1), 1, *0xb7c24e98) (0)
DEBUG: <core> [dns_cache.c:872]: dns_cache_add_unsafe(): dns_cache_add: adding sip-services.uninett.no(23) 1 (flags=0) at 412

and new tcpdump:
61793+ NAPTR? sip-services.uninett.no. (41)
61793 0/1/0 (93)
46996+ SRV? _sip._udp.sip-services.uninett.no. (51)
46996 NXDomain 0/1/0 (103)
1104+ SRV? _sip._tcp.sip-services.uninett.no. (51)
1104 NXDomain 0/1/0 (103)
22158+ A? sip-services.uninett.no. (41)
22158 1/5/9 A sip-services.uninett.no (358)

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Trainings - Berlin, Nov 25-28; Miami, Nov 18-20, 2013
  - more details about Kamailio trainings at <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a> -
</pre>
  </body>
</html>