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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2017-12-22T08:49:36+01:00

sctp: removed risky workaround for dealing with old libksctp versions

- writing over the size of field may have unexpected results

---

Modified: src/modules/sctp/sctp_server.c

---

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

---

diff --git a/src/modules/sctp/sctp_server.c b/src/modules/sctp/sctp_server.c
index 4a8285c992..3efc126a06 100644
--- a/src/modules/sctp/sctp_server.c
+++ b/src/modules/sctp/sctp_server.c
@@ -766,28 +766,8 @@ static int sctp_init_sock_opt_common(int s, int af)
        /* enable the SCTP_EVENTS */
 #ifdef SCTP_EVENTS
        if (setsockopt(s, IPPROTO_SCTP, SCTP_EVENTS, ev_s, sizeof(*ev_s))==-1){
-               /* on linux the checks for the struct sctp_event_subscribe size
-                  are too strict, making certain lksctp/kernel combination
-                  unworkable => since we don't use the extra information
-                  (sctp_authentication_event) added in newer version, we can
-                  try with different sizes) */
-#ifdef __OS_linux
-               /* 1. lksctp 1.0.9 with kernel < 2.6.26 -> kernel expects 
-                     the structure without the authentication event member */
-               if (setsockopt(s, IPPROTO_SCTP, SCTP_EVENTS, ev_s, 
sizeof(*ev_s)-1)==0)
-                       goto ev_success;
-               /* 2. lksctp < 1.0.9? with kernel >= 2.6.26: the sctp.h 
structure
-                  does not have the authentication member, but the newer 
kernels 
-                  check only for optlen > sizeof(...) => we should never reach
-                  this point. */
-               /* 3. just to be foolproof if we reached this point, try
-                   with a bigger size before giving up  (out of desperation) */
-               if (setsockopt(s, IPPROTO_SCTP, SCTP_EVENTS, ev_s, 
sizeof(es))==0)
-                       goto ev_success;
-
-#endif
                LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt: "
-                               "SCTP_EVENTS: %s\n", strerror(errno));
+                               "SCTP_EVENTS: %s (%d)\n", strerror(errno), 
errno);
                sctp_err++;
                goto error; /* critical */
        }


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to