Change in osmo-hnodeb[master]: Drop NAS and RANAP code and VTY commands

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.org
Tue Nov 30 10:05:57 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26412 )

Change subject: Drop NAS and RANAP code and VTY commands
......................................................................

Drop NAS and RANAP code and VTY commands

The higher level bits were used in originally imported hnb-test code in
order to control interaction with the HNBGW over the VTY. This is no
longer needed in osmo-hnodeb, as NAS is in layers above the ones being
handled by an hNodeB.
Regarding RANAP, most of it is going to be handled by the LowerLayer UD
socket peer to be introduced in the future, so we can drop most of it,
as in osmo-hnodeb we'll basically be speaking RUA to the HNBGW and
passing RANAP buffers transparently.
We keep the .c/.h files since some small helpers functions will be
ntroduced later on when adding support for the mentioned LL socket.

Related: SYS#5516
Change-Id: I6aae54734c1c4607beede19169f16bafe35b3a61
---
M include/osmocom/hnodeb/Makefile.am
M include/osmocom/hnodeb/hnodeb.h
D include/osmocom/hnodeb/nas.h
M include/osmocom/hnodeb/ranap.h
M include/osmocom/hnodeb/rua.h
M include/osmocom/hnodeb/vty.h
M src/osmo-hnodeb/Makefile.am
M src/osmo-hnodeb/debug.c
D src/osmo-hnodeb/nas.c
M src/osmo-hnodeb/ranap.c
M src/osmo-hnodeb/rua.c
M src/osmo-hnodeb/vty.c
12 files changed, 2 insertions(+), 550 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/hnodeb/Makefile.am b/include/osmocom/hnodeb/Makefile.am
index b1acb7e..6fa587d 100644
--- a/include/osmocom/hnodeb/Makefile.am
+++ b/include/osmocom/hnodeb/Makefile.am
@@ -3,7 +3,6 @@
 	hnbap.h \
 	hnodeb.h \
 	iuh.h \
-	nas.h \
 	ranap.h \
 	rua.h \
 	vty.h \
diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index 3bc2fb3..a629b4e 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -34,7 +34,6 @@
 	DRUA,
 	DRANAP,
 	DSCTP,
-	DNAS,
 };
 extern const struct log_info hnb_log_info;
 
diff --git a/include/osmocom/hnodeb/nas.h b/include/osmocom/hnodeb/nas.h
deleted file mode 100644
index f6a7976..0000000
--- a/include/osmocom/hnodeb/nas.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* (C) 2015 by Daniel Willmann <dwillmann at sysmocom.de>
- * (C) 2021 by sysmocom - s.f.m.c. GmbH <info at sysmocom.de>
- * Author: Pau Espin Pedrol <pespin at sysmocom.de>
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/lienses/>.
- *
- */
-
-#pragma once
-
-struct hnb;
-void hnb_nas_rx_dtap(struct hnb *hnb, void *data, int len);
diff --git a/include/osmocom/hnodeb/ranap.h b/include/osmocom/hnodeb/ranap.h
index 15e0609..474de70 100644
--- a/include/osmocom/hnodeb/ranap.h
+++ b/include/osmocom/hnodeb/ranap.h
@@ -19,15 +19,4 @@
  */
 #pragma once
 
-struct hnb;
-struct ranap_message_s;
-#include <osmocom/hnodeb/hnodeb.h>
 
-void hnb_rx_iu_release(struct hnb *hnb);
-void hnb_rx_paging(struct hnb *hnb, const char *imsi);
-void hnb_rx_secmode_cmd(struct hnb *hnb, long ip_alg);
-
-void hnb_rua_dt_handle_ranap(void *ctx, struct ranap_message_s *ranap_msg);
-void hnb_rua_cl_handle_ranap(void *ctx, struct ranap_message_s *ranap_msg);
-void hnb_tx_iu_release_req(struct hnb *hnb);
-struct msgb *gen_initue_lu(const struct hnb *hnb, int is_ps, uint32_t conn_id, const char *imsi);
diff --git a/include/osmocom/hnodeb/rua.h b/include/osmocom/hnodeb/rua.h
index 52221be..ea7e81c 100644
--- a/include/osmocom/hnodeb/rua.h
+++ b/include/osmocom/hnodeb/rua.h
@@ -25,4 +25,3 @@
 struct msgb;
 
 int hnb_rua_rx(struct hnb *hnb, struct msgb *msg);
