aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-04-12 12:08:45 +0200
committerHarald Welte <laforge@gnumonks.org>2017-04-12 12:08:45 +0200
commit5ae42bca913c94b7f93fdc6a72f0aff885f5d794 (patch)
treef4fe7c2f646b7feb4fba1b8f33f72025b35aa9b0 /src/stream.c
parent9ec26583cd807e0aeaa3b9de927f3d8a768c3a71 (diff)
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
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c6
1 files changed, 3 insertions, 3 deletions
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 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
#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 @@ static void osmo_stream_srv_write(struct osmo_stream_srv *conn)
#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 @@ int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
}
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