auc3g: officially wrap IND around IND_bitlen space

To determine distinct IND pools for each connected VLR, we need to pick ever
increasing values for any new peer showing up. Each subscriber's individual
IND_bitlen is then required to modulo the least significant N of bits that fit
in its IND_bitlen to effectively round-robin in the available IND pool space.
So far we did that but issued a warning message. This is actually exactly what
we want and it doesn't need to be treated like it weren't so.

Change-Id: I716d8a8a249235c8093d7a6a78b3535d893d867e
This commit is contained in:
Neels Hofmeyr 2019-12-12 17:06:22 +01:00
parent 26b4905e7f
commit a450a85956
1 changed files with 9 additions and 8 deletions

View File

@ -200,15 +200,16 @@ int db_get_auc(struct db_context *dbc, const char *imsi,
if (rc)
return rc;
/* modulo by the IND bitlen value range. For example, ind_bitlen == 5 would modulo 32:
* 1 << 5 == 0b0100000 == 32
* - 1 == 0b0011111 == bitmask of 5 lowest bits
* x &= 0b0011111 == modulo 32
* Why do this? osmo-hlr cannot possibly choose individual VLR INDs always matching all subscribers' IND_bitlen,
* which might vary wildly. Instead, let hlr.c pass in an arbitrarily high number here, and the modulo does a
* round-robin if the IND pools that this subscriber has available. */
auc_3g_ind &= (1U << aud3g.u.umts.ind_bitlen) - 1;
aud3g.u.umts.ind = auc_3g_ind;
if (aud3g.type == OSMO_AUTH_TYPE_UMTS
&& aud3g.u.umts.ind >= (1U << aud3g.u.umts.ind_bitlen)) {
LOGAUC(imsi, LOGL_NOTICE, "3G auth: SQN's IND bitlen %u is"
" too small to hold an index of %u. Truncating. This"
" may cause numerous additional AUTS resyncing.\n",
aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind);
aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1;
}
/* the first bit (bit0) cannot be used as AMF anymore, but has been
* re-appropriated as the separation bit. See 3GPP TS 33.102 Annex H
* together with 3GPP TS 33.401 / 33.402 / 33.501 */