[sr-dev] git:master: core: use port 5061 for checking self when uri has transport tls

Daniel-Constantin Mierla miconda at gmail.com
Thu May 15 12:49:56 CEST 2014


Module: sip-router
Branch: master
Commit: 2e55d7bd218c9f954da7d289ec1be090bb4d88b0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2e55d7bd218c9f954da7d289ec1be090bb4d88b0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu May 15 12:48:04 2014 +0200

core: use port 5061 for checking self when uri has transport tls

- 5060 was used, failing to match myself condition

---

 forward.h |    2 ++
 route.c   |   12 ++++--------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/forward.h b/forward.h
index 4680a8e..f377546 100644
--- a/forward.h
+++ b/forward.h
@@ -84,6 +84,8 @@ inline static struct socket_info* get_send_socket(struct sip_msg* msg,
 }
 
 
+#define GET_URI_PORT(uri) ((uri)->port_no?(uri)->port_no:(((uri)->proto==PROTO_TLS)?SIPS_PORT:SIP_PORT))
+
 struct socket_info* get_out_socket(union sockaddr_union* to, int proto);
 typedef int (*check_self_f)(str* host, unsigned short port,
 		unsigned short proto);
diff --git a/route.c b/route.c
index 1c5897c..2a3e1b9 100644
--- a/route.c
+++ b/route.c
@@ -1886,8 +1886,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
 			if (e->r_type==MYSELF_ST){
 				if (parse_sip_msg_uri(msg)<0) ret=-1;
 				else ret=check_self_op(e->op, &msg->parsed_uri.host,
-						       msg->parsed_uri.port_no?
-						       msg->parsed_uri.port_no:SIP_PORT);
+								GET_URI_PORT(&msg->parsed_uri));
 			}else{
 				ret=comp_str(e->op, &msg->new_uri,
 								e->r_type, &e->r, msg, h);
@@ -1896,8 +1895,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
 			if (e->r_type==MYSELF_ST){
 				if (parse_sip_msg_uri(msg)<0) ret=-1;
 				else ret=check_self_op(e->op, &msg->parsed_uri.host,
-						       msg->parsed_uri.port_no?
-						       msg->parsed_uri.port_no:SIP_PORT);
+								GET_URI_PORT(&msg->parsed_uri));
 			}else{
 				ret=comp_str(e->op, &msg->first_line.u.request.uri,
 								e->r_type, &e->r, msg, h);
@@ -1917,8 +1915,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
 				LOG(L_ERR, "ERROR: eval_elem: bad uri in From:\n");
 				goto error;
 			}
-			ret=check_self_op(e->op, &uri.host,
-					  uri.port_no?uri.port_no:SIP_PORT);
+			ret=check_self_op(e->op, &uri.host, GET_URI_PORT(&uri));
 		}else{
 			ret=comp_str(e->op, &get_from(msg)->uri,
 							e->r_type, &e->r, msg, h);
@@ -1939,8 +1936,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
 				LOG(L_ERR, "ERROR: eval_elem: bad uri in To:\n");
 				goto error;
 			}
-			ret=check_self_op(e->op, &uri.host,
-					  uri.port_no?uri.port_no:SIP_PORT);
+			ret=check_self_op(e->op, &uri.host, GET_URI_PORT(&uri));
 		}else{
 			ret=comp_str(e->op, &get_to(msg)->uri,
 							e->r_type, &e->r, msg, h);




More information about the sr-dev mailing list