[PATCH] libosmo-netif[master]: SCTP: Fix PPID byte width

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Apr 12 10:10:47 UTC 2017


Review at  https://gerrit.osmocom.org/2309

SCTP: Fix PPID byte width

In a659590e29412588bca2243b8329e82286244b00 we fixed endianness issues
with the Stream ID field, but at the same time mistook the PPID field
for 16bits.  In reality it is 32bits, and hence our 'htons' is rendering
wrong PPID values.

Change-Id: I1b60523044835ee630dba9a43d26af4f1ebd1ced
---
M src/stream.c
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/09/2309/1

diff --git a/src/stream.c b/src/stream.c
index 3bc36a3..591cd06 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -185,7 +185,7 @@
 #ifdef HAVE_LIBSCTP
 	case IPPROTO_SCTP:
 		memset(&sinfo, 0, sizeof(sinfo));
-		sinfo.sinfo_ppid = htons(msgb_sctp_ppid(msg));
+		sinfo.sinfo_ppid = htonl(msgb_sctp_ppid(msg));
 		sinfo.sinfo_stream = msgb_sctp_stream(msg);
 		ret = sctp_send(cli->ofd.fd, msg->data, msgb_length(msg),
 				&sinfo, MSG_NOSIGNAL);
@@ -752,7 +752,7 @@
 #ifdef HAVE_LIBSCTP
 	case IPPROTO_SCTP:
 		memset(&sinfo, 0, sizeof(sinfo));
-		sinfo.sinfo_ppid = htons(msgb_sctp_ppid(msg));
+		sinfo.sinfo_ppid = htonl(msgb_sctp_ppid(msg));
 		sinfo.sinfo_stream = msgb_sctp_stream(msg);
 		ret = sctp_send(conn->ofd.fd, msg->data, msgb_length(msg),
 				&sinfo, MSG_NOSIGNAL);
@@ -931,7 +931,7 @@
 			}
 			return -EAGAIN;
 		}
-		msgb_sctp_ppid(msg) = ntohs(sinfo.sinfo_ppid);
+		msgb_sctp_ppid(msg) = ntohl(sinfo.sinfo_ppid);
 		msgb_sctp_stream(msg) = sinfo.sinfo_stream;
 		break;
 #endif

-- 
To view, visit https://gerrit.osmocom.org/2309
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b60523044835ee630dba9a43d26af4f1ebd1ced
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list