-int hnb_tx_dt(struct hnb *hnb, struct msgb *txm);
diff --git a/include/osmocom/hnodeb/vty.h b/include/osmocom/hnodeb/vty.h
index 7144d3f..e30019e 100644
--- a/include/osmocom/hnodeb/vty.h
+++ b/include/osmocom/hnodeb/vty.h
@@ -27,7 +27,6 @@
 enum hnb_vty_nodes {
 	HNODEB_NODE = _LAST_OSMOVTY_NODE,
 	IUH_NODE,
-	CHAN_NODE,
 };
 
 void hnb_vty_init(void);
diff --git a/src/osmo-hnodeb/Makefile.am b/src/osmo-hnodeb/Makefile.am
index 7325728..82ccd37 100644
--- a/src/osmo-hnodeb/Makefile.am
+++ b/src/osmo-hnodeb/Makefile.am
@@ -35,7 +35,6 @@
 	hnb.c \
 	hnb_shutdown_fsm.c \
 	iuh.c \
-	nas.c \
 	ranap.c \
 	rua.c \
 	vty.c \
diff --git a/src/osmo-hnodeb/debug.c b/src/osmo-hnodeb/debug.c
index 10d1655..45ccc0c 100644
--- a/src/osmo-hnodeb/debug.c
+++ b/src/osmo-hnodeb/debug.c
@@ -47,11 +47,6 @@
 		.color = "\033[1;36m",
 		.description = "SCTP connection on the Iuh link",
 	},
