fix regression: unbreak PFCP: PS RAB via UPF proxying

Fix PS RAB Assignment operation:
- add #include "config.h"
- fix uncompilable code in ENABLE_PFCP sections.

A series of oversights made me completely break PFCP / UPF operation for
PS RAB Assignments in this commit:
 'context map: introduce RUA and SCCP FSMs to fix leaks'
 ed424d5be4
 I6ff7e36532ff57c6f2d3e7e419dd22ef27dafd19

- In my HNBGW_Tests.ttcn, I used osmo-hnbgw-with-pfcp.cfg, but failed to
  set mp_enable_pfcp_tests := true in HNBGW_Tests.cfg.

- Hence I was under the impression that I was testing PFCP via UPF when
  really I wasn't. So I did not notice that:

- in the new files context_map_rua.c and context_map_sccp.c, the
  ENABLE_PFCP macro was always unset because I forgot to
  #include "config.h".

- Hence I did not notice that the moved PFCP RAB code was never once
  compiled or run.

My bad, that was really dumb.

Related: SYS#6297
Change-Id: I5df5073f0092ecdfd73d5d08207ca4042154eab1
This commit is contained in:
Neels Hofmeyr 2023-03-09 03:06:12 +01:00
parent 0fdb5c3f09
commit b5dfba79ca
4 changed files with 17 additions and 19 deletions

View File

@ -19,16 +19,23 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <osmocom/core/utils.h>
#include <osmocom/core/fsm.h>
#include <osmocom/ranap/ranap_common_cn.h>
#if ENABLE_PFCP
#include <osmocom/pfcp/pfcp_cp_peer.h>
#endif
#include <osmocom/hnbgw/hnbgw.h>
#include <osmocom/hnbgw/context_map.h>
#include <osmocom/hnbgw/tdefs.h>
#include <osmocom/hnbgw/hnbgw_rua.h>
#include <osmocom/hnbgw/mgw_fsm.h>
#include <osmocom/hnbgw/ps_rab_ass_fsm.h>
enum map_rua_fsm_state {
MAP_RUA_ST_INIT,
@ -142,7 +149,7 @@ static int handle_rx_rua(struct hnbgw_context_map *map, struct msgb *ranap_msg)
}
}
#if ENABLE_PFCP
} else if (hnb_gw_is_gtp_mapping_enabled(map->hnb_gw)) {
} else if (hnb_gw_is_gtp_mapping_enabled(map->gw)) {
/* map->is_ps == true and PFCP is enabled in osmo-hnbgw.cfg */
ranap_message *message = talloc_zero(OTC_SELECT, ranap_message);
rc = ranap_cn_rx_co_decode2(message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));

View File

@ -20,6 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <osmocom/core/utils.h>
#include <osmocom/core/fsm.h>
@ -27,10 +29,15 @@
#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/tdefs.h>
#include <osmocom/hnbgw/mgw_fsm.h>
#include <osmocom/hnbgw/ps_rab_ass_fsm.h>
enum map_sccp_fsm_state {
MAP_SCCP_ST_INIT,
@ -198,7 +205,6 @@ static int handle_rx_sccp(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
#if ENABLE_PFCP
} else {
ranap_message *message;
struct hnb_gw *hnb_gw = cnlink->gw;
/* Packet-Switched. Set up mapping of GTP ports via UPF */
message = talloc_zero(OTC_SELECT, ranap_message);
rc = ranap_ran_rx_co_decode(message, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
@ -211,10 +217,10 @@ static int handle_rx_sccp(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
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(hnb_gw)) {
if (hnb_gw_is_gtp_mapping_enabled(map->gw)) {
LOGP(DMAIN, LOGL_DEBUG,
"RAB Assignment: setting up GTP tunnel mapping via UPF %s\n",
osmo_sockaddr_to_str_c(OTC_SELECT, &hnb_gw->pfcp.cp_peer->remote_addr));
osmo_sockaddr_to_str_c(OTC_SELECT, &map->gw->pfcp.cp_peer->remote_addr));
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). */

View File

@ -31,21 +31,11 @@
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/sccp_helpers.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/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_msg_factory.h>
#include <osmocom/hnbgw/context_map.h>
#include <osmocom/hnbgw/mgw_fsm.h>
#include <osmocom/hnbgw/ps_rab_ass_fsm.h>
#include <osmocom/ranap/RANAP_ProcedureCode.h>
#include <osmocom/ranap/ranap_common.h>
#include <osmocom/ranap/ranap_common_ran.h>
#include <osmocom/ranap/RANAP_RANAP-PDU.h>
/***********************************************************************
* Outbound RANAP RESET to CN

View File

@ -39,11 +39,6 @@
#include <osmocom/rua/rua_ies_defs.h>
#include <osmocom/hnbgw/context_map.h>
#include <osmocom/hnbap/HNBAP_CN-DomainIndicator.h>
#include <osmocom/hnbgw/mgw_fsm.h>
#include <osmocom/hnbgw/ps_rab_ass_fsm.h>
#include <osmocom/ranap/RANAP_ProcedureCode.h>
#include <osmocom/ranap/ranap_common.h>
#include <osmocom/ranap/ranap_common_cn.h>
static const char *cn_domain_indicator_to_str(RUA_CN_DomainIndicator_t cN_DomainIndicator)
{