M3UA: Ensure XFER messages are not sent on stream 0

According to the RFC, Stream ID 0 MUST not be used for XFER/DATA
messages.

This was discovered (and fix validated) using m3ua-sgp-mtr-v-003-alternate
of Michale Tuexen's m3ua-testtool.

Change-Id: I80b941426b5106e091bd1becff0ae97958aff97c
This commit is contained in:
Harald Welte 2017-04-09 19:36:21 +02:00
parent 440771f18a
commit 1710c7e71f
1 changed files with 9 additions and 1 deletions

View File

@ -432,6 +432,10 @@ static int m3ua_tx_xua_asp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
return -1;
}
if (xua->hdr.msg_class == M3UA_MSGC_XFER)
msgb_sctp_stream(msg) = 1;
else
msgb_sctp_stream(msg) = 0;
msgb_sctp_ppid(msg) = M3UA_PPID;
return osmo_ss7_asp_send(asp, msg);
}
@ -666,12 +670,16 @@ int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
goto out;
}
/* TODO: check for SCTP Strema ID */
/* TODO: check if any AS configured in ASP */
/* TODO: check for valid routing context */
switch (xua->hdr.msg_class) {
case M3UA_MSGC_XFER:
/* The DATA message MUST NOT be sent on stream 0. */
if (msgb_sctp_stream(msg) == 0) {
rc = M3UA_ERR_INVAL_STREAM_ID;
break;
}
rc = m3ua_rx_xfer(asp, xua);
break;
case M3UA_MSGC_ASPSM: