Module: kamailio
Branch: master
Commit: 6779efd430178adff0ae438d178e38c003e4e05c
URL:
https://github.com/kamailio/kamailio/commit/6779efd430178adff0ae438d178e38c…
Author: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2024-04-16T14:42:20+02:00
tcp_main: Add proto argument to tcpconn_exists function
---
Modified: src/core/tcp_main.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6779efd430178adff0ae438d178e38c…
Patch:
https://github.com/kamailio/kamailio/commit/6779efd430178adff0ae438d178e38c…
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 73e2ef6163d..0ea1b541ea6 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1758,13 +1758,12 @@ struct tcp_connection *_tcpconn_find(int id, struct ip_addr *ip,
int port,
* - return: 1 if found; 0 if not found
*/
int tcpconn_exists(int conn_id, ip_addr_t *peer_ip, int peer_port,
- ip_addr_t *local_ip, int local_port)
+ ip_addr_t *local_ip, int local_port, sip_protos_t proto)
{
tcp_connection_t *c;
TCPCONN_LOCK;
- c = _tcpconn_find(
- conn_id, peer_ip, peer_port, local_ip, local_port, PROTO_NONE);
+ c = _tcpconn_find(conn_id, peer_ip, peer_port, local_ip, local_port, proto);
TCPCONN_UNLOCK;
if(c) {
return 1;
@@ -4497,7 +4496,8 @@ static inline int handle_new_connect(struct socket_info *si)
if(likely(tcpconn)) {
if(tcp_accept_unique) {
if(tcpconn_exists(0, &tcpconn->rcv.dst_ip, tcpconn->rcv.dst_port,
- &tcpconn->rcv.src_ip, tcpconn->rcv.src_port)) {
+ &tcpconn->rcv.src_ip, tcpconn->rcv.src_port,
+ si->proto)) {
LM_ERR("duplicated connection by local and remote addresses\n");
_tcpconn_free(tcpconn);
tcp_safe_close(new_sock);