neels submitted this change.

View Change



5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve neels: Looks good to me, approved Jenkins Builder: Verified
cfg: add 'hnbgw' / 'plmn MCC MNC'

According to 3GPP TS 25.413 8.26.2.2, "The RNC shall include the Global
RNC-ID IE in the RESET message." To be able to do that, osmo-hnbgw needs
to know the local PLMN.

Introduce explicit knowledge of the local PLMN by config, and use this
configured local PLMN in places where the local PLMN was so far derived
otherwise.

Subsequent patches will separately add the RNC-ID to the RANAP RESET
messages.

Since the PLMN is required to send correct RESET and RESET ACK, include
the new 'plmn' config item in all example configurations.

Related: SYS#6441
Change-Id: If404c3859acdfba274c719c7cb7d16f97d831a2a
---
M doc/examples/osmo-hnbgw/osmo-hnbgw-cnpool.cfg
M doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
M doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
M doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_l3.c
M src/osmo-hnbgw/hnbgw_vty.c
M tests/osmo-hnbgw.vty
9 files changed, 115 insertions(+), 6 deletions(-)

diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw-cnpool.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw-cnpool.cfg
index 2d0348d..3236afb 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw-cnpool.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw-cnpool.cfg
@@ -19,6 +19,7 @@
point-code 0.2.0

hnbgw
+ plmn 001 01
iucs
nri bitlen 10
nri null add 0 7
diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
index 601c02e..8be4b1b 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg
@@ -10,6 +10,7 @@
point-code 1.4.2

hnbgw
+ plmn 001 01
iuh
local-ip 0.0.0.0
hnbap-allow-tmsi 1
diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
index cc853d5..087764c 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw-pfcp.cfg
@@ -8,6 +8,7 @@
logging print extended-timestamp 1
logging level set-all notice
hnbgw
+ plmn 001 01
iuh
local-ip 0.0.0.0
hnbap-allow-tmsi 1
diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
index 82731a8..a9edc77 100644
--- a/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
+++ b/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg
@@ -8,6 +8,7 @@
logging print extended-timestamp 1
logging level set-all notice
hnbgw
+ plmn 001 01
iuh
local-ip 0.0.0.0
hnbap-allow-tmsi 1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index ed3cd62..e62fc71 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -6,6 +6,7 @@
#include <osmocom/core/write_queue.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/gsm/gsm23003.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/ctrl/control_if.h>
@@ -253,6 +254,7 @@
/*! The UDP port where we receive multiplexed CS user
* plane traffic from HNBs */
uint16_t iuh_cs_mux_port;
+ struct osmo_plmn_id plmn;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
/*! print hnb-id (true) or MCC-MNC-LAC-RAC-SAC (false) in logs */
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 7faf7f7..086582e 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -57,6 +57,9 @@
g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
g_hnbgw->config.log_prefix_hnb_id = true;

+ /* Set zero PLMN to detect a missing PLMN when transmitting RESET */
+ g_hnbgw->config.plmn = (struct osmo_plmn_id){ 0, 0, false };
+
g_hnbgw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(&g_hnbgw->hnb_list);
INIT_LLIST_HEAD(&g_hnbgw->ue_list);
diff --git a/src/osmo-hnbgw/hnbgw_l3.c b/src/osmo-hnbgw/hnbgw_l3.c
index 6a9c62f..a6b48ce 100644
--- a/src/osmo-hnbgw/hnbgw_l3.c
+++ b/src/osmo-hnbgw/hnbgw_l3.c
@@ -279,15 +279,21 @@

