Multi-usage APNs errenously ignored under gsm.auto-config=yes
Summary
mobile-broadband-provider-info changed a few years ago to add support for describing APNs that have multiple usages. At the moment, the only provider using this functionality is AT&T, but they're a pretty large carrier in the US.
NetworkManager doesn't interpret this correctly, because it's looking for <usage type="internet" />
. Instead, NetworkManager should probably be doing something like this:
int usage_contains_internet(char* candidate) {
char* original = "internet";
size_t length = strlen(original);
int posn = 0;
while(candidate[0] != '\0') {
if (posn >= 0) {
if (original[posn] == candidate[0]) {
if (++posn == length && (candidate[1] == '-' || candidate[1] == '\0')) {
return 1;
}
} else {
posn = -1;
}
}
if (candidate[0] == '-') {
posn = 0;
}
++candidate;
}
return 0;
}
To complicate matters further, AT&T's official documentation asks users to configure their devices to request the correct usages. ModemManager appears to support this, but NetworkManager doesn't seem to be doing it. My guess is AT&T probably works with the default
APN type that NetworkManager sends now, but long-term this should probably be corrected too.
Version affected
Looks like this has always been the case. I'm looking at 99f22526 (latest git main at time of writing).
This is only an issue with newer mobile-broadband-provider-info
containing 368cfd5cdea89dd568a983a49d083a5ca5a11f7a. The oldest version containing that commit is 20221107.
Unfortunately, it looks like Debian Bookworm shipped 20230416
.
Steps to reproduce
Use an AT&T SIM on a connection with gsm.auto-config=yes
Actual result
The connection will fail with:
Operator ID 'ABCXYZ' not found in service provider database
(p.s. Perhaps we could get another error message to indicate that an APN with an internet
usage wasn't found? This current one is a little misleading)
Expected result
NetworkManager should be able to find the correct APN. Note that for AT&T, the "correct" APN is a little ambiguous: #793 (closed)
Relevant logs
Operator ID 'ABCXYZ' not found in service provider database