This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26675 )
Change subject: Get rid of libgtp for GTP-U
......................................................................
Get rid of libgtp for GTP-U
It doesn't make much sense to pull whole libgtp to implement only the
user plan side of GTP. Let's drop it and add a minimal GTP-U
implementation here.
Related: SYS#5516
Change-Id: I53ad4915aaed3bc7574036e963be10514e370fe2
---
M configure.ac
M contrib/jenkins.sh
M contrib/osmo-hnodeb.spec.in
M debian/control
M include/osmocom/hnodeb/gtp.h
M include/osmocom/hnodeb/hnodeb.h
M src/osmo-hnodeb/Makefile.am
M src/osmo-hnodeb/gtp.c
M src/osmo-hnodeb/hnb.c
M src/osmo-hnodeb/llsk_gtp.c
10 files changed, 264 insertions(+), 172 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/configure.ac b/configure.ac
index 8a34b82..e96a6a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,7 +67,6 @@
PKG_CHECK_MODULES(LIBOSMORUA, libosmo-rua >= 0.8.0)
PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.8.0)
PKG_CHECK_MODULES(LIBOSMOHNBAP, libosmo-hnbap >= 0.8.0)
-PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.8.0)
dnl checks for header files
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index 3225de2..7001013 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -34,7 +34,6 @@
osmo-build-dep.sh libosmo-netif
osmo-build-dep.sh libosmo-sccp
osmo-build-dep.sh libasn1c
-osmo-build-dep.sh osmo-ggsn
osmo-build-dep.sh osmo-iuh
# Additional configure options and depends
diff --git a/contrib/osmo-hnodeb.spec.in b/contrib/osmo-hnodeb.spec.in
index afa1816..aa33057 100644
--- a/contrib/osmo-hnodeb.spec.in
+++ b/contrib/osmo-hnodeb.spec.in
@@ -47,7 +47,6 @@
BuildRequires: pkgconfig(libosmo-rua) >= 0.8.0
BuildRequires: pkgconfig(talloc)
BuildRequires: pkgconfig(libasn1c) >= 0.9.30
-BuildRequires: pkgconfig(libgtp) >= 1.8.0
%{?systemd_requires}
%description
diff --git a/debian/control b/debian/control
index 503b202..a306e10 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,6 @@
python3-minimal,
libtalloc-dev,
libasn1c-dev (>= 0.9.30),
- libgtp-dev (>= 1.8.0),
libsctp-dev,
libosmocore-dev (>= 1.6.0),
libosmo-sigtran-dev (>= 1.5.0),
diff --git a/include/osmocom/hnodeb/gtp.h b/include/osmocom/hnodeb/gtp.h
index 477e82b..5fa47c3 100644
--- a/include/osmocom/hnodeb/gtp.h
+++ b/include/osmocom/hnodeb/gtp.h
@@ -18,9 +18,6 @@
*/
#pragma once
-#include <gtp.h>
-#include <pdp.h>
-
#include <osmocom/core/socket.h>
#include <osmocom/core/linuxlist.h>
@@ -38,11 +35,11 @@
struct osmo_sockaddr rem_addr;
uint32_t loc_tei;
uint32_t rem_tei;
- struct pdp_t *pdp_lib;
+ uint16_t seq_nr;
};
struct gtp_conn *gtp_conn_alloc(struct hnb_ue *ue);
void gtp_conn_free(struct gtp_conn *conn);
int gtp_conn_setup(struct gtp_conn *conn, const struct osmo_sockaddr *rem_addr, uint32_t rem_tei);
-int gtp_conn_tx(struct gtp_conn *conn, void *gtpu_payload, unsigned gtpu_payload_len);
+int gtp_conn_tx(struct gtp_conn *conn, const uint8_t *gtpu_payload, unsigned gtpu_payload_len);
diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index 82b43c3..924e1ac 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -107,8 +107,7 @@
struct gtp {
char *cfg_local_addr;
struct osmo_sockaddr local_addr;
- struct gsn_t *gsn;
- struct osmo_fd fd1u;
+ struct osmo_wqueue wq1u;
} gtp;
uint16_t rnc_id;
diff --git a/src/osmo-hnodeb/Makefile.am b/src/osmo-hnodeb/Makefile.am
index 6edbf88..27987a1 100644
--- a/src/osmo-hnodeb/Makefile.am
+++ b/src/osmo-hnodeb/Makefile.am
@@ -19,7 +19,6 @@
$(LIBOSMORUA_CFLAGS) \
$(LIBOSMORANAP_CFLAGS) \
$(LIBOSMOHNBAP_CFLAGS) \
- $(LIBGTP_CFLAGS) \
$(NULL)
AM_LDFLAGS = \
@@ -63,5 +62,4 @@
$(LIBOSMORANAP_LIBS) \
$(LIBOSMOHNBAP_LIBS) \
$(LIBSCTP_LIBS) \
- $(LIBGTP_LIBS) \
$(NULL)
diff --git a/src/osmo-hnodeb/gtp.c b/src/osmo-hnodeb/gtp.c
index f7d9a14..c22de65 100644
--- a/src/osmo-hnodeb/gtp.c
+++ b/src/osmo-hnodeb/gtp.c
@@ -23,11 +23,27 @@
#include <osmocom/hnodeb/gtp.h>
#include <osmocom/hnodeb/hnodeb.h>
#include <osmocom/hnodeb/llsk.h>
+#include <osmocom/core/endian.h>
-#include <gtp.h>
-#include <pdp.h>
+/* 3GPP TS 29.281 */
+struct gtp1u_hdr { /* 3GPP TS 29.281 */
+#if OSMO_IS_LITTLE_ENDIAN
+ uint8_t pn:1, /* N-PDU Number flag */
+ s:1, /* Sequence number flag */
+ e:1, /* Extension header flag */
+ spare:1,
+ pt:1, /* Protocol Type: GTP=1, GTP'=0 */
+ version:3; /* Version: 1 */
+#elif OSMO_IS_BIG_ENDIAN
+ uint8_t version:3, pt:1, spare:1, e:1, s:1, pn:1;
+#endif
+ uint8_t msg_type;
+ uint16_t length;
+ uint32_t tei; /* 05 - 08 Tunnel Endpoint ID */
+ uint8_t data[0];
+} __attribute__((packed));
-static uint32_t next_gtp_conn_id = 0;
+static uint32_t next_gtp_conn_id = 1;
struct gtp_conn *gtp_conn_alloc(struct hnb_ue *ue)
{
@@ -49,14 +65,231 @@
if (!conn)
return;
- if (conn->pdp_lib) {
- pdp_freepdp(conn->pdp_lib);
- conn->pdp_lib = NULL;
- }
llist_del(&conn->list);
talloc_free(conn);
}
+int gtp_conn_setup(struct gtp_conn *conn, const struct osmo_sockaddr *rem_addr, uint32_t rem_tei)
+{
+ struct hnb_ue *ue = conn->ue;
+ struct hnb *hnb = ue->hnb;
+
+ LOGUE(ue, DGTP, LOGL_INFO, "Creating PDP context\n");
+
+
+ if (rem_addr->u.sa.sa_family != AF_INET) {
+ LOGUE(ue, DGTP, LOGL_ERROR, "Failed creating PDP context: unsupported proto family %u\n",
+ rem_addr->u.sa.sa_family);
+ return -ENOTSUP;
+ }
+
+ conn->id = next_gtp_conn_id++; /* TODO: validate next one is not already taken due to wrap-around */
+
+ conn->loc_addr = hnb->gtp.local_addr;
+ conn->rem_addr = *rem_addr;
+ conn->rem_tei = rem_tei;
+ conn->loc_tei = conn->id; /* We use conn ID as local TEI */
+ return 0;
+}
+
+int gtp_conn_tx(struct gtp_conn *conn, const uint8_t *gtpu_payload, unsigned gtpu_payload_len)
+{
+ int rc;
+ struct hnb_ue *ue;
+ struct hnb *hnb;
+ struct msgb *msg;
+ struct gtp1u_hdr *hdr;
+ struct osmo_sockaddr *sa;
+ const uint8_t opt_hdr_len = 4;
+ unsigned msg_len = sizeof(*hdr) + opt_hdr_len + gtpu_payload_len;
+
+ if (!conn) {
+ LOGP(DGTP, LOGL_ERROR, "Tx: GTP-U conn not available\n");
+ return -EINVAL;
+ }
+
+ ue = conn->ue;
+ hnb = ue->hnb;
+
+ if (hnb->gtp.wq1u.bfd.fd == -1) {
+ LOGP(DGTP, LOGL_ERROR, "Tx: GTP-U socket not available\n");
+ return -EINVAL;
+ }
+
+ if (gtpu_payload_len == 0) {
+ LOGP(DGTP, LOGL_ERROR, "Tx: GTP-U len=0\n");
+ return -EINVAL;
+ }
+
+ msg = msgb_alloc_c(hnb, sizeof(*sa) + msg_len, "gtp-ul");
+
+ sa = (struct osmo_sockaddr *)msgb_put(msg, sizeof(*sa));
+ *sa = conn->rem_addr;
+
+ hdr = (struct gtp1u_hdr *)msgb_put(msg, msg_len);
+ hdr->pn = 0;
+ hdr->s = 1;
+ hdr->e = 0;
+ hdr->spare = 0;
+ hdr->pt = 1;
+ hdr->version = 1;
+ hdr->msg_type = 0xff;
+ osmo_store16be(gtpu_payload_len + opt_hdr_len, &hdr->length);
+ osmo_store32be(conn->rem_tei, &hdr->tei);
+ osmo_store16be(conn->seq_nr, &hdr->data[0]);
+ conn->seq_nr++;
+ /* byes 2 and 3 are set to 0 */
+ memcpy(&hdr->data[opt_hdr_len], gtpu_payload, gtpu_payload_len);
+
+ rc = osmo_wqueue_enqueue(&hnb->gtp.wq1u, msg);
+ if (rc < 0)
+ msgb_free(msg);
+
+ return rc;
+}
+
+/* Called whenever we receive a DATA packet */
+static int hnb_gtp_rx_gtp(struct hnb *hnb, struct msgb *msg, const struct osmo_sockaddr *from)
+{
+ struct gtp_conn *conn;
+ struct hnb_ue *ue;
+ struct gtp1u_hdr *hdr;
+ uint32_t tei;
+ struct hnb_gtp_prim *gtp_prim;
+ int rc;
+
+ hdr = (struct gtp1u_hdr *)msgb_data(msg);
+ tei = osmo_load32be(&hdr->tei);
+
+ /* The local TEI is the GTP conn_id: */
+ conn = hnb_find_gtp_conn_by_id(hnb, tei);
+ if (!conn) {
+ LOGP(DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind len=%u with no conn!\n",
+ msgb_l3len(msg));
+ rc = -EINVAL;
+ goto free_ret;
+ }
+ ue = conn->ue;
+
+ if (osmo_sockaddr_cmp(from, &conn->rem_addr)) {
+ LOGUE(ue, DGTP, LOGL_NOTICE, "Rx DL GTP-U loc_tei=0x%08x from unexpected addr=%s!\n",
+ tei, osmo_sockaddr_to_str(from));
+ rc = -EINVAL;
+ goto free_ret;
+ }
+ ue = conn->ue;
+
+ if (!ue->conn_ps.active) {
+ LOGUE(ue, DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind len=%u but UE conn_ps is not active!\n",
+ msgb_l3len(msg));
+ rc = -EINVAL;
+ goto free_ret;
+ }
+ hnb = ue->hnb;
+
+ LOGUE(ue, DGTP, LOGL_DEBUG, "Tx GTP-CONN_DATA.ind len=%u\n", msgb_l3len(msg));
+ gtp_prim = hnb_gtp_makeprim_conn_data_ind(conn->id, msgb_l3(msg), msgb_l3len(msg));
+ if ((rc = osmo_prim_srv_send(hnb->llsk, gtp_prim->hdr.msg)) < 0) {
+ LOGUE(ue, DGTP, LOGL_ERROR, "Failed Tx GTP-CONN_DATA.ind len=%u\n",
+ msgb_l3len(msg));
+ }
+free_ret:
+ msgb_free(msg);
+ return rc;
+}
+
+static int hnb_gtp_wq_read_cb(struct osmo_fd *fd)
+{
+ struct hnb *hnb = (struct hnb *)fd->data;
+ struct msgb *msg;
+ struct gtp1u_hdr *hdr;
+ int rc;
+ struct osmo_sockaddr peer;
+ socklen_t peerlen = sizeof(peer.u.sas);
+ unsigned int opt_hdr_len;
+ uint16_t pl_len;
+
+ msg = msgb_alloc_c(hnb, 4096, "gtp-dl");
+
+ rc = recvfrom(hnb->gtp.wq1u.bfd.fd, msgb_data(msg), msg->data_len, 0,
+ &peer.u.sa, &peerlen);
+ if (rc <= 0) {
+ LOGP(DGTP, LOGL_ERROR, "recvfrom() failed: rc = %d error = %s\n",
+ rc, rc ? strerror(errno) : "No error");
+ goto free_ret;
+ }
+ msgb_put(msg, rc);
+
+ /* Do some sanity checks: */
+ if (msgb_length(msg) < sizeof(*hdr)) {
+ LOGP(DGTP, LOGL_ERROR, "Rx GTP-U packet with size %u < %zu (header)\n",
+ msgb_length(msg), sizeof(*hdr));
+ rc = -EINVAL;
+ goto free_ret;
+ }
+
+ hdr = (struct gtp1u_hdr *)msgb_data(msg);
+ pl_len = osmo_load16be(&hdr->length);
+
+ /* Do some sanity checks: */
+ if (hdr->version != 1) {
+ LOGP(DGTP, LOGL_ERROR, "Rx GTP-U version %u != 1\n", hdr->version);
+ rc = -ENOTSUP;
+ goto free_ret;
+ }
+
+ if (hdr->e == 1) {
+ LOGP(DGTP, LOGL_ERROR, "Rx GTP-U with Extension Header not supported\n");
+ rc = -ENOTSUP;
+ goto free_ret;
+ }
+
+ if (hdr->s || hdr->pn || hdr->e)
+ opt_hdr_len = 4;
+ if (hdr->pn)
+ opt_hdr_len = 0;
+
+ if (msgb_length(msg) < sizeof(*hdr) + opt_hdr_len) {
+ LOGP(DGTP, LOGL_ERROR, "Rx GTP-U packet with size %u < %zu (header + opt)\n",
+ msgb_length(msg), sizeof(*hdr) + opt_hdr_len);
+ rc = -EINVAL;
+ goto free_ret;
+ }
+
+ msg->l3h = msgb_data(msg) + sizeof(*hdr) + opt_hdr_len;
+
+ if (pl_len < opt_hdr_len || msgb_l3len(msg) != (pl_len - opt_hdr_len)) {
+ LOGP(DGTP, LOGL_ERROR, "Rx GTP-U packet with payload size %u != %u (header)\n",
+ msgb_length(msg), pl_len - opt_hdr_len);
+ rc = -EINVAL;
+ goto free_ret;
+ }
+
+ return hnb_gtp_rx_gtp(hnb, msg, &peer);
+free_ret:
+ msgb_free(msg);
+ return rc;
+}
+
+static int hnb_gtp_wq_write_cb(struct osmo_fd *fd, struct msgb *msg)
+{
+ struct hnb *hnb = (struct hnb *)fd->data;
+ struct osmo_sockaddr *rem_addr;
+ int rc;
+
+ rem_addr = (struct osmo_sockaddr *)msgb_data(msg);
+ msgb_pull(msg, sizeof(*rem_addr));
+
+ rc = sendto(hnb->gtp.wq1u.bfd.fd, msgb_data(msg), msgb_length(msg), 0,
+ &rem_addr->u.sa, sizeof(*rem_addr));
+ if (rc < 0) {
+ int err = errno;
+ LOGP(DGTP, LOGL_ERROR, "GTP1-U sendto(len=%d, to=%s) failed: Error = %s\n",
+ msgb_length(msg), osmo_sockaddr_to_str(rem_addr), strerror(err));
+ }
+ return rc;
+}
+
/* Get osa of locally bound GTP-U socket */
static int sk_get_bound_addr(int fd, struct osmo_sockaddr *osa)
{
@@ -70,173 +303,43 @@
return 0;
}
-/* Called whenever we receive a DATA packet */
-static int hnb_gtp_cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
-{
- struct hnb_gtp_prim *gtp_prim;
- struct gtp_conn *conn = lib->priv;
- struct hnb_ue *ue;
- struct hnb *hnb;
- int rc;
-
- if (!conn) {
- LOGP(DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u with no conn!\n",
- packet, len);
- return -EINVAL;
- }
- ue = conn->ue;
-
- if (!ue->conn_ps.active) {
- LOGUE(ue, DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u but UE conn_ps is not active!\n",
- packet, len);
- return -EINVAL;
- }
- hnb = ue->hnb;
-
- LOGUE(ue, DGTP, LOGL_DEBUG, "Tx GTP-CONN_DATA.ind data=%p len=%u\n", packet, len);
- gtp_prim = hnb_gtp_makeprim_conn_data_ind(conn->id, packet, len);
- if ((rc = osmo_prim_srv_send(hnb->llsk, gtp_prim->hdr.msg)) < 0) {
- LOGUE(ue, DGTP, LOGL_ERROR, "Failed Tx GTP-CONN_DATA.ind data=%p len=%u\n",
- packet, len);
- }
- return rc;
-}
-
-/* libgtp select loop integration */
-static int hnb_gtp_fd_cb(struct osmo_fd *fd, unsigned int what)
-{
- struct hnb *hnb = fd->data;
- int rc;
-
- if (!(what & OSMO_FD_READ))
- return 0;
-
- switch (fd->priv_nr) {
- case 0:
- rc = gtp_decaps1u(hnb->gtp.gsn);
- break;
- default:
- rc = -EINVAL;
- break;
- }
- return rc;
-}
-
int hnb_gtp_bind(struct hnb *hnb)
{
int rc;
- struct gsn_t *gsn;
- struct in_addr inaddr;
- rc = inet_pton(AF_INET, hnb->gtp.cfg_local_addr, &inaddr);
- if (rc <= 0)
- return -EINVAL;
+ OSMO_ASSERT(hnb->gtp.wq1u.bfd.fd == -1);
- /* TODO: add new mode GTP_MODE_GTPU_ONLY to set up gtpu side only (and ignore statedir) */
- rc = gtp_new(&gsn, "/tmp", &inaddr, GTP_MODE_SGSN);
+ hnb->gtp.wq1u.read_cb = hnb_gtp_wq_read_cb;
+ hnb->gtp.wq1u.write_cb = hnb_gtp_wq_write_cb;
+
+ rc = osmo_sock_init2_ofd(&hnb->gtp.wq1u.bfd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
+ hnb->gtp.cfg_local_addr, 2152, NULL, 0, OSMO_SOCK_F_BIND);
if (rc < 0) {
LOGP(DGTP, LOGL_ERROR, "Failed to set up GTP socket: %s\n", strerror(-rc));
return rc;
}
- rc = sk_get_bound_addr(gsn->fd1u, &hnb->gtp.local_addr);
+ rc = sk_get_bound_addr(hnb->gtp.wq1u.bfd.fd, &hnb->gtp.local_addr);
if (rc < 0) {
LOGP(DGTP, LOGL_ERROR, "Failed to get GTP-U socket bound address: %s\n", strerror(-rc));
goto free_ret;
}
-
- osmo_fd_setup(&hnb->gtp.fd1u, gsn->fd1u, OSMO_FD_READ, hnb_gtp_fd_cb, hnb, 0);
- if ((rc = osmo_fd_register(&hnb->gtp.fd1u)) < 0)
- goto free_ret;
-
- gtp_set_cb_data_ind(gsn, hnb_gtp_cb_data_ind);
-
- hnb->gtp.gsn = gsn;
return 0;
free_ret:
- gtp_free(gsn);
- hnb->gtp.fd1u.fd = -1;
+ if (hnb->gtp.wq1u.bfd.fd != -1) {
+ close(hnb->gtp.wq1u.bfd.fd);
+ hnb->gtp.wq1u.bfd.fd = -1;
+ }
return rc;
}
void hnb_gtp_unbind(struct hnb *hnb)
{
- osmo_fd_unregister(&hnb->gtp.fd1u);
- gtp_free(hnb->gtp.gsn);
- hnb->gtp.gsn = NULL;
- hnb->gtp.fd1u.fd = -1;
-}
-
-int gtp_conn_setup(struct gtp_conn *conn, const struct osmo_sockaddr *rem_addr, uint32_t rem_tei)
-{
- int rc;
- struct hnb_ue *ue = conn->ue;
- struct hnb *hnb = ue->hnb;
- struct pdp_t *pdp;
- struct in_addr rem_in;
-
- LOGUE(ue, DGTP, LOGL_INFO, "Creating PDP context\n");
-
-
- if (rem_addr->u.sa.sa_family != AF_INET) {
- LOGUE(ue, DGTP, LOGL_ERROR, "Failed creating PDP context: unsupported proto family %u\n",
- rem_addr->u.sa.sa_family);
- return -ENOTSUP;
+ if (hnb->gtp.wq1u.bfd.fd != -1) {
+ osmo_wqueue_clear(&hnb->gtp.wq1u);
+ osmo_fd_unregister(&hnb->gtp.wq1u.bfd);
+ close(hnb->gtp.wq1u.bfd.fd);
+ hnb->gtp.wq1u.bfd.fd = -1;
}
-
- conn->rem_addr = *rem_addr;
- conn->rem_tei = rem_tei;
- rem_in = rem_addr->u.sin.sin_addr;
- conn->id = next_gtp_conn_id++; /* TODO: validate next one is not already taken due to wrap-around */
-
- rc = gtp_pdp_newpdp(hnb->gtp.gsn, &pdp, conn->id, 0 /* TODO: NSAPI? */, NULL);
- if (rc < 0) {
- LOGUE(ue, DGTP, LOGL_ERROR, "Failed creating PDP context: %s\n", strerror(-rc));
- return rc;
- }
- pdp->priv = conn;
- conn->pdp_lib = pdp;
-
- pdp->teid_gn = rem_tei;
- pdp->version = 1;
- pdp->hisaddr0 = rem_in;
- pdp->hisaddr1 = rem_in;
-
- pdp->gsnru.l = sizeof(rem_in);
- memcpy(pdp->gsnru.v, &rem_in, sizeof(rem_in));
-
-
- pdp->gsnlu.l = sizeof(hnb->gtp.local_addr.u.sin.sin_addr);
- memcpy(pdp->gsnlu.v, &hnb->gtp.local_addr.u.sin.sin_addr,
- sizeof(hnb->gtp.local_addr.u.sin.sin_addr));
-
- conn->loc_addr = hnb->gtp.local_addr;
- //loc_addr->u.sin.sin_family = AF_INET;
- //loc_addr->u.sin.sin_addr = hnb->gtp.gsn->gsnu;
- //loc_addr->u.sin.sin_port = GTP1U_PORT;
- conn->loc_tei = pdp->teid_own;
- return 0;
-}
-
-int gtp_conn_tx(struct gtp_conn *conn, void *gtpu_payload, unsigned gtpu_payload_len)
-{
- int rc;
- struct hnb_ue *ue;
- struct hnb *hnb;
-
- if (!conn || !conn->pdp_lib) {
- LOGP(DGTP, LOGL_ERROR, "Tx: PDP Ctx not available\n");
- return -EINVAL;
- }
-
- ue = conn->ue;
- hnb = ue->hnb;
- if (!hnb->gtp.gsn) {
- LOGUE(ue, DGTP, LOGL_ERROR, "Tx: GTP socket not bound\n");
- return -EINVAL;
- }
-
- rc = gtp_data_req(hnb->gtp.gsn, conn->pdp_lib, gtpu_payload, gtpu_payload_len);
- return rc;
}
diff --git a/src/osmo-hnodeb/hnb.c b/src/osmo-hnodeb/hnb.c
index fe2f4f5..18f39b4 100644
--- a/src/osmo-hnodeb/hnb.c
+++ b/src/osmo-hnodeb/hnb.c
@@ -61,7 +61,9 @@
hnb->rtp.priority = -1;
hnb->gtp.cfg_local_addr = talloc_strdup(hnb, "0.0.0.0");
- hnb->gtp.fd1u.fd = -1;
+ osmo_wqueue_init(&hnb->gtp.wq1u, 1024);
+ hnb->gtp.wq1u.bfd.data = hnb;
+ hnb->gtp.wq1u.bfd.fd = -1;
hnb->shutdown_fi = osmo_fsm_inst_alloc(&hnb_shutdown_fsm, hnb, hnb,
LOGL_INFO, NULL);
@@ -90,10 +92,7 @@
osmo_prim_srv_link_free(hnb->llsk_link);
hnb->llsk_link = NULL;
- if (hnb->gtp.gsn) {
- gtp_free(hnb->gtp.gsn);
- hnb->gtp.gsn = NULL;
- }
+ hnb_gtp_unbind(hnb);
talloc_free(hnb);
}
diff --git a/src/osmo-hnodeb/llsk_gtp.c b/src/osmo-hnodeb/llsk_gtp.c
index a224d56..775df50 100644
--- a/src/osmo-hnodeb/llsk_gtp.c
+++ b/src/osmo-hnodeb/llsk_gtp.c
@@ -138,7 +138,7 @@
union u_addr loc_uaddr = {0};
struct gtp_conn *conn = NULL;
- rc = ll_addr2osa(ce_req->remote_gtpu_address_type, &ce_req->remote_gtpu_addr, GTP1U_PORT, &rem_osa);
+ rc = ll_addr2osa(ce_req->remote_gtpu_address_type, &ce_req->remote_gtpu_addr, 2152, &rem_osa);
if (rc < 0) {
LOGP(DLLSK, LOGL_ERROR, "Rx GTP-CONN_ESTABLISH.req: ctx=%u with unexpected address type %u\n",
ce_req->context_id, ce_req->remote_gtpu_address_type);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26675
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: I53ad4915aaed3bc7574036e963be10514e370fe2
Gerrit-Change-Number: 26675
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211224/7bec0ebc/attachment.htm>