static int peek_l3_initial_ue(struct hnbgw_context_map *map, const RANAP_InitialUE_MessageIEs_t *ies)
{
- struct osmo_plmn_id plmn;
+ struct osmo_plmn_id local_plmn;

- if (ies->lai.pLMNidentity.size < 3) {
- LOGP(DCN, LOGL_ERROR, "Missing PLMN in RANAP InitialUE message\n");
- return -EINVAL;
+ if (g_hnbgw->config.plmn.mcc) {
+ /* The user has configured a PLMN */
+ local_plmn = g_hnbgw->config.plmn;
+ } else {
+ /* The user has not configured a PLMN, guess from the InitialUE message's LAI IE's PLMN */
+ if (ies->lai.pLMNidentity.size < 3) {
+ LOGP(DCN, LOGL_ERROR, "Missing PLMN in RANAP InitialUE message\n");
+ return -EINVAL;
+ }
+ osmo_plmn_from_bcd(ies->lai.pLMNidentity.buf, &local_plmn);
}
- osmo_plmn_from_bcd(ies->lai.pLMNidentity.buf, &plmn);

- return peek_l3_nas(map, ies->nas_pdu.buf, ies->nas_pdu.size, &plmn);
+ return peek_l3_nas(map, ies->nas_pdu.buf, ies->nas_pdu.size, &local_plmn);
}

/* Extract a Layer 3 message (NAS PDU) from the RANAP message, and put the info obtained in map->l3. This is relevant
diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c
index bee34f1..8cbe249 100644
--- a/src/osmo-hnbgw/hnbgw_vty.c
+++ b/src/osmo-hnbgw/hnbgw_vty.c
@@ -281,6 +281,28 @@
return CMD_SUCCESS;
}

+DEFUN(cfg_hnbgw_plmn, cfg_hnbgw_plmn_cmd,
+ "plmn <1-999> <0-999>",
+ "Configure the HNBGW's PLMN. The PLMN is transmitted in RANAP RESET towards the CN.\n"
+ "MCC, Mobile Country Code\n"
+ "MNC, Mobile Network Code\n")
+{
+ struct osmo_plmn_id plmn;
+
+ if (osmo_mcc_from_str(argv[0], &plmn.mcc)) {
+ vty_out(vty, "%% Error decoding MCC: %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (osmo_mnc_from_str(argv[1], &plmn.mnc, &plmn.mnc_3_digits)) {
+ vty_out(vty, "%% Error decoding MNC: %s%s", argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ g_hnbgw->config.plmn = plmn;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_hnbgw_rnc_id, cfg_hnbgw_rnc_id_cmd,
"rnc-id <0-65535>",
"Configure the HNBGW's RNC Id, the common RNC Id used for all connected hNodeB. It is sent to"
@@ -849,6 +871,12 @@
{
vty_out(vty, "hnbgw%s", VTY_NEWLINE);

+ if (g_hnbgw->config.plmn.mcc)
+ vty_out(vty, " plmn %s %s%s",
+ osmo_mcc_name_c(OTC_SELECT, g_hnbgw->config.plmn.mcc),
+ osmo_mnc_name_c(OTC_SELECT, g_hnbgw->config.plmn.mnc, g_hnbgw->config.plmn.mnc_3_digits),
+ VTY_NEWLINE);
+
vty_out(vty, " rnc-id %u%s", g_hnbgw->config.rnc_id, VTY_NEWLINE);

vty_out(vty, " log-prefix %s%s", g_hnbgw->config.log_prefix_hnb_id ? "hnb-id" : "umts-cell-id",
@@ -941,6 +969,7 @@
install_element(CONFIG_NODE, &cfg_hnbgw_cmd);
install_node(&hnbgw_node, config_write_hnbgw);

+ install_element(HNBGW_NODE, &cfg_hnbgw_plmn_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_rnc_id_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_log_prefix_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_max_sccp_cr_payload_len_cmd);
diff --git a/tests/osmo-hnbgw.vty b/tests/osmo-hnbgw.vty
index 72916fb..41bcb73 100644
--- a/tests/osmo-hnbgw.vty
+++ b/tests/osmo-hnbgw.vty
@@ -11,6 +11,7 @@
OsmoHNBGW(config)# hnbgw
OsmoHNBGW(config-hnbgw)# list
...
+ plmn <1-999> <0-999>
rnc-id <0-65535>
log-prefix (hnb-id|umts-cell-id)
iuh
@@ -18,6 +19,46 @@
iups
...

+OsmoHNBGW(config-hnbgw)# plmn?
+ plmn Configure the HNBGW's PLMN. The PLMN is transmitted in RANAP RESET towards the CN.
+OsmoHNBGW(config-hnbgw)# plmn ?
+ <1-999> MCC, Mobile Country Code
+OsmoHNBGW(config-hnbgw)# plmn 1 ?
+ <0-999> MNC, Mobile Network Code
+OsmoHNBGW(config-hnbgw)# show running-config
+... !plmn
+OsmoHNBGW(config-hnbgw)# plmn 001 01
+OsmoHNBGW(config-hnbgw)# show running-config
+...
+hnbgw
+...
+ plmn 001 01
+...
+
+OsmoHNBGW(config-hnbgw)# plmn 001 001
+OsmoHNBGW(config-hnbgw)# show running-config
+...
+hnbgw
+...
+ plmn 001 001
+...
+
+OsmoHNBGW(config-hnbgw)# plmn 999 999
+OsmoHNBGW(config-hnbgw)# show running-config
+...
+hnbgw
+...
+ plmn 999 999
+...
+
+OsmoHNBGW(config-hnbgw)# plmn 23 42
+OsmoHNBGW(config-hnbgw)# show running-config
+...
+hnbgw
+...
+ plmn 023 42
+...
+
OsmoHNBGW(config-hnbgw)# rnc-id?
rnc-id Configure the HNBGW's RNC Id, the common RNC Id used for all connected hNodeB. It is sent to each hNodeB upon HNBAP HNB-Register-Accept, and the hNodeB will subsequently send this as RANAP InitialUE Messages' GlobalRNC-ID IE. Takes effect as soon as the hNodeB re-registers.


To view, visit change 33178. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: If404c3859acdfba274c719c7cb7d16f97d831a2a
Gerrit-Change-Number: 33178
Gerrit-PatchSet: 8
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged