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

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
---
M src/m3ua.c
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/75/2275/1

diff --git a/src/m3ua.c b/src/m3ua.c
index 7291d0d..ee96c6e 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -432,6 +432,10 @@
                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 @@
                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:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I80b941426b5106e091bd1becff0ae97958aff97c
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to