Tiliman’s Weblog

October 21, 2011

Bringing back Adler32 to SCTP for Kernel 2.6

Filed under: GSM — Tags: , , , , , , , — tiliman @ 9:55 am

I had a situation a few days ago where I wanted to connect to our STP to test MAP applications built on Mobicents. Our STP was configured to only support Adler32 checksum. Adler32 is deprecated and CRC32 is considered a standard checksum to be used for SCTP. Keeping up with standards the Linux 2.6 kernel stopped supporting Adler32 and implemented CRC32 using libcrc32c.

I couldn’t reconfigure STP to use CRC32 and it was not possible to use different checksums for different SCTP peers as it is a Transport Layer Protocol. There was no solution I could find on internet, so I decided to patch my kernel and replace CRC32 with Adler32. I could see that a lot of other have had this problem and they couldn’t find any solution. I hope my solution would work for them as well.

  • Download kernel-headers for your kernel. Command like this would work on Debian apt-get install linux-headers-$(uname -r). Note: you don’t need sources for kernel. Just header files.
  • Take a backup of your original sctp.ko file. It would be somewhere /lib/modules/$(uname -r)/kernel/net/sctp/sctp.ko
  • Download the sctp module code from here to a clean directory somewhere away from usual linux sources. You don’t need it to be in linux sources directory.
  • Do make and make install in the new SCTP code at src/sctp/.
  • Check if new module is installed using modinfo sctp. It should say in description:    Support for the SCTP protocol (RFC2960) – with Adler32.
  • Do rmmod sctp and then modprobe sctp to load this new module. If you can’t do rmmod as module is busy and you can’t free it then you might have to reboot the system.
  • On load the module prints a message in /var/log/messages Initialising Adler32 patched SCTP module for 2.6 kernel

Now you have SCTP using Adler32 instead of CRC32. If you need to ever go back to CRC32, you can replace sctp.ko with your backedup module or you could download kernel sources and remake module.
May be in future I would add a load param to module to tell it to use CRC32 or Adler32 checksum.


Update October 24, 2011
The initial code was able to use checksum for outbound packets but was still using CRC32 for inbound packets. Updated the link to fix that.

Blog at WordPress.com.