tnt has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/18097 )

Change subject: stream: Attempt to workaround kernel ABI breakage
......................................................................

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 <[email protected]>
Change-Id: Ia95dd1f9ffed9f743c049e05797b1a6f1f9f8c69
---
M src/stream.c
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



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 @@
        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);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/18097
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ia95dd1f9ffed9f743c049e05797b1a6f1f9f8c69
Gerrit-Change-Number: 18097
Gerrit-PatchSet: 4
Gerrit-Owner: tnt <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-Reviewer: tnt <[email protected]>
Gerrit-MessageType: merged

Reply via email to