HI Daniel.

Please find the diff based on kamailio version 3.3.1

PGA:/mnt/o/kamailio-3.3.1 # diff -u msg_translator.c.orig msg_translator.c
--- msg_translator.c.orig       2012-09-28 09:41:23.391344100 -0300
+++ msg_translator.c    2012-09-28 05:52:36.056491600 -0300
@@ -190,7 +190,7 @@
  *  resolver = DO_DNS | DO_REV_DNS; if 0 no dns check is made
  * return 0 if equal */
 static int check_via_address(struct ip_addr* ip, str *name,
-                               unsigned short port, int resolver)
+                               unsigned short port, short proto, int resolver)
 {
        struct hostent* he;
        int i;
@@ -229,11 +229,11 @@
                return -1;
        }

-       if (port==0) port=SIP_PORT;
+       //if (port==0) port=SIP_PORT;
        if (resolver&DO_DNS){
                DBG("check_via_address: doing dns lookup\n");
                /* try all names ips */
-               he=sip_resolvehost(name, &port, 0); /* don't use naptr */
+               he=sip_resolvehost(name, &port, (char *)&proto); /* don't use naptr */
                if (he && ip->af==he->h_addrtype){
                        for(i=0;he && he->h_addr_list[i];i++){
                                if ( memcmp(&he->h_addr_list[i], ip->u.addr, ip->len)==0)
@@ -263,7 +263,7 @@

        rcvd=msg->via1->received
                        || check_via_address(&msg->rcv.src_ip, &msg->via1->host,
-                                                       msg->via1->port, received_dns);
+                                                       msg->via1->port,msg->via1->proto, received_dns);
        return rcvd;
 }


On Thu, Sep 27, 2012 at 11:22 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Can you provide the patch taken with 'diff -u' or 'git diff' -- it is easier to understand what parts you refer to and were updated.

Cheers,
Daniel


On 9/27/12 12:31 AM, Jijo wrote:
Hello,

I'm observing  that Via Header domain name of type SRV is resolving as DNS A. 

I looked at the code and it does support only A. It is basically setting to default SIP port   check_via_address which is causing DNS A query.

Is there any specific reason to do so?



I changed the code to support SRV as below and working fine.

static int check_via_address(struct ip_addr* ip, str *name,
unsigned short port, short proto, int resolver)
{
:
:
//if (port==0) port=SIP_PORT;
if (resolver&DO_DNS){
DBG("check_via_address: doing dns lookup\n");
/* try all names ips */
he=sip_resolvehost(name, &port, (char *) &proto); /* don't use naptr */
if (he && ip->af==he->h_addrtype){
for(i=0;he && he->h_addr_list[i];i++){
if ( memcmp(&he->h_addr_list[i], ip->u.addr, ip->len)==0)
return 0;
}
}
}
:
:
:
}


/* check if IP address in Via != source IP address of signaling */
int received_test( struct sip_msg *msg )
{
int rcvd;

rcvd=msg->via1->received
|| check_via_address(&msg->rcv.src_ip, &msg->via1->host,
msg->via1->port, msg->via1->proto, received_dns);
return rcvd;
}



Thanks
Jijo



_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - http://asipto.com/u/katu