[erlang-patches] More about SCTP and R12B-5

Giacomo Olgeni g.olgeni@REDACTED
Thu Nov 6 00:29:50 CET 2008


Hello,

Erlang R12B-5 was recently released and there's a new issue about 
SCTP. Moreover, the "==" operator problem in configure is still there: 
how can anybody manage to build with SCTP?

While R12B-4 was using -lsctp as a linker option, R12B-5 is 
specifically looking for libsctp.so.1, which is rather unfortunate 
because 1) it expects to find a certain shared library version, and 2) 
it does not exist at all on (at least) FreeBSD.

The following patch tricks inet_drv into skipping the ddll code if 
HAVE_SCTP is defined and you happen to be using FreeBSD. This should 
probably be fixed in configure.in, but I wouldn't know where to start :-)

--- erts/emulator/drivers/common/inet_drv.c.orig
+++ erts/emulator/drivers/common/inet_drv.c
@@ -3460,9 +3460,14 @@
      /* Check the size of SCTP AssocID -- currently both this driver and the
         Erlang part require 32 bit: */
      ASSERT(sizeof(sctp_assoc_t)==ASSOC_ID_LEN);
-#   ifndef LIBSCTP
-#     error LIBSCTP not defined
-#   endif
+#   if defined (__FreeBSD__)
+    /* In FreeBSD, sctp_bindx belongs to libc - see sctp_bindx(3) */
+    inet_init_sctp();
+    add_driver_entry(&sctp_inet_driver_entry);
+#   else
+#     ifndef LIBSCTP
+#       error LIBSCTP not defined
+#     endif
      if (erts_sys_ddll_open_noext(STRINGIFY(LIBSCTP), &h_libsctp) == 0) {
  	void *ptr;
  	if (erts_sys_ddll_sym(h_libsctp, "sctp_bindx", &ptr) == 0) {
@@ -3471,6 +3476,7 @@
  	    add_driver_entry(&sctp_inet_driver_entry);
  	}
      }
+#   endif
  #  endif
  #endif /* _OSE_ */
      /* remove the dummy inet driver */
@@ -8997,7 +9003,7 @@
  	    rflag = add_flag ? SCTP_BINDX_ADD_ADDR : SCTP_BINDX_REM_ADDR;

  	    /* Invoke the call: */
-	    if (p_sctp_bindx(desc->s, addrs, n, rflag) < 0)
+	    if (sctp_bindx(desc->s, addrs, n, rflag) < 0)
  		return ctl_error(sock_errno(), rbuf, rsize);

  	    desc->state = INET_STATE_BOUND;


Regards,

   Giacomo



More information about the erlang-patches mailing list