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
This commit is contained in:
parent
a45acd81be
commit
141b64f25b
16
src/stream.c
16
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);
|
||||
|
|
Loading…
Reference in New Issue