From 72ef4c0cd4129a97d77611aee95131db8d094b0c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 28 Oct 2021 19:46:32 +0200 Subject: [PATCH] Generate proper rnc_id and plmn in LuRequest Change-Id: Ib40b5eb96b7cc13c424076a4ca725019514d52af --- include/osmocom/hnodeb/ranap.h | 2 +- src/osmo-hnodeb/ranap.c | 7 ++++--- src/osmo-hnodeb/vty.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/osmocom/hnodeb/ranap.h b/include/osmocom/hnodeb/ranap.h index df756b1..7864c69 100644 --- a/include/osmocom/hnodeb/ranap.h +++ b/include/osmocom/hnodeb/ranap.h @@ -30,4 +30,4 @@ void hnb_rx_secmode_cmd(struct hnb *hnb, long ip_alg); void hnb_rua_dt_handle_ranap(struct hnb *hnb, struct ranap_message_s *ranap_msg); void hnb_rua_cl_handle_ranap(struct hnb *hnb, struct ranap_message_s *ranap_msg); void hnb_tx_iu_release_req(struct hnb *hnb); -struct msgb *gen_initue_lu(int is_ps, uint32_t conn_id, const char *imsi); +struct msgb *gen_initue_lu(const struct hnb *hnb, int is_ps, uint32_t conn_id, const char *imsi); diff --git a/src/osmo-hnodeb/ranap.c b/src/osmo-hnodeb/ranap.c index fae87b7..3dd759f 100644 --- a/src/osmo-hnodeb/ranap.c +++ b/src/osmo-hnodeb/ranap.c @@ -110,16 +110,17 @@ void hnb_rua_cl_handle_ranap(struct hnb *hnb, } } -struct msgb *gen_initue_lu(int is_ps, uint32_t conn_id, const char *imsi) +struct msgb *gen_initue_lu(const struct hnb *hnb, int is_ps, uint32_t conn_id, const char *imsi) { uint8_t lu[] = { GSM48_PDISC_MM, GSM48_MT_MM_LOC_UPD_REQUEST, 0x70, 0x62, 0xf2, 0x30, 0xff, 0xf3, 0x57, /* len, IMSI/type, IMSI-------------------------------- */ 0x08, 0x29, 0x26, 0x24, 0x10, 0x32, 0x54, 0x76, 0x98, 0x33, 0x03, 0x57, 0x18 , 0xb2 }; - uint8_t plmn_id[] = { 0x09, 0x01, 0x99 }; + uint8_t plmn_id[3]; + osmo_plmn_to_bcd(plmn_id, &hnb->plmn); RANAP_GlobalRNC_ID_t rnc_id = { - .rNC_ID = 23, + .rNC_ID = g_hnb->rnc_id, .pLMNidentity.buf = plmn_id, .pLMNidentity.size = sizeof(plmn_id), }; diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c index 714e00d..61a3f4c 100644 --- a/src/osmo-hnodeb/vty.c +++ b/src/osmo-hnodeb/vty.c @@ -354,7 +354,7 @@ DEFUN(chan, chan_cmd, chan->conn_id = conn_id; conn_id++; - msg = gen_initue_lu(chan->is_ps, chan->conn_id, chan->imsi); + msg = gen_initue_lu(g_hnb, chan->is_ps, chan->conn_id, chan->imsi); rua = rua_new_conn(chan->is_ps, chan->conn_id, msg); hnb_iuh_send(g_hnb, rua);