**diff options**

author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-12-12 17:06:22 +0100 |
---|---|---|

committer | Neels Hofmeyr <neels@hofmeyr.de> | 2020-04-30 19:22:24 +0200 |

commit | a450a8595654efdb7e9df3ab58e7d864071b8c2c (patch) | |

tree | 8c9fdb0e250f830375a4dbcf09f284cc7f2ea1b5 | |

parent | 26b4905e7f2607773acbb4c5de7b6ee2e1e598df (diff) |

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

-rw-r--r-- | src/db_auc.c | 17 |

1 files changed, 9 insertions, 8 deletions

diff --git a/src/db_auc.c b/src/db_auc.c index ecb9f58..975eb2d 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -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 */ |