aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2020-05-07 13:36:01 +0200
committerSylvain Munaut <tnt@246tNt.com>2020-05-08 13:42:51 +0200
commit141b64f25bf73f0759bcde63a534ac35fabed3b7 (patch)
tree923bfd26ff9b8359151e960964af2099c56bd0d2 /src/stream.c
parenta45acd81be1f6c24fcf3e54b0cf5168e55c31c0a (diff)
stream: Attempt to workaround kernel ABI breakage
See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/sctp.h?id=b6e6b5f1da7e8d092f86a4351802c27c0170c5a5 and https://marc.info/?l=linux-sctp&m=158729301516157&w=2 A kernel structure changed size, a new field was added at the end. Attempt to submit with the known "old" size. Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: Ia95dd1f9ffed9f743c049e05797b1a6f1f9f8c69
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index 65532d3..5887bf9 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -92,6 +92,22 @@ static int sctp_sock_activate_events(int fd)
rc = setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS,
&event, sizeof(event));
+ /*
+ * Attempt to work around kernel ABI breakage
+ *
+ * In kernel commit b6e6b5f1da7e8d092f86a4351802c27c0170c5a5, the
+ * struct sctp_event_subscribe had a u8 field added to it at the end, thus
+ * breaking ABI.
+ * See https://marc.info/?l=linux-sctp&m=158729301516157&w=2 for discussion.
+ *
+ * We attempt to work around the issue where the kernel header are new
+ * and running kernel is old, by forcing the size of the struct to 13 which
+ * is the "old" size
+ */
+ if ((rc < 0) && (sizeof(event) != 13))
+ rc = setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS,
+ &event, 13);
+
if (rc < 0)
LOGP(DLINP, LOGL_ERROR, "couldn't activate SCTP events "
"on FD %u\n", fd);