[sr-dev] Patch: Fix SRV lookups when dns failover is enabled

Daniel-Constantin Mierla miconda at gmail.com
Thu Oct 17 15:56:20 CEST 2013


Thanks for testing further, I started to review this morning, then got 
distracted by other tasks - hope to finish and commit this evening.

Cheers,
Daniel

On 10/17/13 3:48 PM, Øyvind Kolbu wrote:
> On 08.10.2013 03:15, Øyvind Kolbu wrote:
>> Ref the thread from september,
>> <http://lists.sip-router.org/pipermail/sr-users/2013-September/079760.html> 
>>
>>
>> I've fixed SRV lookups to work when use_dns_failover is on and the
>> domain has no _sip._udp record. An example is cisco.com:
>>
>> % host -t SRV _sip._udp.cisco.com
>> Host _sip._udp.cisco.com not found: 3(NXDOMAIN)
>> % host -t SRV _sip._tcp.cisco.com
>> _sip._tcp.cisco.com has SRV record 1 0 5060 vcsgw.cisco.com.
>> % host -t SRV _sips._tcp.cisco.com
>> _sips._tcp.cisco.com has SRV record 1 0 5061 vcsgw.cisco.com.
>>
>> Currently attempting to call an uri at cisco.com will fail, unless
>> manually forcing the protocol.
>>
>> While fixing the the issue I refactored a lot of code and fixed a 
>> plenty of
>> comments as the lookup code has clearly been copy pasted more than once.
>>
>> Patch is attached and should probably be reviewed thoroughly as it 
>> touches
>> pretty core usage.
>
> Testet some more with tls and found a bug in the patch. *proto must be
> updated after choosing a protocol:
>
> --- a/resolve.c
> +++ b/resolve.c
> @@ -1581,6 +1581,7 @@ struct hostent* 
> no_naptr_srv_sip_resolvehost(str* name, unsigned short* port, ch
>                         he=srv_sip_resolvehost(&srv_name, 0, port, 
> proto, 1, 0);
>                         #endif
>                         if (he!=0) {
> +                               *proto = srv_proto_list[i].proto;
>                                 return he;
>                         }
>                 }
>

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Nov 25-28; Miami, Nov 18-20, 2013
   - more details about Kamailio trainings at http://www.asipto.com -




More information about the sr-dev mailing list