diff --git a/dns_cache.c b/dns_cache.c index 1243c92..3ee8e59 100644 --- a/dns_cache.c +++ b/dns_cache.c @@ -2857,8 +2857,10 @@ struct hostent* dns_naptr_sip_resolvehost(str* name, unsigned short* port, naptr_bmp_t tried_bmp; struct dns_hash_entry* e; char n_proto; + char origproto; str srv_name; + origproto=*proto; he=0; if (dns_hash==0){ /* not init => use normal, non-cached version */ LOG(L_WARN, "WARNING: dns_sip_resolvehost: called before dns cache" @@ -2903,7 +2905,13 @@ struct hostent* dns_naptr_sip_resolvehost(str* name, unsigned short* port, dns_hash_put(e); } naptr_not_found: - return no_naptr_srv_sip_resolvehost(name,port,proto); + *proto = origproto; + he = no_naptr_srv_sip_resolvehost(name,port,proto); + /* fallback all the way down to A/AAAA */ + if (he==0) { + he=dns_get_he(name,dns_flags); + } + return he; } #endif /* USE_NAPTR */ diff --git a/resolve.c b/resolve.c index e739f4b..1d5d66c 100644 --- a/resolve.c +++ b/resolve.c @@ -1519,21 +1519,8 @@ struct hostent* no_naptr_srv_sip_resolvehost(str* name, unsigned short* port, ch } if (default_order){ for (i=0; ilen >= MAX_DNS_NAME) { @@ -1673,7 +1663,12 @@ struct hostent* naptr_sip_resolvehost(str* name, unsigned short* port, #endif } /* fallback to srv lookup */ + *proto = origproto; he=no_naptr_srv_sip_resolvehost(name,port,proto); + /* fallback all the way down to A/AAAA */ + if (he==0) { + he=dns_get_he(name,dns_flags); + } end: if (naptr_head) free_rdata_list(naptr_head);