This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/2308
to look at the new patch set (#2).
osmo_ss7: Allocate local routing key ID and use it as lookup key for AS
In M3UA RKM we need a "Local Routing Key ID" which uniquely identifies a
given routing key locally at the node. Allocate this value and store it
in each osmo_ss7_as, as well as add a lookup function for it.
Change-Id: I89a0abcf66228ce092126a497cc7971df3a6af71
---
M include/osmocom/sigtran/osmo_ss7.h
M include/osmocom/sigtran/sigtran_sap.h
M src/osmo_ss7.c
3 files changed, 45 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/08/2308/2
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index bb151d1..5becc0e 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -225,6 +225,7 @@
struct osmo_ss7_routing_key {
uint32_t context;
+ uint32_t l_rk_id;
uint32_t pc;
uint8_t si;
@@ -291,6 +292,8 @@
struct osmo_ss7_as *
osmo_ss7_as_find_by_rctx(struct osmo_ss7_instance *inst, uint32_t rctx);
struct osmo_ss7_as *
+osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id);
+struct osmo_ss7_as *
osmo_ss7_as_find_or_create(struct osmo_ss7_instance *inst, const char *name,
enum osmo_ss7_asp_protocol proto);
int osmo_ss7_as_add_asp(struct osmo_ss7_as *as, const char *asp_name);
diff --git a/include/osmocom/sigtran/sigtran_sap.h b/include/osmocom/sigtran/sigtran_sap.h
index d18aa3d..80cfefc 100644
--- a/include/osmocom/sigtran/sigtran_sap.h
+++ b/include/osmocom/sigtran/sigtran_sap.h
@@ -1,5 +1,6 @@
#pragma once
#include <osmocom/core/prim.h>
+#include <osmocom/sigtran/osmo_ss7.h>
enum osmo_sigtran_sap {
@@ -46,6 +47,16 @@
uint32_t code;
};
+struct osmo_xlm_prim_rk_reg {
+ /* routing key */
+ struct osmo_ss7_routing_key key;
+ enum osmo_ss7_as_traffic_mode traf_mode;
+};
+
+struct osmo_xlm_prim_rk_dereg {
+ uint32_t route_ctx;
+};
+
struct osmo_xlm_prim {
struct osmo_prim_hdr oph;
union {
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 78ff3ec..f935dd6 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -54,6 +54,7 @@
static LLIST_HEAD(ss7_instances);
static LLIST_HEAD(ss7_xua_servers);
static int32_t next_rctx = 1;
+static int32_t next_l_rk_id = 1;
struct value_string osmo_ss7_as_traffic_mode_vals[] = {
{ OSMO_SS7_AS_TMOD_BCAST, "broadcast" },
@@ -83,6 +84,18 @@
}
return -1;
}
+
+static uint32_t find_free_l_rk_id(struct osmo_ss7_instance *inst)
+{
+ uint32_t l_rk_id;
+
+ for (l_rk_id = next_l_rk_id; next_l_rk_id; l_rk_id = ++next_l_rk_id) {
+ if (!osmo_ss7_as_find_by_l_rk_id(inst, next_l_rk_id))
+ return l_rk_id;
+ }
+ return -1;
+}
+
/***********************************************************************
* SS7 Point Code Parsing / Printing
@@ -765,6 +778,23 @@
return NULL;
}
+/*! \brief Find Application Server by given local routing key ID
+ * \param[in] inst SS7 Instance on which we operate
+ * \param[in] l_rk_id Local Routing Key ID
+ * \returns pointer to Application Server on success; NULL otherwise */
+struct osmo_ss7_as *
+osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id)
+{
+ struct osmo_ss7_as *as;
+
+ OSMO_ASSERT(ss7_initialized);
+ llist_for_each_entry(as, &inst->as_list, list) {
+ if (as->cfg.routing_key.l_rk_id == l_rk_id)
+ return as;
+ }
+ return NULL;
+}
+
/*! \brief Find or Create Application Server
* \param[in] inst SS7 Instance on which we operate
* \param[in] name Name of Application Server
@@ -792,6 +822,7 @@
as->cfg.proto = proto;
as->cfg.mode = OSMO_SS7_AS_TMOD_LOADSHARE;
as->cfg.recovery_timeout_msec = 2000;
+ as->cfg.routing_key.l_rk_id = find_free_l_rk_id(inst);
as->fi = xua_as_fsm_start(as, LOGL_DEBUG);
llist_add_tail(&as->list, &inst->as_list);
}
--
To view, visit https://gerrit.osmocom.org/2308
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I89a0abcf66228ce092126a497cc7971df3a6af71
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder