diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-08-16 12:22:29 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2019-12-09 10:54:30 +0000 |
commit | 49ddef610a003f1000422284bf31a653249cf09e (patch) | |
tree | e1234acf31e43886976baa9f3ca643f406472f59 /src | |
parent | 278a6c8fcfc04084cd459a990ad93077b2a9cab0 (diff) |
gsup: Introduce OSMO_GSUP_NUM_VECTORS_REQ_IE
This is a bit of a hack, as we want to maintain binary compatibility
without breaking existing users of libosmocore. To do so, we use the
'num_auth_vectors' field in two ways now:
* In the existing use case as part of SEND_AUTH_INFO_RESPONSE, it
indicates the number of vectors stored in the 'auth_vectors' field
* In the new use case as part of SEND_AUTH_INFO_REQUEST, it indicates
the number of vectors actually requested by the MSC/SGSN/MME.
Change-Id: Iaecc47280f8ce54f3e3a888c1cfc160735483d0f
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsup.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index ad7a2a42..ef33ed08 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -569,6 +569,11 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len, gsup_msg->cause_sm = value[0]; break; + case OSMO_GSUP_NUM_VECTORS_REQ_IE: + if (gsup_msg->message_type == OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST) + gsup_msg->num_auth_vectors = value[0]; + break; + default: LOGP(DLGSUP, LOGL_NOTICE, "GSUP IE type %d unknown\n", iei); @@ -753,12 +758,18 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg) } } - for (idx = 0; idx < gsup_msg->num_auth_vectors; idx++) { - const struct osmo_auth_vector *auth_vector; + if (gsup_msg->message_type == OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST) { + uint8_t num = gsup_msg->num_auth_vectors; + if (num != 0) + msgb_tlv_put(msg, OSMO_GSUP_NUM_VECTORS_REQ_IE, 1, &num); + } else { + for (idx = 0; idx < gsup_msg->num_auth_vectors; idx++) { + const struct osmo_auth_vector *auth_vector; - auth_vector = &gsup_msg->auth_vectors[idx]; + auth_vector = &gsup_msg->auth_vectors[idx]; - encode_auth_info(msg, OSMO_GSUP_AUTH_TUPLE_IE, auth_vector); + encode_auth_info(msg, OSMO_GSUP_AUTH_TUPLE_IE, auth_vector); + } } if (gsup_msg->auts) |