osmith submitted this change.
Make subscr_conn_get_next_id RAN specific
Instead of having RAN/CN as parameter, make the function a bit simpler
and only allow RAN. The motivation for this change is, that for MGW a
similar function is required, and it was recommended in code review to
rather duplicate the short function instead of making it more complex.
I'm dropping the CN part here since it wasn't used anyway, and if used
in the future, the function could be duplicated for CN as well.
Related: SYS#5560
Change-Id: I77b0ef33f94c401d24f38eb8d79e1007234e0ab4
---
M include/osmocom/bsc_nat/subscr_conn.h
M src/osmo-bsc-nat/bsc_nat_fsm.c
M src/osmo-bsc-nat/subscr_conn.c
3 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/include/osmocom/bsc_nat/subscr_conn.h b/include/osmocom/bsc_nat/subscr_conn.h
index 7de3f0f..02a0019 100644
--- a/include/osmocom/bsc_nat/subscr_conn.h
+++ b/include/osmocom/bsc_nat/subscr_conn.h
@@ -36,7 +36,7 @@
} ran;
};
-int subscr_conn_get_next_id(enum bsc_nat_net net);
+int subscr_conn_get_next_id_ran();
struct subscr_conn *subscr_conn_alloc(struct msc *msc, struct bsc *bsc, uint32_t id_cn, uint32_t id_ran);
diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c
index 22413ef..2a32c9d 100644
--- a/src/osmo-bsc-nat/bsc_nat_fsm.c
+++ b/src/osmo-bsc-nat/bsc_nat_fsm.c
@@ -200,7 +200,7 @@
goto error;
}
- subscr_conn = subscr_conn_alloc(msc, bsc, subscr_conn_get_next_id(BSC_NAT_NET_CN), prim->u.connect.conn_id);
+ subscr_conn = subscr_conn_alloc(msc, bsc, subscr_conn_get_next_id_ran(), prim->u.connect.conn_id);
LOGP(DMAIN, LOGL_DEBUG, "Fwd via %s\n", talloc_get_name(subscr_conn));
diff --git a/src/osmo-bsc-nat/subscr_conn.c b/src/osmo-bsc-nat/subscr_conn.c
index 02afb7d..a94287c 100644
--- a/src/osmo-bsc-nat/subscr_conn.c
+++ b/src/osmo-bsc-nat/subscr_conn.c
@@ -26,15 +26,9 @@
#include <osmocom/bsc_nat/subscr_conn.h>
#include <osmocom/bsc_nat/logging.h>
-/* Get the next available id in either CN or RAN. */
-int subscr_conn_get_next_id(enum bsc_nat_net net)
+int subscr_conn_get_next_id_ran()
{
- uint32_t *id;
-
- if (net == BSC_NAT_NET_RAN)
- id = &g_bsc_nat->ran.subscr_conn_id_next;
- else
- id = &g_bsc_nat->cn.subscr_conn_id_next;
+ uint32_t *id = &g_bsc_nat->ran.subscr_conn_id_next;
for (int i = 0; i < 0xFFFFFF; i++) {
struct subscr_conn *subscr_conn;
@@ -43,8 +37,7 @@
*id = (*id + 1) & 0xffffff;
llist_for_each_entry(subscr_conn, &g_bsc_nat->subscr_conns, list) {
- if ((net == BSC_NAT_NET_RAN && subscr_conn->ran.id == *id)
- || (net == BSC_NAT_NET_CN && subscr_conn->cn.id == *id)) {
+ if (*id == subscr_conn->ran.id) {
already_used = true;
break;
}
To view, visit change 27711. To unsubscribe, or for help writing mail filters, visit settings.