fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/32185 )
Change subject: xua_rkm: handle_rkey_reg(): properly handle Routing Context IE ......................................................................
xua_rkm: handle_rkey_reg(): properly handle Routing Context IE
Function xua_msg_get_u32() may return 0 in two cases:
* if the given IEI is present and contains value 0, * if the given IEI is not present.
The Routing Context IE may contain value 0, which is a valid value. Use xua_msg_find_tag() to check presence of this IE unambiguously.
Change-Id: Ide7b1d62cc78effdda9950112f495c9ca276cae5 Fixes: OS#5990 --- M src/xua_rkm.c 1 file changed, 22 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/85/32185/1
diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 6abd17d..7203ee7 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -159,8 +159,6 @@
/* mandatory local routing key ID */ rk_id = xua_msg_get_u32(inner, M3UA_IEI_LOC_RKEY_ID); - /* ASP may already include a routing context value here */ - rctx = xua_msg_get_u32(inner, M3UA_IEI_ROUTE_CTX);
/* traffic mode type (0 = undefined) */ _tmode = xua_msg_get_u32(inner, M3UA_IEI_TRAF_MODE_TYP); @@ -187,9 +185,10 @@ return -1; }
- /* if the ASP did not include a routing context number, allocate - * one locally (will be part of response) */ - if (!rctx) + /* ASP may optionally include a routing context value here */ + if (xua_msg_find_tag(inner, M3UA_IEI_ROUTE_CTX) != NULL) + rctx = xua_msg_get_u32(inner, M3UA_IEI_ROUTE_CTX); + else /* ... if not included, allocate one locally (will be part of response) */ rctx = osmo_ss7_find_free_rctx(asp->inst);
LOGPASP(asp, DLSS7, LOGL_INFO, "RKM: Registering routing key %u for DPC %s\n",