SCTP Sockets cannot bind to namespaces in Red Hat Enterprise Linux 6

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6

Issue

  • When attempting to create a socket in a network namespace, socket allocation will fail.
  • The socket call, if viewed with the strace utility, will return EAFNOSUPPORT as so:
# uname -a
Linux rhel6-system 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

# strace ./sctp_namespace
clone(child_stack=0, flags=CLONE_PARENT_SETTID|SIGCHLD, parent_tidptr=0x7fffbfa7ee58) = 1307
        - - - - - - - - 8< - - - - - - - - 
socket(PF_INET, SOCK_STREAM, 0x84 /* IPPROTO_??? */) = -1 EAFNOSUPPORT (Address family not supported by protocol)

Resolution

  • SCTP does not support network namespaces in Red Hat Enterprise Linux 6; the patches to the kernel that allow for this be properly allocated are unable to be inserted into the Red Hat Enterprise Linux 6 kernel as they would break kABI compatibility.
  • Subsequently, Red Hat Enterprise Linux 7 and above contain the commits to the kernel which allow full namespace support for SCTP:
# uname -a
Linux rhel7-system 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

# strace ./sctp_namespace
clone(child_stack=0, flags=CLONE_PARENT_SETTID|SIGCHLD, parent_tidptr=0x7fff05066200) = 24278
        - - - - - - - - 8< - - - - - - - - 
socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP) = 3

Root Cause

  • This was discussed in private bugzilla bz1158650 and confirmed there.
  • A large set of inclusions would have to take place to allow for this commit:
commit bb2db45b5495455ec7580315029184550709f4a2
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Mon Aug 6 08:46:26 2012 +0000

    sctp: Enable sctp in all network namespaces

    - Fix the sctp_af operations to work in all namespaces
    - Enable sctp socket creation in all network namespaces.

    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    Acked-by: Vlad Yasevich <vyasevich@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
  • The above commit cannot be added to the current Red Hat Enterprise Linux 6 releases as the dependencies for the above patch break compatibility in kABI, which must be preserved between major releases of Red Hat Enterprise Linux.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments