From ee0bcf2fca87513ba8065d025ebd062bd6940399 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 3 Apr 2019 14:26:17 +0200 Subject: sccp_scoc: move sccp_find_user() up Move it before sccp_scoc_rx_scrc_rout_fail(), so it can be used in the latter function to figure out the local_ref from the user (follow up commit). Related: OS#3871 Change-Id: Ieabeda3126dcc0349a06c0fc7c9e468b900d7855 --- src/sccp_scoc.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c index 726426c..82590a0 100644 --- a/src/sccp_scoc.c +++ b/src/sccp_scoc.c @@ -1329,6 +1329,31 @@ static struct xua_msg *gen_coref_without_conn(struct osmo_sccp_instance *inst, return xua; } +/* Find a SCCP user for given SUA message (based on SUA_IEI_DEST_ADDR */ +static struct osmo_sccp_user *sccp_find_user(struct osmo_sccp_instance *inst, + struct xua_msg *xua) +{ + int rc; + struct osmo_sccp_addr called_addr; + + rc = sua_addr_parse(&called_addr, xua, SUA_IEI_DEST_ADDR); + if (rc < 0) { + LOGP(DLSCCP, LOGL_ERROR, "Cannot find SCCP User for XUA " + "Message %s without valid DEST_ADDR\n", + xua_hdr_dump(xua, &xua_dialect_sua)); + return NULL; + } + + if (!(called_addr.presence & OSMO_SCCP_ADDR_T_SSN)) { + LOGP(DLSCCP, LOGL_ERROR, "Cannot resolve SCCP User for " + "XUA Message %s without SSN in CalledAddr\n", + xua_hdr_dump(xua, &xua_dialect_sua)); + return NULL; + } + + return sccp_user_find(inst, called_addr.ssn, called_addr.pc); +} + /*! \brief SCOC: Receive SCRC Routing Failure * \param[in] inst SCCP Instance on which we operate * \param[in] xua SUA message that was failed to route @@ -1355,31 +1380,6 @@ void sccp_scoc_rx_scrc_rout_fail(struct osmo_sccp_instance *inst, } } -/* Find a SCCP user for given SUA message (based on SUA_IEI_DEST_ADDR */ -static struct osmo_sccp_user *sccp_find_user(struct osmo_sccp_instance *inst, - struct xua_msg *xua) -{ - int rc; - struct osmo_sccp_addr called_addr; - - rc = sua_addr_parse(&called_addr, xua, SUA_IEI_DEST_ADDR); - if (rc < 0) { - LOGP(DLSCCP, LOGL_ERROR, "Cannot find SCCP User for XUA " - "Message %s without valid DEST_ADDR\n", - xua_hdr_dump(xua, &xua_dialect_sua)); - return NULL; - } - - if (!(called_addr.presence & OSMO_SCCP_ADDR_T_SSN)) { - LOGP(DLSCCP, LOGL_ERROR, "Cannot resolve SCCP User for " - "XUA Message %s without SSN in CalledAddr\n", - xua_hdr_dump(xua, &xua_dialect_sua)); - return NULL; - } - - return sccp_user_find(inst, called_addr.ssn, called_addr.pc); -} - /* Generate a COERR based in input arguments */ static struct xua_msg *gen_coerr(uint32_t route_ctx, uint32_t dest_ref, uint32_t err_cause) -- cgit v1.2.3