-	[DNAS] = {
-		.name = "NAS", .loglevel = LOGL_NOTICE, .enabled = 1,
-		.color = "\033[1;32m",
-		.description = "Non-Access Stratum",
-	},
 };
 
 const struct log_info hnb_log_info = {
diff --git a/src/osmo-hnodeb/nas.c b/src/osmo-hnodeb/nas.c
deleted file mode 100644
index 293c46e..0000000
--- a/src/osmo-hnodeb/nas.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* (C) 2015 by Daniel Willmann <dwillmann at sysmocom.de>
- * (C) 2021 by sysmocom - s.f.m.c. GmbH <info at sysmocom.de>
- * Author: Pau Espin Pedrol <pespin at sysmocom.de>
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/lienses/>.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include <osmocom/core/msgb.h>
-#include <osmocom/gsm/tlv.h>
-#include <osmocom/gsm/protocol/gsm_04_08.h>
-#include <osmocom/gsm/gsm48.h>
-#include <osmocom/crypt/auth.h>
-
-#include <osmocom/ranap/ranap_msg_factory.h>
-
-#include <osmocom/hnodeb/rua.h>
-#include <osmocom/hnodeb/ranap.h>
-#include <osmocom/hnodeb/nas.h>
-#include <osmocom/hnodeb/hnodeb.h>
-
-static struct msgb *gen_nas_id_resp()
-{
-	uint8_t id_resp[] = {
-		GSM48_PDISC_MM,
-		GSM48_MT_MM_ID_RESP,
-		/* IMEISV */
-		0x09, /* len */
-		0x03, /* first digit (0000) + even (0) + id IMEISV (011) */
-		0x31, 0x91, 0x06, 0x00, 0x28, 0x47, 0x11, /* digits */
-		0xf2, /* filler (1111) + last digit (0010) */
-	};
-
-	return ranap_new_msg_dt(0, id_resp, sizeof(id_resp));
-}
-
-static struct msgb *gen_nas_tmsi_realloc_compl()
-{
-	uint8_t id_resp[] = {
-		GSM48_PDISC_MM,
-		GSM48_MT_MM_TMSI_REALL_COMPL,
-	};
-
-	return ranap_new_msg_dt(0, id_resp, sizeof(id_resp));
-}
-
-static struct msgb *gen_nas_auth_resp(uint8_t *sres)
-{
-	uint8_t id_resp[] = {
-		GSM48_PDISC_MM,
-		0x80 | GSM48_MT_MM_AUTH_RESP, /* simulate sequence nr 2 */
-		0x61, 0xb5, 0x69, 0xf5 /* hardcoded SRES */
-	};
-
-	memcpy(id_resp + 2, sres, 4);
-
-	return ranap_new_msg_dt(0, id_resp, sizeof(id_resp));
-}
-
-static struct tlv_parsed *parse_mm(struct gsm48_hdr *gh, int len)
-{
-	static struct tlv_parsed tp;
-	int parse_res;
-
-	len -= (const char *)&gh->data[0] - (const char *)gh;
-
-	OSMO_ASSERT(gsm48_hdr_pdisc(gh) == GSM48_PDISC_MM);
-
-	parse_res = tlv_parse(&tp, &gsm48_mm_att_tlvdef, &gh->data[0], len, 0, 0);
-	if (parse_res <= 0) {
-		uint8_t msg_type = gsm48_hdr_msg_type(gh);
-		LOGP(DNAS, LOGL_ERROR, "Error parsing MM message 0x%hhx: %d\n", msg_type, parse_res);
-		return NULL;
-	}
-
-	return &tp;
-}
-
-int hnb_nas_rx_lu_accept(struct gsm48_hdr *gh, int len, int *sent_tmsi)
-{
-	LOGP(DNAS, LOGL_INFO, " :D Location Update Accept :D\n");
-	struct gsm48_loc_area_id *lai;
-
-	lai = (struct gsm48_loc_area_id *)&gh->data[0];
-
-	struct osmo_location_area_id laid;
-	gsm48_decode_lai2(lai, &laid);
-	LOGP(DNAS, LOGL_INFO, "LU: mcc %s  mnc %s  lac %hd\n",
-	       osmo_mcc_name(laid.plmn.mcc), osmo_mnc_name(laid.plmn.mnc, laid.plmn.mnc_3_digits),
-	       laid.lac);
-
-	struct tlv_parsed tp;
-	int parse_res;
-
-	len -= (const char *)&gh->data[0] - (const char *)gh;
-	parse_res = tlv_parse(&tp, &gsm48_mm_att_tlvdef, &gh->data[0], len, 0, 0);
-	if (parse_res <= 0) {
-		LOGP(DNAS, LOGL_ERROR, "Error parsing Location Update Accept message: %d\n", parse_res);
-		return -1;
-	}
-
-	if (TLVP_PRESENT(&tp, GSM48_IE_MOBILE_ID)) {
-		uint8_t type = TLVP_VAL(&tp, GSM48_IE_NAME_SHORT)[0] & 0x0f;
-		if (type == GSM_MI_TYPE_TMSI)
-			*sent_tmsi = 1;
-		else *sent_tmsi = 0;
-	}
-	return 0;
-}
-
-void hnb_nas_rx_mm_info(struct gsm48_hdr *gh, int len)
-{
-	LOGP(DNAS, LOGL_INFO, " :) MM Info :)\n");
-	struct tlv_parsed *tp = parse_mm(gh, len);
-	if (!tp)
-		return;
-
-	if (TLVP_PRESENT(tp, GSM48_IE_NAME_SHORT)) {
-		char name[128] = {0};
-		gsm_7bit_decode_n(name, 127,
-				  TLVP_VAL(tp, GSM48_IE_NAME_SHORT)+1,
-				  (TLVP_LEN(tp, GSM48_IE_NAME_SHORT)-1)*8/7);
-		LOGP(DNAS, LOGL_INFO, "Info: Short Network Name: %s\n", name);
-	}
-
-	if (TLVP_PRESENT(tp, GSM48_IE_NAME_LONG)) {
-		char name[128] = {0};
-		gsm_7bit_decode_n(name, 127,
-				  TLVP_VAL(tp, GSM48_IE_NAME_LONG)+1,
-				  (TLVP_LEN(tp, GSM48_IE_NAME_LONG)-1)*8/7);
-		LOGP(DNAS, LOGL_INFO, "Info: Long Network Name: %s\n", name);
-	}
-}
-
-static int hnb_nas_rx_auth_req(struct hnb *hnb, struct gsm48_hdr *gh,
-				    int len)
-{
-	struct gsm48_auth_req *ar;
-
-	len -= (const char *)&gh->data[0] - (const char *)gh;
-
-	if (len < sizeof(*ar)) {
-		LOGP(DNAS, LOGL_ERROR, "GSM48 Auth Req does not fit.\n");
-		return -1;
-	}
-
-	LOGP(DNAS, LOGL_INFO, " :) Authentication Request :)\n");
-
-	ar = (struct gsm48_auth_req*) &gh->data[0];
-	int seq = ar->key_seq;
-
-	/* Generate SRES from *HARDCODED* Ki for Iuh testing */
-	struct osmo_auth_vector vec;
-	/* Ki 000102030405060708090a0b0c0d0e0f */
-	struct osmo_sub_auth_data auth = {
-		.type	= OSMO_AUTH_TYPE_GSM,
-		.algo	= OSMO_AUTH_ALG_COMP128v1,
-		.u.gsm.ki = {
-			0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
-			0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,
-			0x0e, 0x0f
-		},
-	};
-
-	memset(&vec, 0, sizeof(vec));
-	osmo_auth_gen_vec(&vec, &auth, ar->rand);
-
-	LOGP(DNAS, LOGL_DEBUG, "seq %d rand %s",
-	       seq, osmo_hexdump(ar->rand, sizeof(ar->rand)));
-	LOGP(DNAS, LOGL_DEBUG, " --> sres %s\n",
-	       osmo_hexdump(vec.sres, 4));
-
-	return hnb_tx_dt(hnb, gen_nas_auth_resp(vec.sres));
-}
-
-static int hnb_nas_rx_mm(struct hnb *hnb, struct gsm48_hdr *gh, int len)
-{
-	struct hnb_chan *chan;
-
-	chan = hnb->cs.chan;
-	if (!chan) {
-		LOGP(DNAS, LOGL_ERROR, "hnb_nas_rx_mm(): No CS channel established yet.\n");
-		return -1;
-	}
-
-	OSMO_ASSERT(!chan->is_ps);
-
-	uint8_t msg_type = gsm48_hdr_msg_type(gh);
-	int sent_tmsi;
-
-	switch (msg_type) {
-	case GSM48_MT_MM_ID_REQ:
-		return hnb_tx_dt(hnb, gen_nas_id_resp());
-
-	case GSM48_MT_MM_LOC_UPD_ACCEPT:
-		if (hnb_nas_rx_lu_accept(gh, len, &sent_tmsi))
-			return -1;
-		if (sent_tmsi)
-			return hnb_tx_dt(hnb, gen_nas_tmsi_realloc_compl());
-		else
-			return 0;
-
-	case GSM48_MT_MM_LOC_UPD_REJECT:
-		LOGP(DNAS, LOGL_INFO, "Received Location Update Reject\n");
-		return 0;
-
-	case GSM48_MT_MM_INFO:
-		hnb_nas_rx_mm_info(gh, len);
-		hnb_tx_iu_release_req(hnb);
-		return 0;
-
-	case GSM48_MT_MM_AUTH_REQ:
-		return hnb_nas_rx_auth_req(hnb, gh, len);
-
-	default:
-		LOGP(DNAS, LOGL_INFO, "04.08 message type not handled by hnb-test: 0x%x\n",
-		       msg_type);
-		return 0;
-	}
-
-}
-
-void hnb_nas_rx_dtap(struct hnb *hnb, void *data, int len)
-{
-	int rc;
-	LOGP(DNAS, LOGL_INFO, "got %d bytes: %s\n", len, osmo_hexdump(data, len));
-
-	// nas_pdu == '05 08 12' ==> IMEI Identity request
-	//            '05 04 0d' ==> LU reject
-
-	struct gsm48_hdr *gh = data;
-	if (len < sizeof(*gh)) {
-		LOGP(DNAS, LOGL_ERROR, "hnb_nas_rx_dtap(): NAS PDU is too short: %d. Ignoring.\n",
-		       len);
-		return;
-	}
-	uint8_t pdisc = gsm48_hdr_pdisc(gh);
-
-	switch (pdisc) {
-	case GSM48_PDISC_MM:
-		rc = hnb_nas_rx_mm(hnb, gh, len);
-		if (rc != 0)
-			LOGP(DNAS, LOGL_ERROR, "Error receiving MM message: %d\n", rc);
-		return;
-	default:
-		LOGP(DNAS, LOGL_NOTICE, "04.08 discriminator not handled by hnb-test: %d\n",
-		       pdisc);
-		return;
-	}
-}
diff --git a/src/osmo-hnodeb/ranap.c b/src/osmo-hnodeb/ranap.c
index b5b7b9c..99c4bab 100644
--- a/src/osmo-hnodeb/ranap.c
+++ b/src/osmo-hnodeb/ranap.c
@@ -25,152 +25,5 @@
 #include <osmocom/ranap/iu_helpers.h>
 #include <osmocom/ranap/ranap_msg_factory.h>
 
-#include <osmocom/hnodeb/nas.h>
 #include <osmocom/hnodeb/rua.h>
 #include <osmocom/hnodeb/ranap.h>
-
-static const char *printstr(OCTET_STRING_t *s)
-{
-	return osmo_hexdump((const unsigned char*)s->buf, s->size);
-}
-
-#define PP(octet_string_t) \
-	LOGP(DRANAP, LOGL_INFO, #octet_string_t " = %s\n",\
-	       printstr(&octet_string_t))
-
-void hnb_rua_dt_handle_ranap(void *ctx, struct ranap_message_s *ranap_msg)
-{
-	struct hnb *hnb = (struct hnb *)ctx;
-	int len;
-	uint8_t *data;
-	RANAP_PermittedIntegrityProtectionAlgorithms_t *algs;
-	RANAP_IntegrityProtectionAlgorithm_t *first_alg;
-
-	LOGP(DRANAP, LOGL_INFO, "rx ranap_msg->procedureCode %d\n",
-	       ranap_msg->procedureCode);
-
-	switch (ranap_msg->procedureCode) {
-	case RANAP_ProcedureCode_id_DirectTransfer:
-		LOGP(DRANAP, LOGL_INFO, "rx DirectTransfer: presence = %hx\n",
-		       ranap_msg->msg.directTransferIEs.presenceMask);
-		PP(ranap_msg->msg.directTransferIEs.nas_pdu);
-
-		len = ranap_msg->msg.directTransferIEs.nas_pdu.size;
-		data = ranap_msg->msg.directTransferIEs.nas_pdu.buf;
-
-		hnb_nas_rx_dtap(hnb, data, len);
-		return;
-
-	case RANAP_ProcedureCode_id_SecurityModeControl:
-		LOGP(DRANAP, LOGL_INFO, "rx SecurityModeControl: presence = %hx\n",
-		       ranap_msg->msg.securityModeCommandIEs.presenceMask);
-
-		/* Just pick the first available IP alg, don't care about
-		 * encryption (yet?) */
-		algs = &ranap_msg->msg.securityModeCommandIEs.integrityProtectionInformation.permittedAlgorithms;
-		if (algs->list.count < 1) {
-			LOGP(DRANAP, LOGL_INFO, "Security Mode Command: No permitted algorithms.\n");
-			return;
-		}
-		first_alg = *algs->list.array;
-
-		hnb_rx_secmode_cmd(hnb, *first_alg);
-		return;
-
-	case RANAP_ProcedureCode_id_Iu_Release:
-		hnb_rx_iu_release(hnb);
-		return;
-	}
-}
-
-void hnb_rua_cl_handle_ranap(void *ctx, struct ranap_message_s *ranap_msg)
-{
-	struct hnb *hnb = (struct hnb *)ctx;
-	char imsi[16];
-
-	LOGP(DRANAP, LOGL_INFO, "rx ranap_msg->procedureCode %d\n",
-	       ranap_msg->procedureCode);
-
-	switch (ranap_msg->procedureCode) {
-	case RANAP_ProcedureCode_id_Paging:
-		if (ranap_msg->msg.pagingIEs.permanentNAS_UE_ID.present == RANAP_PermanentNAS_UE_ID_PR_iMSI) {
-			ranap_bcd_decode(imsi, sizeof(imsi),
-					 ranap_msg->msg.pagingIEs.permanentNAS_UE_ID.choice.iMSI.buf,
-					 ranap_msg->msg.pagingIEs.permanentNAS_UE_ID.choice.iMSI.size);
-		} else imsi[0] = '\0';
-
-		LOGP(DRANAP, LOGL_INFO, "rx Paging: presence=%hx  domain=%ld  IMSI=%s\n",
-		       ranap_msg->msg.pagingIEs.presenceMask,
-		       ranap_msg->msg.pagingIEs.cN_DomainIndicator,
-		       imsi
-		       );
-
-		hnb_rx_paging(hnb, imsi);
-		return;
-	}
-}
-
-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[3];
-	osmo_plmn_to_bcd(plmn_id, &hnb->plmn);
-	RANAP_GlobalRNC_ID_t rnc_id = {
-		.rNC_ID = g_hnb->rnc_id,
-		.pLMNidentity.buf = plmn_id,
-		.pLMNidentity.size = sizeof(plmn_id),
-	};
-
-	/* FIXME: patch imsi */
-	/* Note: the Mobile Identitiy IE's IMSI data has the identity type and
-	 * an even/odd indicator bit encoded in the first octet. So the first
-	 * octet looks like this:
-	 *
-	 *   8  7  6  5 | 4        | 3 2 1
-	 *   IMSI-digit | even/odd | type
-	 *
-	 * followed by the remaining IMSI digits.
-	 * If digit count is even (bit 4 == 0), that first high-nibble is 0xf.
-	 * (derived from Iu pcap Location Update Request msg and TS 25.413)
-	 *
-	 * TODO I'm only 90% sure about this
-	 */
-
-	return ranap_new_msg_initial_ue(conn_id, is_ps, &rnc_id, lu, sizeof(lu));
-}
-
-void hnb_tx_iu_release_req(struct hnb *hnb)
-{
-	RANAP_Cause_t cause = {
-		.present = RANAP_Cause_PR_radioNetwork,
-		.choice.transmissionNetwork = RANAP_CauseRadioNetwork_release_due_to_UE_generated_signalling_connection_release,
-	};
-	hnb_tx_dt(hnb, ranap_new_msg_iu_rel_req(&cause));
-}
-
-void hnb_tx_iu_release_compl(struct hnb *hnb)
-{
-	hnb_tx_dt(hnb, ranap_new_msg_iu_rel_compl());
-}
-
-void hnb_rx_secmode_cmd(struct hnb *hnb, long ip_alg)
-{
-	LOGP(DRANAP, LOGL_INFO, " :) Security Mode Command :)\n");
-	/* not caring about encryption yet, just pass 0 for No Encryption. */
-	hnb_tx_dt(hnb, ranap_new_msg_sec_mod_compl(ip_alg, 0));
-}
-
-void hnb_rx_iu_release(struct hnb *hnb)
-{
-	hnb_tx_iu_release_compl(hnb);
-}
-
-void hnb_rx_paging(struct hnb *hnb, const char *imsi)
-{
-	LOGP(DRANAP, LOGL_INFO, " :) Paging Request for %s :)\n", imsi);
-	/* TODO reply */
-}
diff --git a/src/osmo-hnodeb/rua.c b/src/osmo-hnodeb/rua.c
index 907cd60..9bf5403 100644
--- a/src/osmo-hnodeb/rua.c
+++ b/src/osmo-hnodeb/rua.c
@@ -21,6 +21,7 @@
 #include <errno.h>
 
 #include <asn1c/ANY.h>
