summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-04-17 10:32:15 +0200
committerHarald Welte <laforge@gnumonks.org>2017-04-17 10:33:10 +0200
commit6548d1b9c44feee0c5f38846759f396c6f5da479 (patch)
tree635dd05ffab6d4d50e5027239f1b638eede8a87a
parent161cd0dcd74f5c0aada30b7247f9cfb64a1126fb (diff)
SUA: Make sure to reject unknown CO message types
Found using sua-sgp-mtr-i-04 from Michael Tuexen's sua-testtool. Change-Id: Iec5c8deb6cc48a1269fd85243c1350bafd1dd815
-rw-r--r--src/sua.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sua.c b/src/sua.c
index f003f7b..fb7545e 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -519,6 +519,26 @@ static int sua_rx_co(struct osmo_ss7_asp *asp, struct xua_msg *xua)
{
struct osmo_sccp_instance *inst = asp->inst->sccp;
+ OSMO_ASSERT(xua->hdr.msg_class == SUA_MSGC_CO);
+
+ switch (xua->hdr.msg_type) {
+ case 0: /* Reserved, permitted by ETSI TS 101 592 5.2.3.2 */
+ case SUA_CO_CORE:
+ case SUA_CO_COAK:
+ case SUA_CO_COREF:
+ case SUA_CO_RELRE:
+ case SUA_CO_RELCO:
+ case SUA_CO_RESCO:
+ case SUA_CO_RESRE:
+ case SUA_CO_CODT:
+ case SUA_CO_CODA:
+ case SUA_CO_COERR:
+ case SUA_CO_COIT:
+ break;
+ default:
+ return SUA_ERR_UNSUPP_MSG_TYPE;
+ }
+
/* We feed into SCRC, which then hands the message into
* either SCLC or SCOC, or forwards it to MTP */
return scrc_rx_mtp_xfer_ind_xua(inst, xua);