[sr-dev] [kamailio/kamailio] ims_ipsec_pcscf: more algorithms, SA improvements (#2731)

riccardv notifications at github.com
Mon May 10 14:57:45 CEST 2021


@riccardv commented on this pull request.



> -        // for Reply and TCP sends from P-CSCF server port, for Reply and UDP sends from P-CSCF client port
-        src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
+        // Check send socket
+        struct socket_info * client_sock = grep_sock_info(via_host.af == AF_INET ? &ipsec_listen_addr : &ipsec_listen_addr6, src_port, dst_proto);
+        if(client_sock) {
+            // for Reply and TCP sends from P-CSCF server port, for Reply and UDP sends from P-CSCF client port
+            src_port = dst_proto == PROTO_TCP ? s->port_ps : s->port_pc;
 
-        // for Reply and TCP sends to UE client port, for Reply and UDP sends to UE server port
-        dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+            // for Reply and TCP sends to UE client port, for Reply and UDP sends to UE server port
+            dst_port = dst_proto == PROTO_TCP ? s->port_uc : s->port_us;
+        }
+        else
+        {
+            src_port = s->port_pc;
+            dst_port = s->port_us;
+        }

Hi @alexyosifov ,

without the patch the ports in case of TCP are always:
src_port = s->port_ps
dst_port = s->port_uc
That are the ones used in case the user agent open the connection.

A pre check is necessary because if this socket is not already open, the use the ports:
src_port = s->port_pc;
dst_port = s->port_us;
that are the port from Proxy Client (pc) -> User Server (us).
Is a attempt to fallback to the other opened socket.

This case can be happens when INVITE transaction is very long due to long Ringing time phase.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2731#discussion_r629336057
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20210510/014e3dd6/attachment-0001.htm>


More information about the sr-dev mailing list