Change in osmo-msc[master]: move gsm_auth_tuple to vlr.h as vlr_auth_tuple

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Nov 30 21:49:09 UTC 2018


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

Change subject: move gsm_auth_tuple to vlr.h as vlr_auth_tuple
......................................................................

move gsm_auth_tuple to vlr.h as vlr_auth_tuple

Along goes GSM_KEYSEQ_INVAL as VLR_*.

It's where it logically belongs, and is almost the only reason why vlr.h
includes gsm_data.h. The remaining reason, GSM_EXTENSION_LENGTH, will be moved
by upcoming patch.

Change-Id: I122feae7ee3cbc59e941daef35a954bce29fec76
---
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/vlr.h
M src/libmsc/gsm_04_08.c
M src/libmsc/msc_vty.c
M src/libvlr/vlr.c
M src/libvlr/vlr_auth_fsm.c
M tests/msc_vlr/msc_vlr_tests.c
7 files changed, 27 insertions(+), 26 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve



diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 3ffa100..30a3c79 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -42,13 +42,6 @@
 		     struct msgb *msg,
 		     void *data, void *param);
 
-struct gsm_auth_tuple {
-	int use_count;
-	int key_seq;
-	struct osmo_auth_vector vec;
-};
-#define GSM_KEY_SEQ_INVAL	7	/* GSM 04.08 - 10.5.1.2 */
-
 enum {
 	MSC_CTR_LOC_UPDATE_TYPE_ATTACH,
 	MSC_CTR_LOC_UPDATE_TYPE_NORMAL,
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index 1168c32..1865618 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -77,6 +77,14 @@
 	VLR_CIPH_COMPL,
 };
 
