Change in libosmo-netif[master]: stream: Attempt to workaround kernel ABI breakage

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

tnt gerrit-no-reply at lists.osmocom.org
Fri May 8 12:48:06 UTC 2020


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 <tnt at 246tNt.com>
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 <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200508/1710b709/attachment.htm>


More information about the gerrit-log mailing list