- changed sip_msg (new rcv member containing all the ips, ports, protocol)
[sip-router] / route.c
diff --git a/route.c b/route.c
index 7941b33..04235ae 100644 (file)
--- a/route.c
+++ b/route.c
@@ -145,7 +145,10 @@ static int fix_actions(struct action* a)
        for(t=a; t!=0; t=t->next){
                switch(t->type){
                        case FORWARD_T:
+                       case FORWARD_TCP_T:
+                       case FORWARD_UDP_T:
                        case SEND_T:
+                       case SEND_TCP_T:
                                        switch(t->p1_type){
                                                case IP_ST: 
                                                        tmp=strdup(ip_addr2a(
@@ -262,7 +265,7 @@ error:
 
 
 
-/* eval_elem helping function, returns a op param */
+/* eval_elem helping function, returns an op param */
 static int comp_ip(struct ip_addr* ip, void* param, int op, int subtype)
 {
        struct hostent* he;
@@ -305,7 +308,7 @@ static int comp_ip(struct ip_addr* ip, void* param, int op, int subtype)
                case MYSELF_ST: /* check if it's one of our addresses*/
                        tmp.s=ip_addr2a(ip);
                        tmp.len=strlen(tmp.s);
-                       ret=check_self(&tmp);
+                       ret=check_self(&tmp, 0);
                        break;
                default:
                        LOG(L_CRIT, "BUG: comp_ip: invalid type for "
@@ -338,7 +341,9 @@ static int eval_elem(struct expr* e, struct sip_msg* msg)
                                if(msg->new_uri.s){
                                        if (e->subtype==MYSELF_ST){
                                                if (parse_sip_msg_uri(msg)<0) ret=-1;
-                                               else    ret=check_self(&msg->parsed_uri.host);
+                                               else    ret=check_self(&msg->parsed_uri.host,
+                                                                       msg->parsed_uri.port_no?
+                                                                       msg->parsed_uri.port_no:SIP_PORT);
                                        }else{
                                                ret=comp_str(msg->new_uri.s, e->r.param,
                                                                                e->op, e->subtype);
@@ -346,7 +351,9 @@ static int eval_elem(struct expr* e, struct sip_msg* msg)
                                }else{
                                        if (e->subtype==MYSELF_ST){
                                                if (parse_sip_msg_uri(msg)<0) ret=-1;
-                                               else    ret=check_self(&msg->parsed_uri.host);
+                                               else    ret=check_self(&msg->parsed_uri.host,
+                                                                       msg->parsed_uri.port_no?
+                                                                       msg->parsed_uri.port_no:SIP_PORT);
                                        }else{
                                                ret=comp_str(msg->first_line.u.request.uri.s,
                                                                                 e->r.param, e->op, e->subtype);
@@ -354,10 +361,10 @@ static int eval_elem(struct expr* e, struct sip_msg* msg)
                                }
                                break;
                case SRCIP_O:
-                               ret=comp_ip(&msg->src_ip, e->r.param, e->op, e->subtype);
+                               ret=comp_ip(&msg->rcv.src_ip, e->r.param, e->op, e->subtype);
                                break;
                case DSTIP_O:
-                               ret=comp_ip(&msg->dst_ip, e->r.param, e->op, e->subtype);
+                               ret=comp_ip(&msg->rcv.dst_ip, e->r.param, e->op, e->subtype);
                                break;
                case NUMBER_O:
                                ret=!(!e->r.intval); /* !! to transform it in {0,1} */