+struct vlr_auth_tuple {
+	int use_count;
+	int key_seq;
+	struct osmo_auth_vector vec;
+};
+#define VLR_KEY_SEQ_INVAL	7	/* GSM 04.08 - 10.5.1.2 */
+
+
 struct vlr_ciph_result {
 	enum vlr_ciph_result_cause cause;
 	char imeisv[GSM48_MI_SIZE];
@@ -122,8 +130,8 @@
 	uint32_t age_indicator;				/* 2.17.1 */
 
 	/* Authentication Data */
-	struct gsm_auth_tuple auth_tuples[5];		/* 2.3.1-2.3.4 */
-	struct gsm_auth_tuple *last_tuple;
+	struct vlr_auth_tuple auth_tuples[5];		/* 2.3.1-2.3.4 */
+	struct vlr_auth_tuple *last_tuple;
 	enum vlr_subscr_security_context sec_ctx;
 
 	/* Data local to VLR is below */
@@ -205,7 +213,7 @@
 	 * \param[in] at  auth tuple providing rand, key_seq and autn.
 	 * \param[in] send_autn  True to send AUTN, for r99 UMTS auth.
 	 */
-	int (*tx_auth_req)(void *msc_conn_ref, struct gsm_auth_tuple *at,
+	int (*tx_auth_req)(void *msc_conn_ref, struct vlr_auth_tuple *at,
 			   bool send_autn);
 	/* encode + transmit an AUTH REJECT towards the MS */
 	int (*tx_auth_rej)(void *msc_conn_ref);
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 38376d0..2962760 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1514,7 +1514,7 @@
  ***********************************************************************/
 
 /* VLR asks us to send an authentication request */
-static int msc_vlr_tx_auth_req(void *msc_conn_ref, struct gsm_auth_tuple *at,
+static int msc_vlr_tx_auth_req(void *msc_conn_ref, struct vlr_auth_tuple *at,
 			       bool send_autn)
 {
 	struct ran_conn *conn = msc_conn_ref;
@@ -1600,7 +1600,7 @@
 	int i, j = 0;
 	int request_classmark = 0;
 	int request_classmark_for_a5_n = 0;
-	struct gsm_auth_tuple *tuple = conn->vsub->last_tuple;
+	struct vlr_auth_tuple *tuple = conn->vsub->last_tuple;
 
 	if (!conn || !conn->vsub || !conn->vsub->last_tuple) {
 		/* This should really never happen, because we checked this in msc_vlr_set_ciph_mode()
@@ -1680,7 +1680,7 @@
 {
 	struct ran_conn *conn = msc_conn_ref;
 	struct vlr_subscr *vsub;
-	struct gsm_auth_tuple *tuple;
+	struct vlr_auth_tuple *tuple;
 
 	if (!conn || !conn->vsub) {
 		LOGP(DMM, LOGL_ERROR, "Cannot send Ciphering Mode Command to"
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index b632117..aaefb0b 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -602,7 +602,7 @@
 #endif
 
 	if (vsub->last_tuple) {
-		struct gsm_auth_tuple *t = vsub->last_tuple;
+		struct vlr_auth_tuple *t = vsub->last_tuple;
 		vty_out(vty, "    A3A8 last tuple (used %d times):%s",
 			t->use_count, VTY_NEWLINE);
 		vty_out(vty, "     seq # : %d%s",
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index 189cb66..76c84de 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -242,7 +242,7 @@
 	vsub->tmsi_new = GSM_RESERVED_TMSI;
 
 	for (i = 0; i < ARRAY_SIZE(vsub->auth_tuples); i++)
-		vsub->auth_tuples[i].key_seq = GSM_KEY_SEQ_INVAL;
+		vsub->auth_tuples[i].key_seq = VLR_KEY_SEQ_INVAL;
 
 	INIT_LLIST_HEAD(&vsub->cs.requests);
 	INIT_LLIST_HEAD(&vsub->ps.pdp_list);
@@ -661,7 +661,7 @@
 	if (gsup->num_auth_vectors) {
 		memset(&vsub->auth_tuples, 0, sizeof(vsub->auth_tuples));
 		for (i = 0; i < ARRAY_SIZE(vsub->auth_tuples); i++)
-			vsub->auth_tuples[i].key_seq = GSM_KEY_SEQ_INVAL;
+			vsub->auth_tuples[i].key_seq = VLR_KEY_SEQ_INVAL;
 	}
 
 	got_tuples = 0;
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index d5a8555..8419696 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -65,13 +65,13 @@
  * least used auth tuple without enforcing a maximum use count.  If there are
  * no auth tuples, return NULL.
  */
-static struct gsm_auth_tuple *
+static struct vlr_auth_tuple *
 _vlr_subscr_next_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
 {
 	unsigned int count;
 	unsigned int idx;
-	struct gsm_auth_tuple *at = NULL;
-	unsigned int key_seq = GSM_KEY_SEQ_INVAL;
+	struct vlr_auth_tuple *at = NULL;
+	unsigned int key_seq = VLR_KEY_SEQ_INVAL;
 
 	if (!vsub)
 		return NULL;
@@ -79,7 +79,7 @@
 	if (vsub->last_tuple)
 		key_seq = vsub->last_tuple->key_seq;
 
-	if (key_seq == GSM_KEY_SEQ_INVAL)
+	if (key_seq == VLR_KEY_SEQ_INVAL)
 		/* Start with 0 after increment modulo array size */
 		idx = ARRAY_SIZE(vsub->auth_tuples) - 1;
 	else
@@ -88,7 +88,7 @@
 	for (count = ARRAY_SIZE(vsub->auth_tuples); count > 0; count--) {
 		idx = (idx + 1) % ARRAY_SIZE(vsub->auth_tuples);
 
-		if (vsub->auth_tuples[idx].key_seq == GSM_KEY_SEQ_INVAL)
+		if (vsub->auth_tuples[idx].key_seq == VLR_KEY_SEQ_INVAL)
 			continue;
 
 		if (!at || vsub->auth_tuples[idx].use_count < at->use_count)
@@ -102,10 +102,10 @@
 }
 
 /* Return an auth tuple and increment its use count. */
-static struct gsm_auth_tuple *
+static struct vlr_auth_tuple *
 vlr_subscr_get_auth_tuple(struct vlr_subscr *vsub, int max_reuse_count)
 {
-	struct gsm_auth_tuple *at = _vlr_subscr_next_auth_tuple(vsub,
+	struct vlr_auth_tuple *at = _vlr_subscr_next_auth_tuple(vsub,
 							       max_reuse_count);
 	if (!at)
 		return NULL;
@@ -124,7 +124,7 @@
 			    bool is_utran, const uint8_t *res,
 			    uint8_t res_len)
 {
-	struct gsm_auth_tuple *at = vsub->last_tuple;
+	struct vlr_auth_tuple *at = vsub->last_tuple;
 	struct osmo_auth_vector *vec = &at->vec;
 	bool check_umts;
 	bool res_is_umts_aka;
@@ -263,7 +263,7 @@
 {
 	struct auth_fsm_priv *afp = fi->priv;
 	struct vlr_subscr *vsub = afp->vsub;
-	struct gsm_auth_tuple *at;
+	struct vlr_auth_tuple *at;
 	bool use_umts_aka;
 
 	/* Caller ensures we have vectors available */
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 2443e31..29ffdbf 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -714,7 +714,7 @@
 	return 0;
 }
 
-static int fake_vlr_tx_auth_req(void *msc_conn_ref, struct gsm_auth_tuple *at,
+static int fake_vlr_tx_auth_req(void *msc_conn_ref, struct vlr_auth_tuple *at,
 				bool send_autn)
 {
 	struct ran_conn *conn = msc_conn_ref;

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I122feae7ee3cbc59e941daef35a954bce29fec76
Gerrit-Change-Number: 12035
Gerrit-PatchSet: 7
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181130/a6c63a81/attachment.htm>


More information about the gerrit-log mailing list