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/.
daniel gerrit-no-reply at lists.osmocom.orgdaniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/22314 ) Change subject: gbproxy: WIP RIM support ...................................................................... gbproxy: WIP RIM support Change-Id: I3403736eed9d6819634c26db0b90393ac6f4416a --- M include/osmocom/sgsn/gb_proxy.h M src/gbproxy/gb_proxy.c M src/gbproxy/gb_proxy_peer.c 3 files changed, 72 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/22314/1 diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h index d988cae..f916b8f 100644 --- a/include/osmocom/sgsn/gb_proxy.h +++ b/include/osmocom/sgsn/gb_proxy.h @@ -8,6 +8,7 @@ #include <osmocom/core/hashtable.h> #include <osmocom/gsm/gsm23003.h> #include <osmocom/gsm/gsm23236.h> +#include <osmocom/gsm/gsm48.h> #include <osmocom/gsm/protocol/gsm_23_003.h> #include <osmocom/gprs/gprs_ns2.h> @@ -112,6 +113,10 @@ /* Routing Area that this BVC is part of (raw 04.08 encoding) */ uint8_t ra[6]; + struct { + struct gprs_ra_id raid; + uint16_t cid; + } id; /* pointer to the BSS-side BVC */ struct gbproxy_bvc *bss_bvc; @@ -264,6 +269,7 @@ struct gbproxy_cell *gbproxy_cell_alloc(struct gbproxy_config *cfg, uint16_t bvci); struct gbproxy_cell *gbproxy_cell_by_bvci(struct gbproxy_config *cfg, uint16_t bvci); +struct gbproxy_cell *gbproxy_cell_by_cellid(struct gbproxy_config *cfg, const struct gprs_ra_id *raid, uint16_t cid); void gbproxy_cell_free(struct gbproxy_cell *cell); bool gbproxy_cell_add_sgsn_bvc(struct gbproxy_cell *cell, struct gbproxy_bvc *bvc); diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c index edd9f29..63153a0 100644 --- a/src/gbproxy/gb_proxy.c +++ b/src/gbproxy/gb_proxy.c @@ -944,9 +944,34 @@ case BSSGP_PDUT_RAN_INFO_ACK: case BSSGP_PDUT_RAN_INFO_ERROR: case BSSGP_PDUT_RAN_INFO_APP_ERROR: - /* FIXME: route based in RIM Routing IE */ - rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); + { + struct gbproxy_cell *cell; + struct gbproxy_sgsn *sgsn; + struct bssgp_rim_routing_info ri; + + /* TODO: Check the RIM src addr and insure it matches a Cell we have for this BSS */ + /* Reply with STATUS if BSSGP didn't negotiate RIM feature */ + /* FIXME: Check negotiated features + if (0) { + rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); + } */ + + rc = bssgp_parse_rim_ri(&ri, TLVP_VAL(&tp, BSSGP_IE_RIM_ROUTING_INFO), TLVP_LEN(&tp, BSSGP_IE_RIM_ROUTING_INFO)); + + /* Check RIM destination addr */ + if (ri.discr == BSSGP_RIM_ROUTING_INFO_GERAN) { + cell = gbproxy_cell_by_cellid(nse->cfg, &ri.geran.raid, ri.geran.cid); + if (cell) { + /* Destination is known by gbproxy, route directly */ + return gbprox_relay2peer(msg, cell->bss_bvc, 0); + } + } + /* Otherwise pass on to a RIM-capable SGSN */ + /* TODO: Check SGSN is RIM-capable */ + sgsn = gbproxy_select_sgsn(nse->cfg, NULL); + gbprox_relay2nse(msg, sgsn->nse, 0); break; + } case BSSGP_PDUT_LLC_DISCARD: case BSSGP_PDUT_FLUSH_LL_ACK: /* route based on BVCI + TLLI */ @@ -1242,9 +1267,33 @@ case BSSGP_PDUT_RAN_INFO_ACK: case BSSGP_PDUT_RAN_INFO_ERROR: case BSSGP_PDUT_RAN_INFO_APP_ERROR: - /* FIXME: route based in RIM Routing IE */ - rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); + { + struct gbproxy_cell *cell; + struct bssgp_rim_routing_info ri; + + /* TODO: Check the RIM src addr and insure it matches a Cell we have for this BSS */ + /* Reply with STATUS if BSSGP didn't negotiate RIM feature */ + /* FIXME: Check negotiated features + if (0) { + rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); + } */ + + rc = bssgp_parse_rim_ri(&ri, TLVP_VAL(&tp, BSSGP_IE_RIM_ROUTING_INFO), TLVP_LEN(&tp, BSSGP_IE_RIM_ROUTING_INFO)); + + /* Check RIM destination addr */ + if (ri.discr == BSSGP_RIM_ROUTING_INFO_GERAN) { + cell = gbproxy_cell_by_cellid(cfg, &ri.geran.raid, ri.geran.cid); + if (!cell) { + /* TODO: Log error */ + } else { + return gbprox_relay2peer(msg, cell->bss_bvc, 0); + } + } + /* If it's not a GERAN Cell or it's a Cell gbproxy doesn't know about: Return STATUS PDU with + * "Unknown Destination Address" */ + rc = bssgp_tx_status(BSSGP_CAUSE_UNKN_DST, NULL, msg); break; + } default: LOGPNSE(nse, LOGL_NOTICE, "Rx %s: Not supported\n", pdut_name); rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_PROTO_ERR_SGSN]); diff --git a/src/gbproxy/gb_proxy_peer.c b/src/gbproxy/gb_proxy_peer.c index 7d6ba86..dd914fa 100644 --- a/src/gbproxy/gb_proxy_peer.c +++ b/src/gbproxy/gb_proxy_peer.c @@ -206,6 +206,19 @@ return cell; } +struct gbproxy_cell *gbproxy_cell_by_cellid(struct gbproxy_config *cfg, const struct gprs_ra_id *raid, uint16_t cid) +{ + int i; + struct gbproxy_cell *cell; + + hash_for_each(cfg->cells, i, cell, list) { + if ((cell->id.cid == cid) && (!memcmp(&cell->id.raid, raid, sizeof(*raid)))) { + return cell; + } + } + return NULL; +} + void gbproxy_cell_free(struct gbproxy_cell *cell) { unsigned int i; -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/22314 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I3403736eed9d6819634c26db0b90393ac6f4416a Gerrit-Change-Number: 22314 Gerrit-PatchSet: 1 Gerrit-Owner: daniel <dwillmann at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210119/ac34e138/attachment.htm>