laforge submitted this change.
sua: Do SUA specific ASPTM msg validation [5/6]
SUA ASPTM ASP Activate message contain different IEs than those in the
related M3UA message. Reuse M3UA structs when possible and define a new
SUA structure for that message.
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: Ib35823b84398d43879268565e9557757f9a04c45
---
M src/m3ua.c
M src/sua.c
M src/xua_internal.h
3 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/src/m3ua.c b/src/m3ua.c
index efa650b..79e654d 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -353,18 +353,19 @@
M3UA_MSG_PART_CLASS_INFO_STRING(false),
XUA_MSG_PART_CLASS_EOF
};
-static const struct xua_msg_part_class m3ua_asp_inact_ies[] = {
+/* The following 3 msg structs are reused by SUA since it contains same IEs: */
+const struct xua_msg_part_class m3ua_asp_inact_ies[] = {
M3UA_MSG_PART_CLASS_ROUTE_CTX(false),
M3UA_MSG_PART_CLASS_INFO_STRING(false),
XUA_MSG_PART_CLASS_EOF
};
-static const struct xua_msg_part_class m3ua_asp_act_ack_ies[] = {
+const struct xua_msg_part_class m3ua_asp_act_ack_ies[] = {
M3UA_MSG_PART_CLASS_TRAF_MODE_TYP(false),
M3UA_MSG_PART_CLASS_ROUTE_CTX(false),
M3UA_MSG_PART_CLASS_INFO_STRING(false),
XUA_MSG_PART_CLASS_EOF
};
-static const struct xua_msg_part_class m3ua_asp_inact_ack_ies[] = {
+const struct xua_msg_part_class m3ua_asp_inact_ack_ies[] = {
M3UA_MSG_PART_CLASS_ROUTE_CTX(false),
M3UA_MSG_PART_CLASS_INFO_STRING(false),
XUA_MSG_PART_CLASS_EOF
diff --git a/src/sua.c b/src/sua.c
index ddd7e24..2b542da 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -138,6 +138,9 @@
#define SUA_MSG_PART_CLASS_DIAG_INFO(mandatory) \
XUA_MSG_PART_CLASS_UNBOUND(SUA_IEI_DIAG_INFO, (mandatory))
+#define SUA_MSG_PART_CLASS_TRAF_MODE_TYP(mandatory) \
+ XUA_MSG_PART_CLASS_U32(SUA_IEI_TRAF_MODE_TYP, (mandatory))
+
#define SUA_MSG_PART_CLASS_ERR_CODE(mandatory) \
XUA_MSG_PART_CLASS_U32(SUA_IEI_ERR_CODE, (mandatory))
@@ -194,6 +197,12 @@
#define SUA_MSG_PART_CLASS_USER_CAUSE(mandatory) \
XUA_MSG_PART_CLASS_U32(SUA_IEI_USER_CAUSE, (mandatory))
+#define SUA_MSG_PART_CLASS_DRN(mandatory) \
+ XUA_MSG_PART_CLASS_U32(SUA_IEI_DRN, (mandatory))
+
+#define SUA_MSG_PART_CLASS_TID(mandatory) \
+ XUA_MSG_PART_CLASS_U32(SUA_IEI_TID, (mandatory))
+
#define SUA_MSG_PART_CLASS_SMI(mandatory) \
XUA_MSG_PART_CLASS_U32(SUA_IEI_SMI, (mandatory))
@@ -279,6 +288,27 @@
},
};
+/* ASPTM: Only "ASP Active" IEs differ between SUA and M3UA: */
+static const struct xua_msg_part_class sua_asp_act_ies[] = {
+ SUA_MSG_PART_CLASS_TRAF_MODE_TYP(false),
+ SUA_MSG_PART_CLASS_ROUTE_CTX(false),
+ SUA_MSG_PART_CLASS_TID(false),
+ SUA_MSG_PART_CLASS_DRN(false),
+ SUA_MSG_PART_CLASS_INFO_STRING(false),
+ XUA_MSG_PART_CLASS_EOF
+};
+const struct xua_msg_class sua_msg_class_asptm = {
+ .name = "ASPTM",
+ .msgt_names = m3ua_asptm_msgt_names,
+ .iei_names = sua_iei_names,
+ .ies = {
+ IES(SUA_ASPTM_ACTIVE, sua_asp_act_ies),
+ IES(SUA_ASPTM_INACTIVE, m3ua_asp_inact_ies),
+ IES(SUA_ASPTM_ACTIVE_ACK, m3ua_asp_act_ack_ies),
+ IES(SUA_ASPTM_INACTIVE_ACK, m3ua_asp_inact_ack_ies),
+ },
+};
+
static const struct xua_msg_part_class cldt_ies[] = {
SUA_MSG_PART_CLASS_ROUTE_CTX(true),
SUA_MSG_PART_CLASS_PROTO_CLASS(true),
@@ -484,7 +514,7 @@
[SUA_MSGC_MGMT] = &sua_msg_class_mgmt,
[SUA_MSGC_SNM] = &sua_msg_class_snm,
[SUA_MSGC_ASPSM] = &m3ua_msg_class_aspsm, /* Same as M3UA */
- [SUA_MSGC_ASPTM] = &m3ua_msg_class_asptm, /* TODO: different than M3UA */
+ [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 */
diff --git a/src/xua_internal.h b/src/xua_internal.h
index bd18401..5422161 100644
--- a/src/xua_internal.h
+++ b/src/xua_internal.h
@@ -92,9 +92,13 @@
extern const struct xua_msg_class m3ua_msg_class_asptm;
extern const struct xua_msg_part_class m3ua_ntfy_req_ies[];
+extern const struct xua_msg_part_class m3ua_asp_inact_ies[];
+extern const struct xua_msg_part_class m3ua_asp_act_ack_ies[];
+extern const struct xua_msg_part_class m3ua_asp_inact_ack_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_asptm_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 change 43408. To unsubscribe, or for help writing mail filters, visit settings.