Module: kamailio
Branch: master
Commit: c1bf2048de60c4abb9a5b8b343f50400deefa3bf
URL: 
https://github.com/kamailio/kamailio/commit/c1bf2048de60c4abb9a5b8b343f50400deefa3bf

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-02-24T12:25:38+01:00

tls: try to lookup client profile via bind address

- local address connection can have a randomly allocated port by os

---

Modified: modules/tls/tls_server.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/c1bf2048de60c4abb9a5b8b343f50400deefa3bf.diff
Patch: 
https://github.com/kamailio/kamailio/commit/c1bf2048de60c4abb9a5b8b343f50400deefa3bf.patch

---

diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c
index b7e3207..28cf1a3 100644
--- a/modules/tls/tls_server.c
+++ b/modules/tls/tls_server.c
@@ -196,8 +196,16 @@ static int tls_complete_init(struct tcp_connection* c)
        } else {
                state=S_TLS_CONNECTING;
                sname = tls_get_connect_server_name();
-               dom = tls_lookup_cfg(cfg, TLS_DOMAIN_CLI,
-                                                               &c->rcv.dst_ip, 
c->rcv.dst_port, sname);
+               if(&c->rcv.bind_address!=NULL) {
+                       /* if there is a bind_address, use it, because the src 
port
+                        * for connection can be randomly assigned by OS */
+                       dom = tls_lookup_cfg(cfg, TLS_DOMAIN_CLI,
+                                               &c->rcv.bind_address->address,
+                                               c->rcv.bind_address->port_no, 
sname);
+               } else {
+                       dom = tls_lookup_cfg(cfg, TLS_DOMAIN_CLI,
+                                               &c->rcv.dst_ip, 
c->rcv.dst_port, sname);
+               }
        }
        if (unlikely(c->state<0)) {
                BUG("Invalid connection (state %d)\n", c->state);


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to