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 02:45:49 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/35/12035/1

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 83f8d99..e159419 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1513,7 +1513,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;
@@ -1599,7 +1599,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()
@@ -1672,7 +1672,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 03dbbc9..87e59f6 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -601,7 +601,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 c777d8a..b424563 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -241,7 +241,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);
@@ -660,7 +660,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 6384d39..ca072b1 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -64,13 +64,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;
@@ -78,7 +78,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
@@ -87,7 +87,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)
@@ -101,10 +101,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;
@@ -123,7 +123,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;
@@ -262,7 +262,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 861e56f..0ca95c4 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -713,7 +713,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: newchange
Gerrit-Change-Id: I122feae7ee3cbc59e941daef35a954bce29fec76
Gerrit-Change-Number: 12035
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181130/6ef81160/attachment.htm>


More information about the gerrit-log mailing list