+#include <asn1c/asn1helpers.h>
 
 #include <osmocom/rua/rua_ies_defs.h>
 #include <osmocom/ranap/ranap_common_cn.h>
@@ -29,22 +30,7 @@
 #include <osmocom/hnodeb/rua.h>
 #include <osmocom/hnodeb/ranap.h>
 #include <osmocom/hnodeb/iuh.h>
-
-int hnb_tx_dt(struct hnb *hnb, struct msgb *txm)
-{
-	struct hnb_chan *chan;
-	struct msgb *rua;
-
-	chan = hnb->cs.chan;
-	if (!chan) {
-		LOGP(DRUA, LOGL_INFO, "hnb_nas_tx_tmsi_realloc_compl(): No CS channel established yet.\n");
-		return -1;
-	}
-
-	rua = rua_new_dt(chan->is_ps, chan->conn_id, txm);
-	hnb_iuh_send(hnb, rua);
-	return 0;
-}
+#include <osmocom/hnodeb/hnodeb.h>
 
 static void hnb_rua_dt_handle(struct hnb *hnb, ANY_t *in)
 {
@@ -57,7 +43,6 @@
 		return;
 	}
 
-	rc = ranap_cn_rx_co(hnb_rua_dt_handle_ranap, hnb, ies.ranaP_Message.buf, ies.ranaP_Message.size);
 
 	/* FIXME: what to do with the asn1c-allocated memory */
 	rua_free_directtransferies(&ies);
