neels has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/28827 )
Change subject: reduce code dup in handle_cn_data_ind()
......................................................................
reduce code dup in handle_cn_data_ind()
Change-Id: I4bca25d1643693cf3a9d3c49f35b29ff1dce0859
---
M src/osmo-hnbgw/hnbgw_cn.c
1 file changed, 11 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/27/28827/1
diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c
index 75b1c94..0f1ed07 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -370,12 +370,11 @@
}
/* Intercept RAB Assignment Request, to map RTP and GTP between access and core */
- if (!map->is_ps) {
- /* Circuit-Switched. Set up mapping of RTP ports via MGW */
- message = talloc_zero(map, ranap_message);
- rc = ranap_ran_rx_co_decode(map, message, msgb_l2(oph->msg),
msgb_l2len(oph->msg));
-
- if (rc == 0) {
+ message = talloc_zero(map, ranap_message);
+ rc = ranap_ran_rx_co_decode(map, message, msgb_l2(oph->msg),
msgb_l2len(oph->msg));
+ if (rc == 0) {
+ 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 */
@@ -386,16 +385,8 @@
mgw_fsm_release(map);
break;
}
- ranap_ran_rx_co_free(message);
- }
-
- talloc_free(message);
- } else {
- /* Packet-Switched. Set up mapping of GTP ports via UPF */
- message = talloc_zero(map, ranap_message);
- rc = ranap_ran_rx_co_decode(map, message, msgb_l2(oph->msg),
msgb_l2len(oph->msg));
-
- if (rc == 0) {
+ } else {
+ /* Packet-Switched. Set up mapping of GTP ports via UPF */
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_RAB_Assignment:
@@ -412,16 +403,15 @@
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 the rua_tx_dt() call below. */
+ /* An IU Release will terminate the PFCP sessions for all RABs (ps_rab FSM
instances).
+ * Terminate all RABs and forward the IU Release directly by rua_tx_dt() below. */
hnbgw_gtpmap_release(map);
break;
}
- ranap_ran_rx_co_free(message);
}
-
- talloc_free(message);
+ ranap_ran_rx_co_free(message);
}
+ talloc_free(message);
return rua_tx_dt(map->hnb_ctx, map->is_ps, map->rua_ctx_id,
msgb_l2(oph->msg), msgb_l2len(oph->msg));
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/28827
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I4bca25d1643693cf3a9d3c49f35b29ff1dce0859
Gerrit-Change-Number: 28827
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange