[sr-dev] dns failover and send socket

Jasmin Schnatterbeck js at data-cmr.net
Wed Jan 2 13:39:20 CET 2013


Hello,

when using dns failover (SRV records) with kamailio 3.2 I noticed, that 
the failover sip message (to the failover host specified by DNS) is sent 
from a different socket.

For example:
incoming sip message is on socket ip1:5060
=> send socket for relayed message (original) is ip1:5060
but send socket for relayed message (failover) is ip2:5060

reparse_on_dns_failover is left on its default value (1).

In the the relayed message (failover):
Reord-Route-Header is as in original message (ip1:5060) - correct
Via-Header is ip2:5060 (matching the send socket) - incorrect

This is exactly the opposite case regarding the README:

"Disadvantage: only the via header is replaced in the message buffer, so
the outgoing socket address is not corrected in any other part of the 
message. It is dangerous on multihomed hosts: when the new SIP request 
after the DNS failover is sent via different interface than the first
  request, the message can contain incorrect ip address in the 
Record-Route header for instance."

I think the message was rebuilt, because only VIA header and send socket 
changed.

Looking into forward.c:

  598 #ifdef USE_DNS_FAILOVER
  599                 if (prev_send_sock!=send_info->send_sock){
  600                         /* rebuild the message only if the 
send_sock changed */

But I did not change the send socket... any ideas why this condition is 
true?

Cheers and a happy new 2013
Jasmin






More information about the sr-dev mailing list