Module: kamailio
Branch: master
Commit: 34054fbd144102d414318249de217cedf8e5bd39
URL:
https://github.com/kamailio/kamailio/commit/34054fbd144102d414318249de217ce…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: 2023-11-16T09:29:00-05:00
core: fix compilation for older kernels
---
Modified: src/core/tcp_main.c
---
Diff:
https://github.com/kamailio/kamailio/commit/34054fbd144102d414318249de217ce…
Patch:
https://github.com/kamailio/kamailio/commit/34054fbd144102d414318249de217ce…
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 1b131a3311a..7b46ccbafde 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1280,12 +1280,15 @@ inline static int find_listening_sock_info(
int optval = 1;
su2ip_addr(&ip, &si->su);
*from = &si->su;
+#if !defined(TCP_DONT_REUSEADDR)
if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(optval))
== -1) {
LM_ERR("setsockopt SO_REUSEADDR %s\n", strerror(errno));
/* continue, not critical */
}
+#endif
+#ifdef SO_REUSEPORT
optval = 1;
if(setsockopt(s, SOL_SOCKET, SO_REUSEPORT, (void *)&optval,
sizeof(optval))
@@ -1293,6 +1296,7 @@ inline static int find_listening_sock_info(
LM_ERR("setsockopt SO_REUSEPORT %s\n", strerror(errno));
/* continue, not critical */
}
+#endif
if(unlikely(bind(s, &si->su.s, sockaddru_len(si->su)) != 0)) {
LM_WARN("binding to source address %s failed: %s [%d]\n",
su2a(&si->su, sizeof(si->su)), strerror(errno), errno);