laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/43407?usp=email )

Change subject: sua: Do SUA specific MGMT msg validation [3/6]
......................................................................

sua: Do SUA specific MGMT msg validation [3/6]

SUA MGMT ERR messages contain Network Appearance IE, which has different
tag than related IE in M3UA.
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 <[email protected]>
Change-Id: I97ae5683d8eee2c6d30ae49736ca3fffe33a665f
---
M src/m3ua.c
M src/sua.c
M src/xua_internal.h
3 files changed, 32 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved




diff --git a/src/m3ua.c b/src/m3ua.c
index f500883..efa650b 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -389,7 +389,7 @@
 };

 /* MGMT */
-static const struct xua_msg_part_class err_req_ies[] = {
+static const struct xua_msg_part_class m3ua_err_req_ies[] = {
        M3UA_MSG_PART_CLASS_ERR_CODE(true),
        M3UA_MSG_PART_CLASS_ROUTE_CTX(false),
        M3UA_MSG_PART_CLASS_NET_APPEAR(false),
@@ -397,14 +397,14 @@
        M3UA_MSG_PART_CLASS_DIAG_INFO(false),
        XUA_MSG_PART_CLASS_EOF
 };
-static const struct xua_msg_part_class ntfy_req_ies[] = {
+const struct xua_msg_part_class m3ua_ntfy_req_ies[] = {
        M3UA_MSG_PART_CLASS_STATUS(true),
        M3UA_MSG_PART_CLASS_ASP_ID(false),
        M3UA_MSG_PART_CLASS_ROUTE_CTX(false),
        M3UA_MSG_PART_CLASS_INFO_STRING(false),
        XUA_MSG_PART_CLASS_EOF
 };
-static const struct value_string m3ua_mgmt_msgt_names[] = {
+const struct value_string m3ua_mgmt_msgt_names[] = {
        { M3UA_MGMT_ERR,        "ERROR" },
        { M3UA_MGMT_NTFY,       "NOTIFY" },
        { 0, NULL }
@@ -414,8 +414,8 @@
        .msgt_names = m3ua_mgmt_msgt_names,
        .iei_names = m3ua_iei_names,
        .ies = {
-               IES(M3UA_MGMT_ERR, err_req_ies),
-               IES(M3UA_MGMT_NTFY, ntfy_req_ies),
+               IES(M3UA_MGMT_ERR, m3ua_err_req_ies),
+               IES(M3UA_MGMT_NTFY, m3ua_ntfy_req_ies),
        },
 };

diff --git a/src/sua.c b/src/sua.c
index af4b1f3..ab84abe 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -185,6 +185,9 @@
 #define SUA_MSG_PART_CLASS_CAUSE(mandatory) \
        XUA_MSG_PART_CLASS_U32(SUA_IEI_CAUSE, (mandatory))

+#define SUA_MSG_PART_CLASS_NET_APPEARANCE(mandatory) \
+       XUA_MSG_PART_CLASS_U32(SUA_IEI_NET_APPEARANCE, (mandatory))
+
 #define SUA_MSG_PART_CLASS_DATA(mandatory) \
        XUA_MSG_PART_CLASS_UNBOUND(SUA_IEI_DATA, (mandatory))

@@ -376,13 +379,33 @@
        },
 };

+/* MGMT */
+/* ERR msg in SUA is almost same as M3UA, but "Network Appearance" IE has 
differnet TAG... */
+static const struct xua_msg_part_class sua_err_req_ies[] = {
+       SUA_MSG_PART_CLASS_ERR_CODE(true),
+       SUA_MSG_PART_CLASS_ROUTE_CTX(false),
+       SUA_MSG_PART_CLASS_NET_APPEARANCE(false),
+       SUA_MSG_PART_CLASS_AFFECTED_PC(false),
+       SUA_MSG_PART_CLASS_DIAG_INFO(false),
+       XUA_MSG_PART_CLASS_EOF
+};
+static const struct xua_msg_class sua_msg_class_mgmt = {
+       .name = "MGMT",
+       .msgt_names = m3ua_mgmt_msgt_names,
+       .iei_names = sua_iei_names,
+       .ies = {
+               IES(SUA_MGMT_ERR, sua_err_req_ies),
+               IES(SUA_MGMT_NTFY, m3ua_ntfy_req_ies),
+       },
+};
+
 const struct xua_dialect xua_dialect_sua = {
        .name = "SUA",
        .ppid = SUA_PPID,
        .port = SUA_PORT,
        .log_subsys = DLSUA,
        .class = {
-               [SUA_MSGC_MGMT] = &m3ua_msg_class_mgmt, /* TODO: different than 
M3UA */
+               [SUA_MSGC_MGMT] = &sua_msg_class_mgmt,
                [SUA_MSGC_SNM] = &m3ua_msg_class_snm, /* TODO: different than 
M3UA */
                [SUA_MSGC_ASPSM] = &m3ua_msg_class_aspsm, /* Same as M3UA */
                [SUA_MSGC_ASPTM] = &m3ua_msg_class_asptm, /* TODO: different 
than M3UA */
diff --git a/src/xua_internal.h b/src/xua_internal.h
index 5195b35..bd18401 100644
--- a/src/xua_internal.h
+++ b/src/xua_internal.h
@@ -91,7 +91,10 @@
 extern const struct xua_msg_class m3ua_msg_class_aspsm;
 extern const struct xua_msg_class m3ua_msg_class_asptm;

+extern const struct xua_msg_part_class m3ua_ntfy_req_ies[];
+
 extern const struct value_string m3ua_snm_msgt_names[];
+extern const struct value_string m3ua_mgmt_msgt_names[];
 extern const struct value_string m3ua_err_names[];
 extern const struct value_string m3ua_ntfy_type_names[];
 extern const struct value_string m3ua_ntfy_stchg_names[];

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/43407?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I97ae5683d8eee2c6d30ae49736ca3fffe33a665f
Gerrit-Change-Number: 43407
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>

Reply via email to