pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/43409?usp=email )
Change subject: sua: Do SUA specific RKM msg validation [6/6] ......................................................................
sua: Do SUA specific RKM msg validation [6/6]
SUA RKM messages contain IEs different than those of related M3UA RKM messages. Until now it was fine because we only checked for mandatory IEs, but it's not the case anymore.
Related: OS#7074 Reported-By: Tristan Madani tristan@talencesecurity.com Change-Id: I0a1a9f22b3b3c0c5df200d3de08e4f8087be06f7 --- M src/sua.c 1 file changed, 43 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/09/43409/1
diff --git a/src/sua.c b/src/sua.c index 25e1ee8..b0717c0 100644 --- a/src/sua.c +++ b/src/sua.c @@ -158,6 +158,12 @@
/* SUA specific: */
+#define SUA_MSG_PART_CLASS_REG_RESULT(mandatory) \ + XUA_MSG_PART_CLASS(SUA_IEI_REG_RESULT, (mandatory), true, 0, XUA_MSG_PART_CLASS_MAX_LEN) + +#define SUA_MSG_PART_CLASS_DEREG_RESULT(mandatory) \ + XUA_MSG_PART_CLASS(SUA_IEI_DEREG_RESULT, (mandatory), true, 0, XUA_MSG_PART_CLASS_MAX_LEN) + #define SUA_MSG_PART_CLASS_HOP_CTR(mandatory) \ XUA_MSG_PART_CLASS_U32(SUA_IEI_S7_HOP_CTR, (mandatory))
@@ -176,6 +182,9 @@ #define SUA_MSG_PART_CLASS_RX_SEQ_NR(mandatory) \ XUA_MSG_PART_CLASS_U32(SUA_IEI_RX_SEQ_NR, (mandatory))
+#define SUA_MSG_PART_CLASS_ASP_CAPA(mandatory) \ + XUA_MSG_PART_CLASS_U32(SUA_IEI_ASP_CAPA, (mandatory)) + #define SUA_MSG_PART_CLASS_CREDIT(mandatory) \ XUA_MSG_PART_CLASS_U32(SUA_IEI_CREDIT, (mandatory))
@@ -197,6 +206,9 @@ #define SUA_MSG_PART_CLASS_USER_CAUSE(mandatory) \ XUA_MSG_PART_CLASS_U32(SUA_IEI_USER_CAUSE, (mandatory))
+#define SUA_MSG_PART_CLASS_ROUTING_KEY(mandatory) \ + XUA_MSG_PART_CLASS(SUA_IEI_ROUTING_KEY, (mandatory), true, 0, XUA_MSG_PART_CLASS_MAX_LEN) + #define SUA_MSG_PART_CLASS_DRN(mandatory) \ XUA_MSG_PART_CLASS_U32(SUA_IEI_DRN, (mandatory))
@@ -504,6 +516,36 @@ }, };
+/* RKM */ +static const struct xua_msg_part_class reg_req_ies[] = { + SUA_MSG_PART_CLASS_ROUTING_KEY(true), + SUA_MSG_PART_CLASS_ASP_CAPA(false), + XUA_MSG_PART_CLASS_EOF +}; +static const struct xua_msg_part_class reg_rsp_ies[] = { + SUA_MSG_PART_CLASS_REG_RESULT(true), + XUA_MSG_PART_CLASS_EOF +}; +static const struct xua_msg_part_class dereg_req_ies[] = { + SUA_MSG_PART_CLASS_ROUTE_CTX(true), + XUA_MSG_PART_CLASS_EOF +}; +static const struct xua_msg_part_class dereg_rsp_ies[] = { + SUA_MSG_PART_CLASS_DEREG_RESULT(true), + XUA_MSG_PART_CLASS_EOF +}; +const struct xua_msg_class sua_msg_class_rkm = { + .name = "RKM", + .msgt_names = m3ua_rkm_msgt_names, /* same as M3UA */ + .iei_names = sua_iei_names, + .ies = { + IES(SUA_RKM_REG_REQ, reg_req_ies), + IES(SUA_RKM_REG_RSP, reg_rsp_ies), + IES(SUA_RKM_DEREG_REQ, dereg_req_ies), + IES(SUA_RKM_DEREG_RSP, dereg_rsp_ies), + }, +}; + const struct xua_dialect xua_dialect_sua = { .name = "SUA", .ppid = SUA_PPID, @@ -516,7 +558,7 @@ [SUA_MSGC_ASPTM] = &sua_msg_class_asptm, [SUA_MSGC_CL] = &sua_msg_class_cl, [SUA_MSGC_CO] = &sua_msg_class_co, - [SUA_MSGC_RKM] = &m3ua_msg_class_rkm, /* TODO: different than M3UA */ + [SUA_MSGC_RKM] = &sua_msg_class_rkm, }, };