Attention is currently required from: pespin.
fixeria has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39979?usp=email )
Change subject: hnbap: Make hnbgw_tx_ue_register_acc_tmsi() signature similar to hnbgw_tx_ue_register_acc()
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39979?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I9ce01babda7cb7e415cb7514c26f10a1773166fa
Gerrit-Change-Number: 39979
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 08 Apr 2025 20:42:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/39987?usp=email
to look at the new patch set (#2).
Change subject: Move DL CL RANAP processing logic to its proper layer file
......................................................................
Move DL CL RANAP processing logic to its proper layer file
This way we effectively split lower layers (SCCP and below) related to
the link towards CN from the RANAP payload we need to process and
forward.
Change-Id: Icf18fe66d0483165fe487fe850b25830faf90150
---
M include/osmocom/hnbgw/hnbgw_ranap.h
M src/osmo-hnbgw/hnbgw_cn.c
M src/osmo-hnbgw/hnbgw_ranap.c
3 files changed, 215 insertions(+), 205 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/87/39987/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39987?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Icf18fe66d0483165fe487fe850b25830faf90150
Gerrit-Change-Number: 39987
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39988?usp=email )
Change subject: Move DL CO RANAP processing to its proper layer file
......................................................................
Move DL CO RANAP processing to its proper layer file
Change-Id: Ifcb8a23becb57ccad6c9aa4769b6f27d31a71c96
---
M include/osmocom/hnbgw/hnbgw_ranap.h
M src/osmo-hnbgw/context_map_sccp.c
M src/osmo-hnbgw/hnbgw_ranap.c
3 files changed, 100 insertions(+), 87 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/88/39988/1
diff --git a/include/osmocom/hnbgw/hnbgw_ranap.h b/include/osmocom/hnbgw/hnbgw_ranap.h
index 4317ece..2e77246 100644
--- a/include/osmocom/hnbgw/hnbgw_ranap.h
+++ b/include/osmocom/hnbgw/hnbgw_ranap.h
@@ -8,5 +8,6 @@
int hnbgw_ranap_rx_udt_ul(struct msgb *msg, uint8_t *data, size_t len);
int hnbgw_ranap_rx_udt_dl(struct hnbgw_cnlink *cnlink, const struct osmo_scu_unitdata_param *unitdata,
const uint8_t *data, unsigned int len);
+int hnbgw_ranap_rx_data_dl(struct hnbgw_context_map *map, struct msgb *ranap_msg);
int hnbgw_ranap_init(void);
diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c
index fc82426..42a0e49 100644
--- a/src/osmo-hnbgw/context_map_sccp.c
+++ b/src/osmo-hnbgw/context_map_sccp.c
@@ -27,18 +27,10 @@
#include <osmocom/sigtran/sccp_helpers.h>
-#include <osmocom/ranap/ranap_common_ran.h>
-
-#if ENABLE_PFCP
-#include <osmocom/pfcp/pfcp_cp_peer.h>
-#endif
-
#include <osmocom/hnbgw/hnbgw_cn.h>
#include <osmocom/hnbgw/context_map.h>
+#include <osmocom/hnbgw/hnbgw_ranap.h>
#include <osmocom/hnbgw/tdefs.h>
-#include <osmocom/hnbgw/mgw_fsm.h>
-#include <osmocom/hnbgw/ps_rab_ass_fsm.h>
-#include <osmocom/hnbgw/kpi.h>
enum map_sccp_fsm_state {
MAP_SCCP_ST_INIT,
@@ -187,32 +179,6 @@
return osmo_sccp_tx_disconn(map->cnlink->hnbgw_sccp_user->sccp_user, map->scu_conn_id, NULL, 0);
}
-static int destruct_ranap_ran_rx_co_ies(ranap_message *ranap_message_p)
-{
- ranap_ran_rx_co_free(ranap_message_p);
- return 0;
-}
-
-/* Decode DL RANAP message with convenient memory freeing: just talloc_free() the returned pointer..
- * Allocate a ranap_message from OTC_SELECT, decode RANAP msgb into it, attach a talloc destructor that calls
- * ranap_cn_rx_co_free() upon talloc_free(), and return the decoded ranap_message. */
-static ranap_message *hnbgw_decode_ranap_ran_co(struct msgb *ranap_msg)
-{
- int rc;
- ranap_message *message;
-
- if (!msg_has_l2_data(ranap_msg))
- return NULL;
- message = talloc_zero(OTC_SELECT, ranap_message);
- rc = ranap_ran_rx_co_decode(NULL, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
- if (rc != 0) {
- talloc_free(message);
- return NULL;
- }
- talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
- return message;
-}
-
static int handle_rx_sccp(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
{
struct hnbgw_context_map *map = fi->priv;
@@ -225,58 +191,7 @@
if (!msg_has_l2_data(ranap_msg))
return 0;
- /* See if it is a RAB Assignment Request message from SCCP to RUA, where we need to change the user plane
- * information, for RTP mapping via MGW, or GTP mapping via UPF. */
- ranap_message *message = hnbgw_decode_ranap_ran_co(ranap_msg);
- if (message) {
- talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
-
- LOGPFSML(fi, LOGL_DEBUG, "rx from SCCP: RANAP %s\n",
- get_value_string(ranap_procedure_code_vals, message->procedureCode));
-
- kpi_ranap_process_dl(map, message);
-
- if (!map->is_ps) {
- /* Circuit-Switched. Set up mapping of RTP ports via MGW */
-
- switch (message->procedureCode) {
- case RANAP_ProcedureCode_id_RAB_Assignment:
- /* mgw_fsm_alloc_and_handle_rab_ass_req() takes ownership of (ranap) message */
- return handle_cs_rab_ass_req(map, ranap_msg, message);
- case RANAP_ProcedureCode_id_Iu_Release:
- /* Any IU Release will terminate the MGW FSM, the message itsself is not passed to the
- * FSM code. It is just forwarded normally by map_rua_tx_dt() below. */
- mgw_fsm_release(map);
- break;
- }
-#if ENABLE_PFCP
- } else {
- switch (message->procedureCode) {
- case RANAP_ProcedureCode_id_RAB_Assignment:
- /* If a UPF is configured, handle the RAB Assignment via ps_rab_ass_fsm, and replace the
- * GTP F-TEIDs in the RAB Assignment message before passing it on to RUA. */
- if (hnb_gw_is_gtp_mapping_enabled()) {
- LOGP(DMAIN, LOGL_DEBUG,
- "RAB Assignment: setting up GTP tunnel mapping via UPF %s\n",
- osmo_sockaddr_to_str_c(OTC_SELECT, osmo_pfcp_cp_peer_get_remote_addr(g_hnbgw->pfcp.cp_peer)));
- return hnbgw_gtpmap_rx_rab_ass_req(map, ranap_msg, message);
- }
- /* If no UPF is configured, directly forward the message as-is (no GTP mapping). */
- LOGP(DMAIN, LOGL_DEBUG, "RAB Assignment: no UPF configured, forwarding as-is\n");
- break;
-
- case RANAP_ProcedureCode_id_Iu_Release:
- /* Any IU Release will terminate the MGW FSM, the message itsself is not passed to the
- * FSM code. It is just forwarded normally by map_rua_tx_dt() below. */
- hnbgw_gtpmap_release(map);
- break;
- }
-#endif
- }
- }
-
- /* It was not a RAB Assignment Request that needed to be intercepted. Forward as-is to RUA. */
- return map_rua_dispatch(map, MAP_RUA_EV_TX_DIRECT_TRANSFER, ranap_msg);
+ return hnbgw_ranap_rx_data_dl(map, ranap_msg);
}
static void map_sccp_init_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/osmo-hnbgw/hnbgw_ranap.c b/src/osmo-hnbgw/hnbgw_ranap.c
index d795264..666560c 100644
--- a/src/osmo-hnbgw/hnbgw_ranap.c
+++ b/src/osmo-hnbgw/hnbgw_ranap.c
@@ -18,6 +18,8 @@
*
*/
+#include "config.h"
+
#include <unistd.h>
#include <errno.h>
#include <string.h>
@@ -28,12 +30,21 @@
#include <osmocom/core/utils.h>
#include <osmocom/ranap/ranap_common.h>
+#include <osmocom/ranap/ranap_common_ran.h>
#include <osmocom/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_msg_factory.h>
+#if ENABLE_PFCP
+#include <osmocom/pfcp/pfcp_cp_peer.h>
+#endif
+
#include <osmocom/hnbgw/hnbgw.h>
#include <osmocom/hnbgw/hnbgw_rua.h>
#include <osmocom/hnbgw/hnbgw_cn.h>
+#include <osmocom/hnbgw/context_map.h>
+#include <osmocom/hnbgw/mgw_fsm.h>
+#include <osmocom/hnbgw/ps_rab_ass_fsm.h>
+#include <osmocom/hnbgw/kpi.h>
/*****************************************************************************
* Processing of RANAP from the endpoint towards RAN (hNodeB), acting as CN
@@ -410,6 +421,92 @@
return rc;
}
+static int destruct_ranap_ran_rx_co_ies(ranap_message *ranap_message_p)
+{
+ ranap_ran_rx_co_free(ranap_message_p);
+ return 0;
+}
+
+/* Decode DL RANAP message with convenient memory freeing: just talloc_free() the returned pointer..
+ * Allocate a ranap_message from OTC_SELECT, decode RANAP msgb into it, attach a talloc destructor that calls
+ * ranap_cn_rx_co_free() upon talloc_free(), and return the decoded ranap_message. */
+static ranap_message *hnbgw_decode_ranap_ran_co(struct msgb *ranap_msg)
+{
+ int rc;
+ ranap_message *message;
+
+ if (!msg_has_l2_data(ranap_msg))
+ return NULL;
+ message = talloc_zero(OTC_SELECT, ranap_message);
+ rc = ranap_ran_rx_co_decode(NULL, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
+ if (rc != 0) {
+ talloc_free(message);
+ return NULL;
+ }
+ talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
+ return message;
+}
+
+/* Process a received RANAP PDU through SCCP DATA.ind coming from CN (MSC/SGSN)
+ * Takes ownership of ranap_msg? */
+int hnbgw_ranap_rx_data_dl(struct hnbgw_context_map *map, struct msgb *ranap_msg)
+{
+ OSMO_ASSERT(map);
+ OSMO_ASSERT(msg_has_l2_data(ranap_msg));
+
+ /* See if it is a RAB Assignment Request message from SCCP to RUA, where we need to change the user plane
+ * information, for RTP mapping via MGW, or GTP mapping via UPF. */
+ ranap_message *message = hnbgw_decode_ranap_ran_co(ranap_msg);
+ if (message) {
+ talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
+
+ LOG_MAP(map, DCN, LOGL_DEBUG, "rx from SCCP: RANAP %s\n",
+ get_value_string(ranap_procedure_code_vals, message->procedureCode));
+
+ kpi_ranap_process_dl(map, message);
+
+ if (!map->is_ps) {
+ /* Circuit-Switched. Set up mapping of RTP ports via MGW */
+ switch (message->procedureCode) {
+ case RANAP_ProcedureCode_id_RAB_Assignment:
+ /* mgw_fsm_alloc_and_handle_rab_ass_req() takes ownership of (ranap) message */
+ return handle_cs_rab_ass_req(map, ranap_msg, message);
+ case RANAP_ProcedureCode_id_Iu_Release:
+ /* Any IU Release will terminate the MGW FSM, the message itsself is not passed to the
+ * FSM code. It is just forwarded normally by map_rua_tx_dt() below. */
+ mgw_fsm_release(map);
+ break;
+ }
+#if ENABLE_PFCP
+ } else {
+ switch (message->procedureCode) {
+ case RANAP_ProcedureCode_id_RAB_Assignment:
+ /* If a UPF is configured, handle the RAB Assignment via ps_rab_ass_fsm, and replace the
+ * GTP F-TEIDs in the RAB Assignment message before passing it on to RUA. */
+ if (hnb_gw_is_gtp_mapping_enabled()) {
+ LOG_MAP(map, DCN, LOGL_DEBUG,
+ "RAB Assignment: setting up GTP tunnel mapping via UPF %s\n",
+ osmo_sockaddr_to_str_c(OTC_SELECT, osmo_pfcp_cp_peer_get_remote_addr(g_hnbgw->pfcp.cp_peer)));
+ return hnbgw_gtpmap_rx_rab_ass_req(map, ranap_msg, message);
+ }
+ /* If no UPF is configured, directly forward the message as-is (no GTP mapping). */
+ LOG_MAP(map, DCN, LOGL_DEBUG, "RAB Assignment: no UPF configured, forwarding as-is\n");
+ break;
+
+ case RANAP_ProcedureCode_id_Iu_Release:
+ /* Any IU Release will terminate the MGW FSM, the message itsself is not passed to the
+ * FSM code. It is just forwarded normally by map_rua_tx_dt() below. */
+ hnbgw_gtpmap_release(map);
+ break;
+ }
+#endif
+ }
+ }
+
+ /* It was not a RAB Assignment Request that needed to be intercepted. Forward as-is to RUA. */
+ return map_rua_dispatch(map, MAP_RUA_EV_TX_DIRECT_TRANSFER, ranap_msg);
+}
+
int hnbgw_ranap_init(void)
{
return 0;
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39988?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ifcb8a23becb57ccad6c9aa4769b6f27d31a71c96
Gerrit-Change-Number: 39988
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39984?usp=email )
Change subject: Add function helper hnbgw_decode_ranap_ran_co()
......................................................................
Patch Set 1:
(2 comments)
File src/osmo-hnbgw/context_map_sccp.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/39984/comment/e5bcf503_35e16300?u… :
PS1, Line 207: rc = ranap_ran_rx_co_decode(NULL, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
THis function is RAN specific. The CN side is using ranap_cn_rx_co_decode().
https://gerrit.osmocom.org/c/osmo-hnbgw/+/39984/comment/1711a4c0_46c0764a?u… :
PS1, Line 212: talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
destruct_ranap_ran_rx_co_ies() too, which calls RAN specific ranap_ran_rx_co_free().
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39984?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ifbb058d5340a6cb3a1703415e49c0de04fa6aec1
Gerrit-Change-Number: 39984
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 08 Apr 2025 18:16:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39983?usp=email )
Change subject: Rename function s/hnbgw_decode_ranap_co/hnbgw_decode_ranap_cn_co/g
......................................................................
Patch Set 1:
(2 comments)
File src/osmo-hnbgw/context_map_rua.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/39983/comment/df1321d5_af5483a7?u… :
PS1, Line 140: hnbgw_decode_ranap_cn_co
> now I'm confused. _cn_ seems to indicate from the core network. […]
That's how all code in osmo-iuh is named.
My understanding is that "cn" means "we decode from CN point of view". That means decoding UL traffic and transmitting DL traffic.
In the HNBGW case, that means when traffic comes from RUA we are the "CN" and hence we decode UL traffic and transmit DL traffic.
https://gerrit.osmocom.org/c/osmo-hnbgw/+/39983/comment/939d6a7a_4ff40868?u… :
PS1, Line 148: rc = ranap_cn_rx_co_decode2(message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
See how it matches this osmo-iuh naming. "cn".
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/39983?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ia4e5a21a9724ebf759b62c13759a776189b09e91
Gerrit-Change-Number: 39983
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 08 Apr 2025 18:15:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>