osmith submitted this change.

View Change

Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved; Verified
Make compatible with private pfcp structs

Adjust OsmoHNBGW to build with newer versions of libosmo-pfcp, where
osmo_pfcp_cp_peer was made private. This based on Pau's patch 1ac1d127
("hnbgw: Avoid using struct osmo_pfcp_cp_peer fields directly").

Related: OS#6617
Change-Id: I188e76307deadd9328430afff54dc287eda51370
---
M configure.ac
M src/osmo-hnbgw/context_map_sccp.c
M src/osmo-hnbgw/ps_rab_fsm.c
3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index b6f013e..7fe12de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,18 @@
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])

+# OS#6617: check if libosmo-pfcp has private structs
+# We need to use grep here, can't set the includedir with AC_CHECK_DECL.
+m="OS#6617: checking whether libosmo-pfcp has private structs..."
+h="$($PKG_CONFIG --variable=includedir libosmo-pfcp)/osmocom/pfcp/pfcp_cp_peer.h"
+f=osmo_pfcp_cp_peer_next_seid
+if grep -q "$f" "$h"; then
+ echo "$m yes ($f in $h)"
+ AC_DEFINE(PFCP_PRIVATE_STRUCTS, [1], ["OS#6617"])
+else
+ echo "$m no ($f not in $h)"
+fi
+
dnl Generate the output
AM_CONFIG_HEADER(config.h)

diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c
index 511577c..a92b3d6 100644
--- a/src/osmo-hnbgw/context_map_sccp.c
+++ b/src/osmo-hnbgw/context_map_sccp.c
@@ -241,7 +241,11 @@
if (hnb_gw_is_gtp_mapping_enabled()) {
LOGP(DMAIN, LOGL_DEBUG,
"RAB Assignment: setting up GTP tunnel mapping via UPF %s\n",
+#ifdef PFCP_PRIVATE_STRUCTS
+ osmo_sockaddr_to_str_c(OTC_SELECT, osmo_pfcp_cp_peer_get_remote_addr(g_hnbgw->pfcp.cp_peer)));
+#else
osmo_sockaddr_to_str_c(OTC_SELECT, &g_hnbgw->pfcp.cp_peer->remote_addr));
+#endif
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). */
diff --git a/src/osmo-hnbgw/ps_rab_fsm.c b/src/osmo-hnbgw/ps_rab_fsm.c
index 8905540..bc85e2f 100644
--- a/src/osmo-hnbgw/ps_rab_fsm.c
+++ b/src/osmo-hnbgw/ps_rab_fsm.c
@@ -17,6 +17,8 @@

#include <errno.h>

+#include "config.h"
+
#include <osmocom/core/tdef.h>

#include <osmocom/pfcp/pfcp_endpoint.h>
@@ -320,7 +322,11 @@
m->h.seid = 0;

/* Make a new CP-SEID, our local reference for the PFCP session. */
+#ifdef PFCP_PRIVATE_STRUCTS
+ rab->cp_seid = osmo_pfcp_cp_peer_next_seid(g_hnbgw->pfcp.cp_peer);
+#else
rab->cp_seid = osmo_pfcp_next_seid(&g_hnbgw->pfcp.cp_peer->next_seid_state);
+#endif
cp_f_seid = (struct osmo_pfcp_ie_f_seid){
.seid = rab->cp_seid,
};

To view, visit change 38735. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: osmith/1.6.2
Gerrit-Change-Id: I188e76307deadd9328430afff54dc287eda51370
Gerrit-Change-Number: 38735
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-CC: neels <nhofmeyr@sysmocom.de>