Change in osmo-bsc[master]: lchan activation: add explicit encryption info to activation

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Apr 12 03:51:18 UTC 2019


Neels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/13582 )

Change subject: lchan activation: add explicit encryption info to activation
......................................................................

lchan activation: add explicit encryption info to activation

For intra-BSC handover, the previous encryption is copied from the old lchan,
which of course is not available during inter-BSC handover.  Hence the lchan
activation info needs to include an explicit encryption information, and we
must not rely on the presence of the previous lchan to copy encryption
information from.

Add struct lchan_activate_info.encr to allow passing encryption info through
lchan_activate() without requiring a previous struct gsm_lchan to be present.

Instead of copying from the old lchan, always copy encryption info to
lchan_activate_info, and during activation, just before sending the Channel
Activation, copy the lchan_activate_info.encr to the new lchan.

This prepares for upcoming I5b269f50bd2092516bfdf87746196983d3ac49d1 which
obtains the encryption information from an intra-BSC-incoming Handover Request
message.

Related: OS#3842
Related: I5b269f50bd2092516bfdf87746196983d3ac49d1
Change-Id: Ib3d259a5711add65ab7298bfa3977855a17a1642
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/handover_fsm.c
M src/osmo-bsc/lchan_fsm.c
4 files changed, 10 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 47ca5e8..ba28a6b 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -528,6 +528,7 @@
 	/* This always is for a specific lchan, so its lchan->type indicates full or half rate.
 	 * When a dyn TS was selected, the lchan->type has been set to the desired rate. */
 	enum gsm48_chan_mode chan_mode;
+	struct gsm_encr encr;
 	/* AMR config */
 	uint16_t s15_s0;
 	bool requires_voice_stream;
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index c17b555..9c0c400 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -484,6 +484,7 @@
 		.activ_for = FOR_ASSIGNMENT,
 		.for_conn = conn,
 		.chan_mode = conn->lchan->ch_mode_rate.chan_mode,
+		.encr = conn->lchan->encr,
 		.s15_s0 = conn->lchan->ch_mode_rate.s15_s0,
 		.requires_voice_stream = conn->assignment.requires_voice_stream,
 		.msc_assigned_cic = req->msc_assigned_cic,
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index a3d25d6..9c86b70 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -358,6 +358,7 @@
 		.activ_for = FOR_HANDOVER,
 		.for_conn = conn,
 		.chan_mode = conn->lchan->tch_mode,
+		.encr = conn->lchan->encr,
 		.requires_voice_stream = conn->lchan->mgw_endpoint_ci_bts ? true : false,
 		.msc_assigned_cic = conn->ho.inter_bsc_in.msc_assigned_cic,
 		.re_use_mgw_endpoint_from_lchan = conn->lchan,
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 2b7dc97..7af2ea0 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -518,14 +518,6 @@
 
 	lchan->conn = info->for_conn;
 
-	if (old_lchan)
-		lchan->encr = old_lchan->encr;
-	else {
-		lchan->encr = (struct gsm_encr){
-			.alg_id = RSL_ENC_ALG_A5(0),	/* no encryption */
-		};
-	}
-
 	/* If there is a previous lchan, and the new lchan is on the same cell as previous one,
 	 * take over power and TA values. Otherwise, use max power and zero TA. */
 	if (old_lchan && old_lchan->ts->trx->bts == bts) {
@@ -585,14 +577,17 @@
 	use_mgwep_ci = lchan_use_mgw_endpoint_ci_bts(lchan);
 
 	LOG_LCHAN(lchan, LOGL_INFO,
-		  "Activation requested: %s voice=%s MGW-ci=%s type=%s tch-mode=%s\n",
+		  "Activation requested: %s voice=%s MGW-ci=%s type=%s tch-mode=%s encr-alg=A5/%u ck=%s\n",
 		  lchan_activate_mode_name(lchan->activate.info.activ_for),
 		  lchan->activate.info.requires_voice_stream ? "yes" : "no",
 		  lchan->activate.info.requires_voice_stream ?
 			(use_mgwep_ci ? mgwep_ci_name(use_mgwep_ci) : "new")
 			: "none",
 		  gsm_lchant_name(lchan->type),
-		  gsm48_chan_mode_name(lchan->tch_mode));
+		  gsm48_chan_mode_name(lchan->tch_mode),
+		  (lchan->activate.info.encr.alg_id ? : 1)-1,
+		  lchan->activate.info.encr.key_len ? osmo_hexdump_nospc(lchan->activate.info.encr.key,
+									 lchan->activate.info.encr.key_len) : "none");
 
 	/* Ask for the timeslot to make ready for this lchan->type.
 	 * We'll receive LCHAN_EV_TS_READY or LCHAN_EV_TS_ERROR in response. */
@@ -657,6 +652,8 @@
 		break;
 	}
 
+	lchan->encr = lchan->activate.info.encr;
+
 	rc = rsl_tx_chan_activ(lchan, act_type, ho_ref);
 	if (rc)
 		lchan_fail_to(LCHAN_ST_UNUSED, "Tx Chan Activ failed: %s (%d)", strerror(-rc), rc);

-- 
To view, visit https://gerrit.osmocom.org/13582
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3d259a5711add65ab7298bfa3977855a17a1642
Gerrit-Change-Number: 13582
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190412/02dfac14/attachment.html>


More information about the gerrit-log mailing list