@@ -74,7 +59,6 @@
 		return;
 	}
 
-	rc = ranap_cn_rx_cl(hnb_rua_cl_handle_ranap, hnb, ies.ranaP_Message.buf, ies.ranaP_Message.size);
 
 	/* FIXME: what to do with the asn1c-allocated memory */
 	rua_free_connectionlesstransferies(&ies);
diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c
index e11fc2d..93ec25f 100644
--- a/src/osmo-hnodeb/vty.c
+++ b/src/osmo-hnodeb/vty.c
@@ -270,41 +270,9 @@
 }
 
 
-static struct cmd_node chan_node = {
-	CHAN_NODE,
-	"%s(chan)> ",
-	1,
-};
-
-#define HNBAP_STR	"HNBAP related commands\n"
-#define HNB_STR		"HomeNodeB commands\n"
-#define UE_STR		"User Equipment commands\n"
 #define RANAP_STR	"RANAP related commands\n"
 #define CSPS_STR	"Circuit Switched\n" "Packet Switched\n"
 
-DEFUN(hnb_register, hnb_register_cmd,
-	"hnbap hnb register", HNBAP_STR HNB_STR "Send HNB-REGISTER REQUEST")
-{
-	hnb_send_register_req(g_hnb);
-
-	return CMD_SUCCESS;
-}
-
-DEFUN(hnb_deregister, hnb_deregister_cmd,
-	"hnbap hnb deregister", HNBAP_STR HNB_STR "Send HNB-DEREGISTER REQUEST")
-{
-	hnb_send_deregister_req(g_hnb);
-
-	return CMD_SUCCESS;
-}
-
-DEFUN(ue_register, ue_register_cmd,
-	"hnbap ue register IMSI", HNBAP_STR UE_STR "Send UE-REGISTER REQUEST")
-{
-	hnb_ue_register_tx(g_hnb, argv[0]);
-
-	return CMD_SUCCESS;
-}
 
 DEFUN(asn_dbg, asn_dbg_cmd,
 	"asn-debug (1|0)", "Enable or disable libasn1c debugging")
