LTE: IP addresses assigned to non-0 PDP context, networking integration does not work

I have devices that manually define PDP context 0 in order to set the APN to the required value for the SIM.

Typically, once connected to the network, the IP address gets assigned to this PDP context, and everything works fine:

rpc --id 0x3ea lte_at_cmd -c "AT+CGDCONT?"
+CGDCONT: 0,"IP","teal","10.131.245.148",0,0
OK

Occasionally, the IP address gets assigned to a non-0 PDP context, e.g:

rpc --id 0xcc0000eb1e000036 lte_at_cmd -c "AT+CGDCONT?"
+CGDCONT: 0,"IP","teal","",0,0
+CGDCONT: 1,"IP","teal","10.27.112.146",0,0
OK

This is a problem, because all of the Zephyr network stack integrations assume the only valid PDP context is 0.
1. PDN callback ignores the context ID: https://github.com/nrfconnect/sdk-nrf/blob/61b8072c1b78777887ec73e640dc694d53b9eab1/lib/nrf_modem_lib/lte_net_if/lte_net_if.c#L284
2. IP address retrieval hardcodes context ID 0: https://github.com/nrfconnect/sdk-nrf/blob/61b8072c1b78777887ec73e640dc694d53b9eab1/lib/nrf_modem_lib/lte_net_if/lte_ip_addr_helper.c#L79
3. PDN callbacks are only registered for the default context: https://github.com/nrfconnect/sdk-nrf/blob/61b8072c1b78777887ec73e640dc694d53b9eab1/lib/nrf_modem_lib/lte_net_if/lte_net_if.c#L390

The result of this is that the application is connected to the network, the network has assigned an IP address, and yet the networking stack thinks it has no network connectivity.

Parents
  • Hi

    We haven't been able to recreate this with the cellular networks in Norway (Telenor and Telia), but we're able to make a PDN configuration that doesn't work using a similar setup. The issue seems to be that the application configures the default PDN as an IPv4 only using APN "teal", while the SIM creates a PDN context as IPv4/v6 useing the same APN.

    We have two suggested changes to avoid getting into this situation that you can try:

    1. Remove the application AT+CGDCONT=0,"IP","teal" and let modem/network setup the default PDN. When SIM configures its PDN it should then use the same PDN context (same IP address) instead of creating a new.

    2. Change the application to AT+CGDCONT=0,"IPV4V6","teal" to match the same as used by SIM. This should give the same behavior as in 1.

    Best regards,

    Simon

Reply
  • Hi

    We haven't been able to recreate this with the cellular networks in Norway (Telenor and Telia), but we're able to make a PDN configuration that doesn't work using a similar setup. The issue seems to be that the application configures the default PDN as an IPv4 only using APN "teal", while the SIM creates a PDN context as IPv4/v6 useing the same APN.

    We have two suggested changes to avoid getting into this situation that you can try:

    1. Remove the application AT+CGDCONT=0,"IP","teal" and let modem/network setup the default PDN. When SIM configures its PDN it should then use the same PDN context (same IP address) instead of creating a new.

    2. Change the application to AT+CGDCONT=0,"IPV4V6","teal" to match the same as used by SIM. This should give the same behavior as in 1.

    Best regards,

    Simon

Children
Related