pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42567?usp=email )
Change subject: xua_rkm: send_reg_req: Avoid adding Routing Context with value 0 ......................................................................
xua_rkm: send_reg_req: Avoid adding Routing Context with value 0
We use routing context 0 internally as "no routing context". Since the Routing Context in the Routing KEy IE in RKM REG REQ is optional, if local rctx is 0 (because we expect to get one allocated by the STP and receive it through RKM REG RESP), avoid sending it with the value 0.
Change-Id: Iaa584fea3020af06951aea16e638ac6e6a84ae21 --- M src/xua_rkm.c 1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/67/42567/1
diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 2e7c227..16b494b 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -120,13 +120,18 @@ { struct msgb *msg = m3ua_msgb_alloc(__func__); int tmod = osmo_ss7_tmode_to_xua(traf_mode); + uint16_t outter_len;
/* One individual Registration Request according to Chapter 3.6.1 */ msgb_put_u16(msg, M3UA_IEI_ROUT_KEY); /* outer IEI */ - msgb_put_u16(msg, 32 + 4); /* outer length */ + outter_len = 24 + 4; + if (rkey->context > 0) + outter_len += 8; + msgb_put_u16(msg, outter_len); /* outer length */ /* nested IEIs */ msgb_t16l16vp_put_u32(msg, M3UA_IEI_LOC_RKEY_ID, rkey->l_rk_id); - msgb_t16l16vp_put_u32(msg, M3UA_IEI_ROUTE_CTX, rkey->context); + if (rkey->context > 0) + msgb_t16l16vp_put_u32(msg, M3UA_IEI_ROUTE_CTX, rkey->context); msgb_t16l16vp_put_u32(msg, M3UA_IEI_TRAF_MODE_TYP, tmod); msgb_t16l16vp_put_u32(msg, M3UA_IEI_DEST_PC, rkey->pc);