@@ -336,40 +304,6 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(chan, chan_cmd,
-	"channel (cs|ps) lu imsi IMSI",
-	"Open a new Signalling Connection\n"
-	"To Circuit-Switched CN\n"
-	"To Packet-Switched CN\n"
-	"Performing a Location Update\n"
-	)
-{
-	struct hnb_chan *chan;
-	struct msgb *msg, *rua;
-	static uint16_t conn_id = 42;
-
-	chan = talloc_zero(tall_hnb_ctx, struct hnb_chan);
-	if (!strcmp(argv[0], "ps"))
-		chan->is_ps = 1;
-	chan->imsi = talloc_strdup(chan, argv[1]);
-	chan->conn_id = conn_id;
-	conn_id++;
-
-	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);
-
-	vty->index = chan;
-	vty->node = CHAN_NODE;
-
-	if (!chan->is_ps)
-		g_hnb->cs.chan = chan;
-
-
-	return CMD_SUCCESS;
-}
-
 void hnb_vty_init(void)
 {
 	install_element(CONFIG_NODE, &cfg_hnodeb_cmd);
@@ -389,11 +323,5 @@
 	install_element(IUH_NODE, &cfg_hnodeb_iuh_remote_port_cmd);
 
 	install_element_ve(&asn_dbg_cmd);
-	install_element_ve(&hnb_register_cmd);
-	install_element_ve(&hnb_deregister_cmd);
-	install_element_ve(&ue_register_cmd);
 	install_element_ve(&ranap_reset_cmd);
-	install_element_ve(&chan_cmd);
-
-	install_node(&chan_node, NULL);
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26412
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: I6aae54734c1c4607beede19169f16bafe35b3a61
Gerrit-Change-Number: 26412
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211130/70cef921/attachment.htm>


More information about the gerrit-log mailing list