lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-sgsn/+/39294?usp=email )
Change subject: Assign MME GroupId/Code to remote MMEs
......................................................................
Assign MME GroupId/Code to remote MMEs
In preparation to route SGSN Context Req/Resp/Ack the SGSN
need to route GTP messages based on the MME GroupId and MME Code.
Change-Id: I881aeba904fb6ca815842d36e466a2459ad81913
---
M include/osmocom/sgsn/gtp_mme.h
M src/sgsn/gtp_mme.c
M src/sgsn/sgsn_vty.c
3 files changed, 61 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/94/39294/1
diff --git a/include/osmocom/sgsn/gtp_mme.h b/include/osmocom/sgsn/gtp_mme.h
index ceea405..8cc8e89 100644
--- a/include/osmocom/sgsn/gtp_mme.h
+++ b/include/osmocom/sgsn/gtp_mme.h
@@ -5,6 +5,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h>
#include <osmocom/gprs/protocol/gsm_24_301.h>
+#include <osmocom/gsm/gsm23003.h>
struct gsn_t;
@@ -20,6 +21,9 @@
char *name;
struct in_addr remote_addr;
+ struct osmo_gummei gummei;
+ bool gummei_valid;
+
/* is it the default route for outgoing message? are all incoming messages accepted? */
bool default_route;
};
@@ -30,6 +34,7 @@
struct sgsn_mme_ctx *sgsn_mme_ctx_by_name(const struct sgsn_instance *sgsn, const char
*name);
struct sgsn_mme_ctx *sgsn_mme_ctx_by_addr(const struct sgsn_instance *sgsn, const struct
in_addr *addr);
struct sgsn_mme_ctx *sgsn_mme_ctx_by_route(const struct sgsn_instance *sgsn, const struct
osmo_eutran_tai *tai);
+struct sgsn_mme_ctx *sgsn_mme_ctx_by_gummei(const struct sgsn_instance *sgsn, const
struct osmo_gummei *gummei);
struct sgsn_mme_ctx *sgsn_mme_ctx_by_default_route(const struct sgsn_instance *sgsn);
void sgsn_mme_ctx_route_add(struct sgsn_mme_ctx *mme, const struct osmo_eutran_tai
*tai);
diff --git a/src/sgsn/gtp_mme.c b/src/sgsn/gtp_mme.c
index 3d7ec76..0b80408 100644
--- a/src/sgsn/gtp_mme.c
+++ b/src/sgsn/gtp_mme.c
@@ -131,6 +131,16 @@
return NULL;
}
+struct sgsn_mme_ctx *sgsn_mme_ctx_by_gummei(const struct sgsn_instance *sgsn, const
struct osmo_gummei *gummei)
+{
+ struct sgsn_mme_ctx *mme;
+ llist_for_each_entry(mme, &sgsn->mme_list, list) {
+ if (!osmo_gummei_cmp(&mme->gummei, gummei))
+ return mme;
+ }
+ return NULL;
+}
+
struct sgsn_mme_ctx *sgsn_mme_ctx_by_default_route(const struct sgsn_instance *sgsn)
{
struct sgsn_mme_ctx *mme;
diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c
index 42e91e9..7e21973 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -235,6 +235,12 @@
osmo_mcc_name(rt->tai.mcc), osmo_mnc_name(rt->tai.mnc,
rt->tai.mnc_3_digits),
rt->tai.tac, VTY_NEWLINE);
}
+ if (mme->gummei_valid)
+ vty_out(vty, "%s gummei %s %s %d %d%s",
+ prefix,
+ osmo_mcc_name(mme->gummei.plmn.mcc),
+ osmo_mnc_name(mme->gummei.plmn.mnc, mme->gummei.plmn.mnc_3_digits),
+ mme->gummei.mme.group_id, mme->gummei.mme.code, VTY_NEWLINE);
}
static int config_write_sgsn(struct vty *vty)
@@ -1781,6 +1787,44 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_mme_mmei, cfg_mme_mmei_cmd,
+ "gummei <0-999> <0-999> <0-65535> <0-254>",
+ "Configure the mme" "MCC" "MNC" "MME
GroupId" "MME Code")
+{
+ struct sgsn_mme_ctx *mme = (struct sgsn_mme_ctx *) vty->index;
+
+ const char *mcc = argv[0];
+ const char *mnc = argv[1];
+ const char *group_id = argv[2];
+ const char *code = argv[3];
+
+ if (osmo_mcc_from_str(mcc, &mme->gummei.plmn.mcc)) {
+ vty_out(vty, "%% Error decoding MCC: %s%s", mcc, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (osmo_mnc_from_str(mnc, &mme->gummei.plmn.mnc,
&mme->gummei.plmn.mnc_3_digits)) {
+ vty_out(vty, "%% Error decoding MNC: %s%s", mnc, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ mme->gummei.mme.code = atoi(code);
+ mme->gummei.mme.group_id = atoi(group_id);
+ mme->gummei_valid = true;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_mme_mmei, cfg_no_mme_mmei_cmd,
+ "no gummei",
+ NO_STR "Remove gummei")
+{
+ struct sgsn_mme_ctx *mme = (struct sgsn_mme_ctx *) vty->index;
+ mme->gummei_valid = false;
+
+ return CMD_SUCCESS;
+}
+
int sgsn_vty_init(struct sgsn_config *cfg)
{
g_cfg = cfg;
@@ -1857,6 +1901,8 @@
install_element(MME_NODE, &cfg_mme_remote_ip_cmd);
install_element(MME_NODE, &cfg_mme_ran_info_relay_default_cmd);
install_element(MME_NODE, &cfg_mme_no_ran_info_relay_default_cmd);
+ install_element(MME_NODE, &cfg_mme_mmei_cmd);
+ install_element(MME_NODE, &cfg_no_mme_mmei_cmd);
install_element(MME_NODE, &cfg_mme_ran_info_relay_tai_cmd);
install_element(MME_NODE, &cfg_mme_no_ran_info_relay_tai_cmd);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-sgsn/+/39294?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I881aeba904fb6ca815842d36e466a2459ad81913
Gerrit-Change-Number: 39294
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>