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

Øyvind Kolbu oyvind.kolbu at usit.uio.no
Thu Oct 17 15:48:35 CEST 2013


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;
                         }
                 }

-- 
Øyvind



More information about the sr-dev mailing list