diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-09-12 10:43:14 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2019-09-13 18:13:26 +0000 |
commit | e7881e4e29770b87e60cc633ee0980ce68f2e01f (patch) | |
tree | 0542ea4bd0c7244494622179f581dfa44f5857a2 /src/main.c | |
parent | e93b5c1c1f4f5afce4a3476c239e4d9aa15c9b32 (diff) |
broadband-bearer: prefer unused CID to overwriting an existing one
There are two places where we look for unused CIDs:
* First, while processing the list of existing contexts returned by
CGDCONT?, we look for gaps in the used CIDs. E.g. if the first
context has CID=1 and the next one has CID=3, we can definitely use
the unused CID=2.
* Then, while processing the response of CGDCONT=?, we try to see
whether there is any empty CID available after the last existing
one found. E.g. if the last existing context has CID=3 and the
format tells us that the max allowed CID is 16, we can definitely
use the unused CID=4.
In both these cases, we should prefer using such an unused CID found
to overwriting other CIDs that are already defined.
This logic will now overwrite existing CIDs only if there are no
unused CIDs, and the preference to overwrite is as follows:
* If there is any existing context defined without an explicit APN,
overwrite it.
* Otherwise, overwrite the last existing CID found.
* And in the worst case, when no list of contexts was loaded
properly (e.g. some Android phones don't allow querying), fallback
to overwriting CID=1.
Diffstat (limited to 'src/main.c')
0 files changed, 0 insertions, 0 deletions