mbox series

[0/5] Correct Provisioning Database Tags Matching Behavior

Message ID cover.1738800116.git.gerickson@nuovations.com (mailing list archive)
Headers show
Series Correct Provisioning Database Tags Matching Behavior | expand

Message

Grant Erickson Feb. 6, 2025, 12:34 a.m. UTC
At least in North America / United States, there exist Cellular MVNOs
(particularly in the IoT / M2M veritical) that neither use mobile
virtual network operator (MVNO) service provider names (SPNs) nor use
unique home network identifiers (HNIs) (that is, mobile country code
(MCC) + mobile network code (MNC) pairs). Instead, they simply use the
HNI of the parent operator.

In addition, those MVNOs typically have two or three APN schemes:

    1. A "public" APN that is broadly used by one or more MVNOs for
       the parent operator that issues PUBLIC IP addresses and does
       NOT route through the MVNOs or parent operator data center
       infrastructure.

    2. A "private" APN that may or may NOT be broadly used by one
       or more MVNOs for the parent operator that issues PRIVATE IP
       addresses and does route through the MVNOs or parent operator
       data center infrastructure.

    3. A "private" APN that is used only by the MVNO that issues
       static or dynamic PRIVATE IP addresses, does route through the
       MVNO data center infrastructure and, from there, via a VPN to
       the customer services infrastructure.

       These are sufficiently MVNO-specific where they do not or
       should not play a role in a generic provisioning database.

Consequently, to effectively distinguish or steer a given device to
(1) or (2), a 'TagsFilter' must be used. However, as presently
implemented, a tag in 'TagsFilter' not only returns APNs matching the
tag(s) but also untagged APNs.

Assuming an APN of both (1) and (2) above, used by the Verizon KORE
Wireless MVNO, prior to this proposed change, the behavior was/is:

No tag specified:

    # ./lookup-apn 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>

    Name: 4G LTE Contract
    APN: vzwims
    Type: 28
    Proto: 2
    Tags: (null)

    Name: 4G LTE Contract (Public)
    APN: vzwinternet
    Type: 1
    Proto: 2
    Tags: kore-m2m-public

    Name: 4G LTE Contract (Private)
    APN: wyleslte.gw7.vzwentp
    Type: 1
    Proto: 2
    Tags: kore-m2m-private

    Name: 4G LTE Contract
    APN: vzwapp
    Type: 4
    Proto: 2
    Tags: (null)

As expected.

One specific tag specified:

    # ./lookup-apn -t "kore-m2m-public" 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>

    Name: 4G LTE Contract
    APN: vzwims
    Type: 28
    Proto: 2
    Tags: (null)

    Name: 4G LTE Contract (Public)
    APN: vzwinternet
    Type: 1
    Proto: 2
    Tags: kore-m2m-public

    Name: 4G LTE Contract
    APN: vzwapp
    Type: 4
    Proto: 2
    Tags: (null)

Surprise! Both 'vzwapp' and 'vzwims' are returned which were not
expected or desired.

Another specific tag specified:

    # ./lookup-apn -t "kore-m2m-private" 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>

    Name: 4G LTE Contract
    APN: vzwims
    Type: 28
    Proto: 2
    Tags: (null)

    Name: 4G LTE Contract (Private)
    APN: wyleslte.gw7.vzwentp
    Type: 1
    Proto: 2
    Tags: kore-m2m-private

    Name: 4G LTE Contract
    APN: vzwapp
    Type: 4
    Proto: 2
    Tags: (null)

Surprise! Both 'vzwapp' and 'vzwims' are returned which were not
expected or desired.

Two specific tags specified:

    # ./lookup-apn -t "kore-m2m-public,kore-m2m-private" 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>

    Name: 4G LTE Contract
    APN: vzwims
    Type: 28
    Proto: 2
    Tags: (null)

    Name: 4G LTE Contract (Public)
    APN: vzwinternet
    Type: 1
    Proto: 2
    Tags: kore-m2m-public

    Name: 4G LTE Contract (Private)
    APN: wyleslte.gw7.vzwentp
    Type: 1
    Proto: 2
    Tags: kore-m2m-private

    Name: 4G LTE Contract
    APN: vzwapp
    Type: 4
    Proto: 2
    Tags: (null)

Surprise! Both 'vzwapp' and 'vzwims' are returned which were not
expected or desired.

With this change, specifying 'TagsFilter' now follows the rule of
least astonishment and matches expectations, returning only those APNs
which match a tag in 'TagsFilter', period.

One specific tag:

    # ./lookup-apn -t "kore-m2m-public" 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>
    Name: 4G LTE Contract (Public)
    APN: vzwinternet
    Type: 1
    Proto: 2
    Tags: kore-m2m-public

As desired / expected.

Another specific tag:

    # ./lookup-apn -t "kore-m2m-private" 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>
    Name: 4G LTE Contract (Private)
    APN: wyleslte.gw7.vzwentp
    Type: 1
    Proto: 2
    Tags: kore-m2m-private

As desired / expected.

Two specific tags:

    # ./lookup-apn -t "kore-m2m-private,kore-m2m-public" 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>
    Name: 4G LTE Contract (Public)
    APN: vzwinternet
    Type: 1
    Proto: 2
    Tags: kore-m2m-public

    Name: 4G LTE Contract (Private)
    APN: wyleslte.gw7.vzwentp
    Type: 1
    Proto: 2
    Tags: kore-m2m-private

As desired / expected.

No tags:

    # ./lookup-apn 311 480
    Opening database in default location
    Searching for info for network: 311480, spn: <None>
    Name: 4G LTE Contract
    APN: vzwims
    Type: 28
    Proto: 2
    Tags: (null)

    Name: 4G LTE Contract (Public)
    APN: vzwinternet
    Type: 1
    Proto: 2
    Tags: kore-m2m-public

    Name: 4G LTE Contract (Private)
    APN: wyleslte.gw7.vzwentp
    Type: 1
    Proto: 2
    Tags: kore-m2m-private

    Name: 4G LTE Contract
    APN: vzwapp
    Type: 4
    Proto: 2
    Tags: (null)

As desired / expected.

Grant Erickson (5):
  provisiondb: Const-qualify '__get_string'.
  provisiondb: Const-qualify '__get_contexts'.
  provisiondb: Correct the precondition return conditions of
    'tags_match'.
  provisiondb: Document 'tags_match'.
  provisiondb: Document '__get_contexts'.

 src/provisiondb.c | 64 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 3 deletions(-)