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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26020 )
Change subject: Configure PLMN over VTY and use it in HnbRegisterRequest
......................................................................
Configure PLMN over VTY and use it in HnbRegisterRequest
Change-Id: I6d67aa547d5496fe1407744e1dde07d2a41df500
---
M include/osmocom/hnodeb/hnodeb.h
M src/osmo-hnodeb/hnb.c
M src/osmo-hnodeb/hnbap.c
M src/osmo-hnodeb/vty.c
4 files changed, 62 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnodeb refs/changes/20/26020/1
diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index d4fbff1..0928bdd 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -25,6 +25,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/core/logging.h>
+#include <osmocom/gsm/gsm23003.h>
enum {
DMAIN,
@@ -71,6 +72,7 @@
};
struct hnb {
+ struct osmo_plmn_id plmn;
struct {
char *local_addr;
uint16_t local_port;
diff --git a/src/osmo-hnodeb/hnb.c b/src/osmo-hnodeb/hnb.c
index d7dde7b..b0628e5 100644
--- a/src/osmo-hnodeb/hnb.c
+++ b/src/osmo-hnodeb/hnb.c
@@ -116,6 +116,11 @@
if (!hnb)
return NULL;
+ hnb->plmn = (struct osmo_plmn_id){
+ .mcc = 1,
+ .mnc = 1,
+ };
+
hnb->iuh.local_addr = talloc_strdup(hnb, "0.0.0.0");
hnb->iuh.local_port = 0;
hnb->iuh.remote_addr = talloc_strdup(hnb, "127.0.0.1");
diff --git a/src/osmo-hnodeb/hnbap.c b/src/osmo-hnodeb/hnbap.c
index ef459f2..f70f2bb 100644
--- a/src/osmo-hnodeb/hnbap.c
+++ b/src/osmo-hnodeb/hnbap.c
@@ -156,7 +156,7 @@
uint16_t lac, sac;
uint8_t rac;
uint32_t cid;
- uint8_t plmn[] = {0x09, 0xf1, 0x99};
+ uint8_t plmn[3];
char identity[50] = "ATestHNB@";
HNBAP_HNBRegisterRequestIEs_t request;
@@ -175,10 +175,9 @@
request.hnB_Identity.hNB_Identity_Info.buf = (uint8_t*) identity;
request.hnB_Identity.hNB_Identity_Info.size = strlen(identity);
+ osmo_plmn_to_bcd(plmn, &hnb->plmn);
request.plmNidentity.buf = plmn;
- request.plmNidentity.size = 3;
-
-
+ request.plmNidentity.size = sizeof(plmn);
memset(&request_out, 0, sizeof(request_out));
rc = hnbap_encode_hnbregisterrequesties(&request_out, &request);
diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c
index 5dd849c..cdc57e9 100644
--- a/src/osmo-hnodeb/vty.c
+++ b/src/osmo-hnodeb/vty.c
@@ -68,6 +68,7 @@
};
#define HNODEB_STR "Configure the HNodeB\n"
+#define CODE_CMD_STR "Code commands\n"
DEFUN(cfg_hnodeb,
cfg_hnodeb_cmd,
@@ -80,6 +81,52 @@
return CMD_SUCCESS;
}
+DEFUN_USRATTR(cfg_hnodeb_ncc,
+ cfg_hnodeb_ncc_cmd,
+ 0,
+ "network country code <1-999>",
+ "Set the GSM network country code\n"
+ "Country commands\n"
+ CODE_CMD_STR
+ "Network Country Code to use\n")
+{
+ struct hnb *hnb = (struct hnb *)vty->index;
+ uint16_t mcc;
+
+ if (osmo_mcc_from_str(argv[0], &mcc)) {
+ vty_out(vty, "%% Error decoding MCC: %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ hnb->plmn.mcc = mcc;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_hnodeb_mnc,
+ cfg_hnodeb_mnc_cmd,
+ 0,
+ "mobile network code <0-999>",
+ "Set the GSM mobile network code\n"
+ "Network Commands\n"
+ CODE_CMD_STR
+ "Mobile Network Code to use\n")
+{
+ struct hnb *hnb = (struct hnb *)vty->index;
+ uint16_t mnc;
+ bool mnc_3_digits;
+
+ if (osmo_mnc_from_str(argv[0], &mnc, &mnc_3_digits)) {
+ vty_out(vty, "%% Error decoding MNC: %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ hnb->plmn.mnc = mnc;
+ hnb->plmn.mnc_3_digits = mnc_3_digits;
+
+ return CMD_SUCCESS;
+}
+
static struct cmd_node iuh_node = {
IUH_NODE,
"%s(config-iuh)# ",
@@ -139,6 +186,9 @@
static int config_write_hnodeb(struct vty *vty)
{
vty_out(vty, "hnodeb%s", VTY_NEWLINE);
+ vty_out(vty, " network country code %s%s", osmo_mcc_name(g_hnb->plmn.mcc), VTY_NEWLINE);
+ vty_out(vty, " mobile network code %s%s",
+ osmo_mnc_name(g_hnb->plmn.mnc, g_hnb->plmn.mnc_3_digits), VTY_NEWLINE);
vty_out(vty, " iuh%s", VTY_NEWLINE);
if (g_hnb->iuh.local_addr)
vty_out(vty, " local-ip %s%s", g_hnb->iuh.local_addr, VTY_NEWLINE);
@@ -254,6 +304,8 @@
{
install_element(CONFIG_NODE, &cfg_hnodeb_cmd);
install_node(&hnodeb_node, config_write_hnodeb);
+ install_element(HNODEB_NODE, &cfg_hnodeb_ncc_cmd);
+ install_element(HNODEB_NODE, &cfg_hnodeb_mnc_cmd);
install_element(HNODEB_NODE, &cfg_hnodeb_iuh_cmd);
install_node(&iuh_node, NULL);
install_element(IUH_NODE, &cfg_hnodeb_iuh_local_ip_cmd);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26020
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: I6d67aa547d5496fe1407744e1dde07d2a41df500
Gerrit-Change-Number: 26020
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211028/cc328f78/attachment.htm>