neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/29001 )
Change subject: build: add --enable-pfcp, make PFCP dep optional ......................................................................
build: add --enable-pfcp, make PFCP dep optional
Related: SYS#5895 Change-Id: I6d50c60bccda767910217243bdfb4a6fad1e39c1 --- M configure.ac M debian/rules M src/osmo-hnbgw/Makefile.am M src/osmo-hnbgw/context_map.c M src/osmo-hnbgw/hnbgw.c M src/osmo-hnbgw/hnbgw_cn.c M src/osmo-hnbgw/hnbgw_rua.c M src/osmo-hnbgw/hnbgw_vty.c M src/osmo-hnbgw/tdefs.c 9 files changed, 63 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/01/29001/1
diff --git a/configure.ac b/configure.ac index 0f2a7c4..6bfb080 100644 --- a/configure.ac +++ b/configure.ac @@ -61,8 +61,17 @@ PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 1.3.0) PKG_CHECK_MODULES(LIBOSMOHNBAP, libosmo-hnbap >= 1.3.0) PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.10.0) -PKG_CHECK_MODULES(LIBOSMOGTLV, libosmo-gtlv >= 0.1.0) -PKG_CHECK_MODULES(LIBOSMOPFCP, libosmo-pfcp >= 0.1.0) + +# Enable PFCP support for GTP tunnel mapping via UPF +AC_ARG_ENABLE([pfcp], [AS_HELP_STRING([--enable-pfcp], [Build with PFCP support, for GTP tunnel mapping via UPF])], + [osmo_ac_pfcp="$enableval"],[osmo_ac_pfcp="no"]) +if test "x$osmo_ac_pfcp" = "xyes" ; then + PKG_CHECK_MODULES(LIBOSMOGTLV, libosmo-gtlv >= 0.1.0) + PKG_CHECK_MODULES(LIBOSMOPFCP, libosmo-pfcp >= 0.1.0) + AC_DEFINE(ENABLE_PFCP, 1, [Define to build with PFCP support]) +fi +AM_CONDITIONAL(ENABLE_PFCP, test "x$osmo_ac_pfcp" = "xyes") +AC_SUBST(osmo_ac_pfcp)
dnl checks for header files AC_HEADER_STDC diff --git a/debian/rules b/debian/rules index bce8ed6..f341a84 100755 --- a/debian/rules +++ b/debian/rules @@ -46,6 +46,7 @@
# debmake generated override targets CONFIGURE_FLAGS += --with-systemdsystemunitdir=/lib/systemd/system --enable-manuals +CONFIGURE_FLAGS += --enable-pfcp override_dh_auto_configure: dh_auto_configure -- $(CONFIGURE_FLAGS) # diff --git a/src/osmo-hnbgw/Makefile.am b/src/osmo-hnbgw/Makefile.am index 4d2403d..1d907ba 100644 --- a/src/osmo-hnbgw/Makefile.am +++ b/src/osmo-hnbgw/Makefile.am @@ -20,8 +20,6 @@ $(LIBOSMORANAP_CFLAGS) \ $(LIBOSMOHNBAP_CFLAGS) \ $(LIBOSMOMGCPCLIENT_CFLAGS) \ - $(LIBOSMOGTLV_CFLAGS) \ - $(LIBOSMOPFCP_CFLAGS) \ $(NULL)
AM_LDFLAGS = \ @@ -37,14 +35,11 @@ hnbgw_hnbap.c \ hnbgw_rua.c \ hnbgw_ranap.c \ - hnbgw_pfcp.c \ hnbgw_vty.c \ context_map.c \ hnbgw_cn.c \ ranap_rab_ass.c \ mgw_fsm.c \ - ps_rab_ass_fsm.c \ - ps_rab_fsm.c \ tdefs.c \ $(NULL)
@@ -63,6 +58,20 @@ $(LIBOSMOMGCPCLIENT_LIBS) \ $(LIBSCTP_LIBS) \ $(LIBOSMOMGCPCLIENT_LIBS) \ + $(NULL) + +if ENABLE_PFCP +AM_CFLAGS += \ + $(LIBOSMOGTLV_CFLAGS) \ + $(LIBOSMOPFCP_CFLAGS) \ + $(NULL) +osmo_hnbgw_LDADD += \ $(LIBOSMOGTLV_LIBS) \ $(LIBOSMOPFCP_LIBS) \ $(NULL) +osmo_hnbgw_SOURCES += \ + hnbgw_pfcp.c \ + ps_rab_ass_fsm.c \ + ps_rab_fsm.c \ + $(NULL) +endif diff --git a/src/osmo-hnbgw/context_map.c b/src/osmo-hnbgw/context_map.c index 6bd4f6c..c069651 100644 --- a/src/osmo-hnbgw/context_map.c +++ b/src/osmo-hnbgw/context_map.c @@ -19,6 +19,8 @@ * */
+#include "config.h" + /* an expired mapping is destroyed after 1..2 * EXPIRY_TIMER_SECS */ #define EXPIRY_TIMER_SECS 23
@@ -166,7 +168,9 @@ OSMO_ASSERT(map->mgw_fi == NULL); }
+#if ENABLE_PFCP hnbgw_gtpmap_release(map); +#endif }
static struct osmo_timer_list context_map_tmr; diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 8b72a8f..526622b 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -61,7 +61,9 @@ #include <osmocom/sigtran/protocol/m3ua.h> #include <osmocom/sigtran/sccp_sap.h>
+#if ENABLE_PFCP #include <osmocom/pfcp/pfcp_proto.h> +#endif
#include <osmocom/hnbgw/hnbgw.h> #include <osmocom/hnbgw/hnbgw_hnbap.h> @@ -104,7 +106,9 @@ gw->config.mgcp_client = talloc_zero(tall_hnb_ctx, struct mgcp_client_conf); mgcp_client_conf_init(gw->config.mgcp_client);
+#if ENABLE_PFCP gw->config.pfcp.remote_port = OSMO_PFCP_PORT; +#endif
return gw; } @@ -718,8 +722,10 @@ return -EINVAL; }
+#if ENABLE_PFCP /* If UPF is configured, set up PFCP socket and send Association Setup Request to UPF */ hnbgw_pfcp_init(g_hnb_gw); +#endif
if (hnbgw_cmdline_config.daemonize) { rc = osmo_daemonize(); diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index 0f1ed07..893ee2a 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -18,6 +18,8 @@ * */
+#include "config.h" + #include <arpa/inet.h> #include <errno.h>
@@ -29,7 +31,9 @@ #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> @@ -356,7 +360,6 @@ struct hnbgw_context_map *map; ranap_message *message; int rc; - struct hnb_gw *hnb_gw = cnlink->gw;
/* Usually connection-oriented data is always passed transparently towards the specific HNB, via a RUA * connection identified by conn_id. An exception is made for RANAP RAB AssignmentRequest and @@ -385,7 +388,9 @@ mgw_fsm_release(map); break; } +#if ENABLE_PFCP } else { + struct hnb_gw *hnb_gw = cnlink->gw; /* Packet-Switched. Set up mapping of GTP ports via UPF */ switch (message->procedureCode) {
@@ -408,6 +413,7 @@ hnbgw_gtpmap_release(map); break; } +#endif } ranap_ran_rx_co_free(message); } diff --git a/src/osmo-hnbgw/hnbgw_rua.c b/src/osmo-hnbgw/hnbgw_rua.c index f3ce5d9..9234ac4 100644 --- a/src/osmo-hnbgw/hnbgw_rua.c +++ b/src/osmo-hnbgw/hnbgw_rua.c @@ -18,6 +18,7 @@ * */
+#include "config.h"
#include <osmocom/core/msgb.h> #include <osmocom/core/utils.h> @@ -285,8 +286,10 @@ /* mgw_fsm_handle_rab_ass_resp() takes ownership of prim->oph and (ranap) message */ return mgw_fsm_handle_rab_ass_resp(map, &prim->oph, message); } +#if ENABLE_PFCP /* ps_rab_ass_fsm takes ownership of prim->oph and RANAP message */ return hnbgw_gtpmap_rx_rab_ass_resp(map, &prim->oph, message); +#endif } ranap_cn_rx_co_free(message); } diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 03f6617..3f76c6f 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -18,6 +18,8 @@ * */
+#include "config.h" + #include <string.h>
#include <osmocom/core/socket.h> @@ -362,6 +364,8 @@ return CMD_SUCCESS; }
+#if ENABLE_PFCP + static struct cmd_node pfcp_node = { PFCP_NODE, "%s(config-hnbgw-pfcp)# ", @@ -403,6 +407,8 @@ return CMD_SUCCESS; }
+#endif /* ENABLE_PFCP */ + static int config_write_hnbgw(struct vty *vty) { vty_out(vty, "hnbgw%s", VTY_NEWLINE); @@ -466,6 +472,7 @@ return CMD_SUCCESS; }
+#if ENABLE_PFCP static int config_write_hnbgw_pfcp(struct vty *vty) { vty_out(vty, " pfcp%s", VTY_NEWLINE); @@ -476,6 +483,7 @@
return CMD_SUCCESS; } +#endif
void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx) { @@ -515,11 +523,13 @@ install_element(HNBGW_NODE, &cfg_hnbgw_mgcp_cmd); install_node(&mgcp_node, config_write_hnbgw_mgcp);
+#if ENABLE_PFCP install_node(&pfcp_node, config_write_hnbgw_pfcp); install_element(HNBGW_NODE, &cfg_hnbgw_pfcp_cmd); install_element(PFCP_NODE, &cfg_pfcp_local_addr_cmd); install_element(PFCP_NODE, &cfg_pfcp_local_port_cmd); install_element(PFCP_NODE, &cfg_pfcp_remote_addr_cmd); +#endif
mgcp_client_vty_init(tall_hnb_ctx, MGCP_NODE, g_hnb_gw->config.mgcp_client); osmo_tdef_vty_groups_init(HNBGW_NODE, hnbgw_tdef_group); diff --git a/src/osmo-hnbgw/tdefs.c b/src/osmo-hnbgw/tdefs.c index 5113dd3..d798345 100644 --- a/src/osmo-hnbgw/tdefs.c +++ b/src/osmo-hnbgw/tdefs.c @@ -14,8 +14,13 @@ * GNU General Public License for more details. */
+#include "config.h" + #include <osmocom/hnbgw/tdefs.h> + +#if ENABLE_PFCP #include <osmocom/pfcp/pfcp_endpoint.h> +#endif
struct osmo_tdef mgw_fsm_T_defs[] = { {.T = -1001, .default_val = 5, .desc = "Timeout for HNB side call-leg (to-HNB) creation" }, @@ -34,6 +39,8 @@ struct osmo_tdef_group hnbgw_tdef_group[] = { {.name = "mgw", .tdefs = mgw_fsm_T_defs, .desc = "MGW (Media Gateway) interface" }, {.name = "ps", .tdefs = ps_T_defs, .desc = "timers for Packet Switched domain" }, +#if ENABLE_PFCP {.name = "pfcp", .tdefs = osmo_pfcp_tdefs, .desc = "PFCP timers" }, +#endif { } };