dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/34120 )
Change subject: sgsn_rim: get rid of MME check in sgsn_rim_rx_from_gtp:
......................................................................
sgsn_rim: get rid of MME check in sgsn_rim_rx_from_gtp:
There is no point in checking the MME any further. When the message has
reached this code path it is about to be forwarded to BSSGP, so the MME
does not play a role in the following code pathes.
Change-Id: I97c89aeb11537ae54d1fbea48c75619d8a92af61
Related: OS#6095
---
M include/osmocom/sgsn/sgsn_rim.h
M src/sgsn/sgsn_libgtp.c
M src/sgsn/sgsn_rim.c
3 files changed, 25 insertions(+), 22 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/20/34120/1
diff --git a/include/osmocom/sgsn/sgsn_rim.h b/include/osmocom/sgsn/sgsn_rim.h
index aa5a726..f43b09a 100644
--- a/include/osmocom/sgsn/sgsn_rim.h
+++ b/include/osmocom/sgsn/sgsn_rim.h
@@ -3,4 +3,4 @@
struct sgsn_mme_ctx;
int sgsn_rim_rx_from_gb(struct osmo_bssgp_prim *bp, struct msgb *msg);
-int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu, struct sgsn_mme_ctx *mme);
+int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu);
diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c
index 7c08e6f..156f730 100644
--- a/src/sgsn/sgsn_libgtp.c
+++ b/src/sgsn/sgsn_libgtp.c
@@ -712,7 +712,7 @@
}
msgb_free(msg);
- return sgsn_rim_rx_from_gtp(&pdu, mme);
+ return sgsn_rim_rx_from_gtp(&pdu);
ret_error:
msgb_free(msg);
diff --git a/src/sgsn/sgsn_rim.c b/src/sgsn/sgsn_rim.c
index 4ba672e..c4a4a78 100644
--- a/src/sgsn/sgsn_rim.c
+++ b/src/sgsn/sgsn_rim.c
@@ -91,35 +91,24 @@
}
/* Receive a RIM PDU from GTPv1C (EUTRAN) */
-int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu, struct sgsn_mme_ctx *mme)
+int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu)
{
- struct sgsn_mme_ctx *mme_tmp;
if (pdu->routing_info_src.discr != BSSGP_RIM_ROUTING_INFO_EUTRAN) {
- LOGMME(mme, DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected src %s, got %s\n",
- bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_EUTRAN),
- bssgp_rim_routing_info_discr_str(pdu->routing_info_src.discr));
+ LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected src %s, got %s\n",
+ bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_EUTRAN),
+ bssgp_rim_routing_info_discr_str(pdu->routing_info_src.discr));
return -EINVAL;
}
if (pdu->routing_info_dest.discr != BSSGP_RIM_ROUTING_INFO_GERAN) {
- LOGMME(mme, DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected dst %s, got %s\n",
- bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_GERAN),
- bssgp_rim_routing_info_discr_str(pdu->routing_info_dest.discr));
+ LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected dst %s, got %s\n",
+ bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_GERAN),
+ bssgp_rim_routing_info_discr_str(pdu->routing_info_dest.discr));
return -EINVAL;
}
- mme_tmp = sgsn_mme_ctx_by_route(sgsn, &pdu->routing_info_src.eutran.tai);
- if (!mme_tmp)/* See if we have a default route configured */
- mme_tmp = sgsn_mme_ctx_by_default_route(sgsn);
- if (mme != mme_tmp) {
- LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: "
- "Source MME doesn't have RIM routing configured for TAI: %s\n",
- bssgp_rim_ri_name(&pdu->routing_info_src));
- return -EINVAL;
- }
-
- LOGMME(mme, DRIM, LOGL_INFO, "Rx GTP RAN Information Relay for dest cell %s\n",
- bssgp_rim_ri_name(&pdu->routing_info_dest));
+ LOGP(DRIM, LOGL_INFO, "Rx GTP RAN Information Relay for dest cell %s\n",
+ bssgp_rim_ri_name(&pdu->routing_info_dest));
return sgsn_bssgp_fwd_rim_to_geran(pdu);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/34120
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I97c89aeb11537ae54d1fbea48c75619d8a92af61
Gerrit-Change-Number: 34120
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/34121 )
Change subject: sgsn_rim: do not check the origin of a RIM message
......................................................................
sgsn_rim: do not check the origin of a RIM message
When we forward RIM messages from GTP to BSSGP, we do not have to check
the origin of the message since it does not matter from which origin the
message came when we are forwarding it.
Related: OS#6095
Change-Id: Iea8176dcfe64c25d207bafc0ef61ca9d9ad415be
---
M src/sgsn/sgsn_rim.c
1 file changed, 14 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/21/34121/1
diff --git a/src/sgsn/sgsn_rim.c b/src/sgsn/sgsn_rim.c
index c4a4a78..c6f8dcd 100644
--- a/src/sgsn/sgsn_rim.c
+++ b/src/sgsn/sgsn_rim.c
@@ -93,13 +93,6 @@
/* Receive a RIM PDU from GTPv1C (EUTRAN) */
int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu)
{
- if (pdu->routing_info_src.discr != BSSGP_RIM_ROUTING_INFO_EUTRAN) {
- LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected src %s, got %s\n",
- bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_EUTRAN),
- bssgp_rim_routing_info_discr_str(pdu->routing_info_src.discr));
- return -EINVAL;
- }
-
if (pdu->routing_info_dest.discr != BSSGP_RIM_ROUTING_INFO_GERAN) {
LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected dst %s, got %s\n",
bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_GERAN),
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/34121
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Iea8176dcfe64c25d207bafc0ef61ca9d9ad415be
Gerrit-Change-Number: 34121
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/34122 )
Change subject: sgsn_rim: forward message based on RIM ROUTING ADDRESS
......................................................................
sgsn_rim: forward message based on RIM ROUTING ADDRESS
At the moment we parse the RAN TRANSPARENT CONTAINER to look at the
destination RIM ROUTING INFORMATION. This is not corredt. The SGSN
should not decode the RAN TRANSPARENT CONTAINER and use the RIM ROUTING
ADDRESS / RIM ROUTING ADDRESS DISCRIMINATOR IE to make the routing
decision.
Related: OS#6095
Change-Id: Ifd2b915ed2f05130cff8ee77714b82005c17de3d
---
M include/osmocom/sgsn/sgsn_rim.h
M src/sgsn/sgsn_libgtp.c
M src/sgsn/sgsn_rim.c
3 files changed, 79 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/22/34122/1
diff --git a/include/osmocom/sgsn/sgsn_rim.h b/include/osmocom/sgsn/sgsn_rim.h
index f43b09a..fc87b46 100644
--- a/include/osmocom/sgsn/sgsn_rim.h
+++ b/include/osmocom/sgsn/sgsn_rim.h
@@ -3,4 +3,4 @@
struct sgsn_mme_ctx;
int sgsn_rim_rx_from_gb(struct osmo_bssgp_prim *bp, struct msgb *msg);
-int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu);
+int sgsn_rim_rx_from_gtp(struct msgb *msg, struct bssgp_rim_routing_info *rim_routing_address);
diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c
index 156f730..cd8ef4f 100644
--- a/src/sgsn/sgsn_libgtp.c
+++ b/src/sgsn/sgsn_libgtp.c
@@ -695,9 +695,43 @@
LOGMME(mme, DGTP, LOGL_INFO, "Rx GTP RAN Information Relay\n");
+ int rc;
unsigned int len = 0;
- struct msgb *msg = msgb_alloc(4096, "gtpcv1_ran_info");
- struct bssgp_ran_information_pdu pdu;
+ struct msgb *msg = bssgp_msgb_alloc();
+
+ uint8_t rim_ra_encoded[1024];
+ unsigned int rim_ra_encoded_len = 0;
+ struct bssgp_rim_routing_info rim_ra;
+
+ /* Read RIM Routing Address Discriminator (optional) */
+ if (gtpie_gettlv(ie, GTPIE_RIM_RA_DISCR, 0, &rim_ra_encoded_len, rim_ra_encoded,
+ sizeof(rim_ra_encoded)) || rim_ra_encoded_len <= 0) {
+ LOGMME(mme, DGTP, LOGL_NOTICE, "Rx GTP RAN Information Relay: No RIM Routing Address Discriminator IE found!\n");
+
+ /* It is not an error when the RIM ROUTING ADDRESS DISCRIMINATOR IE is missing. The RIM ROUTING ADDRESS
+ * DISCRIMINATOR IE is an optional IE. When it is missing, the RIM Routing Address shall be processed
+ * as an RNC address ("0001") See also: 3GPP TS 29.060 */
+ rim_ra_encoded[0] = BSSGP_RIM_ROUTING_INFO_UTRAN;
+ }
+
+ /* Read RIM Routing Address (optional) */
+ if (gtpie_gettlv(ie, GTPIE_RIM_ROUT_ADDR, 0, &rim_ra_encoded_len, rim_ra_encoded + 1,
+ sizeof(rim_ra_encoded) - 1) || rim_ra_encoded_len <= 0) {
+ LOGMME(mme, DGTP, LOGL_ERROR, "Rx GTP RAN Information Relay: No RIM Routing Address IE found!\n");
+
+ /* TODO: The (usually included) RIM ROUTING ADDRESS field is an optional field. However, we cannot
+ * proceed without a destination address. A possible way to fix this would be a default route that
+ * can be configured via the VTY. */
+ goto ret_error;
+ } else {
+ rim_ra_encoded_len += 1;
+ rc = bssgp_parse_rim_ri(&rim_ra, rim_ra_encoded, rim_ra_encoded_len);
+ if (rc < 0) {
+ LOGMME(mme, DGTP, LOGL_ERROR,
+ "Rx GTP RAN Information Relay: Failed parsing RIM Routing Address/RIM Routing Address Discriminator IE!\n");
+ goto ret_error;
+ }
+ }
if (gtpie_gettlv(ie, GTPIE_RAN_T_CONTAIN, 0, &len, msgb_data(msg), 4096) || len <= 0) {
LOGMME(mme, DGTP, LOGL_ERROR, "Rx GTP RAN Information Relay: No Transparent Container IE found!\n");
@@ -706,13 +740,8 @@
msgb_put(msg, len);
msgb_bssgph(msg) = msg->data;
msgb_nsei(msg) = 0;
- if (bssgp_parse_rim_pdu(&pdu, msg) < 0) {
- LOGMME(mme, DGTP, LOGL_ERROR, "Rx GTP RAN Information Relay: Failed parsing Transparent Container IE!\n");
- goto ret_error;
- }
- msgb_free(msg);
- return sgsn_rim_rx_from_gtp(&pdu);
+ return sgsn_rim_rx_from_gtp(msg, &rim_ra);
ret_error:
msgb_free(msg);
diff --git a/src/sgsn/sgsn_rim.c b/src/sgsn/sgsn_rim.c
index c6f8dcd..40e1f90 100644
--- a/src/sgsn/sgsn_rim.c
+++ b/src/sgsn/sgsn_rim.c
@@ -33,6 +33,23 @@
return bssgp_tx_rim(pdu, bvc_ctx->nsei);
}
+static int sgsn_bssgp_fwd_rim_to_geran_encoded(struct msgb *msg, struct bssgp_rim_routing_info *rim_routing_address)
+{
+ struct bssgp_bvc_ctx *bvc_ctx;
+ OSMO_ASSERT(rim_routing_address->discr == BSSGP_RIM_ROUTING_INFO_GERAN);
+
+ /* Resolve RIM ROUTING ADDRESS to a BVC context */
+ bvc_ctx = btsctx_by_raid_cid(&rim_routing_address->geran.raid, rim_routing_address->geran.cid);
+ if (!bvc_ctx) {
+ LOGP(DRIM, LOGL_ERROR, "Unable to find NSEI for destination cell %s\n",
+ bssgp_rim_ri_name(rim_routing_address));
+ return -EINVAL;
+ }
+
+ /* Forward PDU to the NSEI of the resolved BVC context */
+ return bssgp_tx_rim_encoded(msg, bvc_ctx->nsei);
+}
+
static int sgsn_bssgp_fwd_rim_to_eutran(const struct bssgp_ran_information_pdu *pdu)
{
struct sgsn_mme_ctx *mme;
@@ -91,17 +108,20 @@
}
/* Receive a RIM PDU from GTPv1C (EUTRAN) */
-int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu)
+int sgsn_rim_rx_from_gtp(struct msgb *msg, struct bssgp_rim_routing_info *rim_routing_address)
{
- if (pdu->routing_info_dest.discr != BSSGP_RIM_ROUTING_INFO_GERAN) {
+ /* TODO: In this code path, we currently only support RIM message forwarding to GERAN (BSSGP). However, it
+ * technically also be possible to route a message back to GTP (BSSGP_RIM_ROUTING_INFO_EUTRAN) or to
+ * IuPS (BSSGP_RIM_ROUTING_INFO_UTRAN) */
+ if (rim_routing_address->discr != BSSGP_RIM_ROUTING_INFO_GERAN) {
LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected dst %s, got %s\n",
bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_GERAN),
- bssgp_rim_routing_info_discr_str(pdu->routing_info_dest.discr));
+ bssgp_rim_routing_info_discr_str(rim_routing_address->discr));
return -EINVAL;
}
LOGP(DRIM, LOGL_INFO, "Rx GTP RAN Information Relay for dest cell %s\n",
- bssgp_rim_ri_name(&pdu->routing_info_dest));
+ bssgp_rim_ri_name(rim_routing_address));
- return sgsn_bssgp_fwd_rim_to_geran(pdu);
+ return sgsn_bssgp_fwd_rim_to_geran_encoded(msg, rim_routing_address);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/34122
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ifd2b915ed2f05130cff8ee77714b82005c17de3d
Gerrit-Change-Number: 34122
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34116 )
Change subject: gprs_bssgp_rim: also print NSEI when sending RIM messages
......................................................................
Patch Set 2: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34116
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2595abff28fc1d89c1409a2ca0194fedc6f15313
Gerrit-Change-Number: 34116
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 09 Aug 2023 14:47:47 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: pespin.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/34115 )
Change subject: l1ctl: Fill ph_data_param fn field
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/34115
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I3317296b2bda1088a2af81ba9b135714f8393afd
Gerrit-Change-Number: 34115
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 09 Aug 2023 14:46:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment