From 1e9f4f5432fff3ff96d23b16252dd865b9e7aa62 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 24 Dec 2017 23:57:58 +0100 Subject: rua_to_scu(): don't create a context map for UNITDATA UNITDATA is connection-less, and as can be observed further below, the 'map' doesn't get used in the N_UNIDATA case. Related: OS#2776 Change-Id: Ic35562e6d7bfa54b6be859860657f9a235ad5a50 --- src/hnbgw_rua.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c index 1d0ffbd..58bb23b 100644 --- a/src/hnbgw_rua.c +++ b/src/hnbgw_rua.c @@ -213,13 +213,21 @@ static int rua_to_scu(struct hnb_context *hnb, prim = (struct osmo_scu_prim *) msgb_put(msg, sizeof(*prim)); osmo_prim_init(&prim->oph, SCCP_SAP_USER, type, PRIM_OP_REQUEST, msg); - map = context_map_alloc_by_hnb(hnb, context_id, is_ps, cn); - OSMO_ASSERT(map); - - DEBUGP(DRUA, "rua_to_scu() %s to %s, rua_ctx_id %u scu_conn_id %u\n", - cn_domain_indicator_to_str(cN_DomainIndicator), - osmo_sccp_addr_dump(remote_addr), - map->rua_ctx_id, map->scu_conn_id); + switch (type) { + case OSMO_SCU_PRIM_N_UNITDATA: + DEBUGP(DRUA, "rua_to_scu() %s to %s, rua_ctx_id %u (unitdata, no scu_conn_id)\n", + cn_domain_indicator_to_str(cN_DomainIndicator), + osmo_sccp_addr_dump(remote_addr), + map->rua_ctx_id); + break; + default: + map = context_map_alloc_by_hnb(hnb, context_id, is_ps, cn); + OSMO_ASSERT(map); + DEBUGP(DRUA, "rua_to_scu() %s to %s, rua_ctx_id %u scu_conn_id %u\n", + cn_domain_indicator_to_str(cN_DomainIndicator), + osmo_sccp_addr_dump(remote_addr), + map->rua_ctx_id, map->scu_conn_id); + } /* add primitive header */ switch (type) { @@ -263,7 +271,7 @@ static int rua_to_scu(struct hnb_context *hnb, rc = osmo_sccp_user_sap_down(cn->sccp_user, &prim->oph); - if (release_context_map) + if (map && release_context_map) context_map_deactivate(map); return rc; -- cgit v1.2.3