pespin submitted this change.
sccp: SCOC -> SCRC: Delay called addr lookup until needed [2/3]
Follow more closely the diagrams in Figure C.1/Q.714.
This is important because according to ITU Q.714 section 2.2.2, the
"Addressing information" is obtained in a different way:
* CL msgs (N-UNITDATA.req): Obtained from the "Called address" parameter
* CO msgs == CR (N-CONNECT.req): Obtained from the "Called address" parameter
* CO msgs != CR (eg. N-DATA.req): Obtained from connection info (DPC +
MTP-SAP instance).
Change-Id: I1dda9b9288f3f34dfad6064e3f9fff6dcd6abbd7
---
M src/sccp_scrc.c
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c
index 990987a..706e01c 100644
--- a/src/sccp_scrc.c
+++ b/src/sccp_scrc.c
@@ -245,12 +245,20 @@
/* "Figure C.1/Q.714 - SCCP routing control procedures (SCRC) (sheet 5 of 12)"
* Only used for Connection Oriented messages */
-static int scrc_node_2(struct osmo_sccp_instance *inst, struct xua_msg *xua,
- const struct osmo_sccp_addr *called)
+static int scrc_node_2(struct osmo_sccp_instance *inst, struct xua_msg *xua)
{
- /* Node 2 on Sheet 5, only CO */
+ struct osmo_sccp_addr called;
+ int rc;
+
+ rc = sua_addr_parse(&called, xua, SUA_IEI_DEST_ADDR);
+ if (rc < 0) {
+ LOGPSCI(inst, LOGL_ERROR, "XUA Message %s without valid DEST_ADDR\n",
+ xua_hdr_dump(xua, &xua_dialect_sua));
+ return -EINVAL;
+ }
+
/* Is DPC accessible? */
- if (!dpc_accessible(inst, called->pc)) {
+ if (!dpc_accessible(inst, called.pc)) {
/* Error: MTP Failure */
/* Routing Failure SCRC -> SCOC */
sccp_scoc_rx_scrc_rout_fail(inst, xua,
@@ -258,14 +266,14 @@
return 0;
}
/* Is SCCP available? */
- if (!sccp_available(inst, called)) {
+ if (!sccp_available(inst, &called)) {
/* Error: SCCP Failure */
/* Routing Failure SCRC -> SCOC */
sccp_scoc_rx_scrc_rout_fail(inst, xua,
SCCP_RETURN_CAUSE_SCCP_FAILURE);
return 0;
}
- return scrc_node_12(inst, xua, called);
+ return scrc_node_12(inst, xua, &called);
}
static int scrc_node_7(struct osmo_sccp_instance *inst,
@@ -448,6 +456,15 @@
LOGPSCI(inst, LOGL_DEBUG, "%s: %s\n", __func__, xua_msg_dump(xua, &xua_dialect_sua));
+ /* Is this a CR message ? */
+ if (xua->hdr.msg_type != SUA_CO_CORE)
+ return scrc_node_2(inst, xua);
+
+#if 0
+ if (/* TODO: Coupling performed (not supported) */)
+ return scrc_node_2(inst, xua);
+#endif
+
rc = sua_addr_parse(&called, xua, SUA_IEI_DEST_ADDR);
if (rc < 0) {
LOGPSCI(inst, LOGL_ERROR, "XUA Message %s without valid DEST_ADDR\n",
@@ -455,15 +472,6 @@
return -EINVAL;
}
- /* Is this a CR message ? */
- if (xua->hdr.msg_type != SUA_CO_CORE)
- return scrc_node_2(inst, xua, &called);
-
- /* TOOD: Coupling performed (not supported) */
- if (0) {
- return scrc_node_2(inst, xua, &called);
- }
-
return scrc_local_out_common(inst, xua, &called);
}
To view, visit change 40291. To unsubscribe, or for help writing mail filters, visit settings.