pespin submitted this change.

View Change

Approvals: pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
xua_rkm: handle_rkey_reg(): Skip AS ilookup of known free RCTX

There's no need to attempt a look up for an AS with a RCTX we just
ensured is not yet allocated to any AS.

Change-Id: I40719527c527db58244972a797c4287107306532
---
M src/xua_rkm.c
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index d6dfa51..e9972b3 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -171,7 +171,7 @@
{
uint32_t rk_id, rctx, _tmode, dpc;
enum osmo_ss7_as_traffic_mode tmode;
- struct osmo_ss7_as *as;
+ struct osmo_ss7_as *as = NULL;
struct ss7_as_asp_assoc *assoc;
struct osmo_ss7_route *rt;
char namebuf[32];
@@ -211,14 +211,6 @@
return -1;
}

- /* if the ASP did not include a routing context number, allocate
- * one locally (will be part of response) */
- if (!rctx)
- rctx = osmo_ss7_find_free_rctx(asp->inst);
-
- LOGPASP(asp, DLSS7, LOGL_INFO, "RKM: Registering routing key %u for DPC %s\n",
- rctx, osmo_ss7_pointcode_print(asp->inst, dpc));
-
/* We have two cases here:
* a) pre-configured routing context on both ASP and SG (or IPSP peers):
* We will find the AS based on the RCTX send by the client, check if
@@ -231,8 +223,17 @@
* all AS/RK in situations where the peers are trusted.
*/

- /* check if there is already an AS for this routing key */
- as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ if (rctx) {
+ /* check if there is already an AS for this routing key */
+ as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ } else {
+ /* if the ASP did not include a routing context number, 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",
+ rctx, osmo_ss7_pointcode_print(asp->inst, dpc));

if (!as && !asp->inst->cfg.permit_dyn_rkm_alloc) {
/* not permitted to create dynamic RKM entries */

To view, visit change 42531. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I40719527c527db58244972a797c4287107306532
Gerrit-Change-Number: 42531
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>