pespin submitted this change.
hnbgw: Fix wrong map object retrieved from hashtable
If several map objects (mapping between RUA and SCCP transports for a
given Iu connection) ended up in the same hashtable bucket, then the
first one was always returned by map_from_conn_id().
As a result, when such collisions happened (e.g. when a big number of
connections were inserted) a user could see a Iu message coming from SCCP
connection "A" end up being forwarded to an unrelated RUA connection
"B".
Related: SYS#6602
Fixes: f3caea850bc892551cd09bbaf49f798c172590c4
Change-Id: I107f461bf5bcb92262422c893b23d190659f6f72
---
M src/osmo-hnbgw/hnbgw_cn.c
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c
index b984a8e..a74b6d7 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -447,8 +447,10 @@
const struct osmo_prim_hdr *oph)
{
struct hnbgw_context_map *map;
- hash_for_each_possible(hsu->hnbgw_context_map_by_conn_id, map, hnbgw_sccp_user_entry, conn_id)
- return map;
+ hash_for_each_possible(hsu->hnbgw_context_map_by_conn_id, map, hnbgw_sccp_user_entry, conn_id) {
+ if (map->scu_conn_id == conn_id)
+ return map;
+ }
LOGP(DRANAP, LOGL_ERROR, "Rx for unknown SCCP connection ID: %u: %s\n",
conn_id, osmo_scu_prim_hdr_name_c(OTC_SELECT, oph));
return NULL;
To view, visit change 38669. To unsubscribe, or for help writing mail filters, visit settings.