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
This commit is contained in:
Neels Hofmeyr 2017-12-24 23:57:58 +01:00
parent b10e2937d9
commit 1e9f4f5432
1 changed files with 16 additions and 8 deletions

View File

@ -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;