mbox series

[0/4] ofono: Make the oFono Plugin Modem Interface Order Tolerant

Message ID cover.1739403363.git.gerickson@nuovations.com (mailing list archive)
Headers show
Series ofono: Make the oFono Plugin Modem Interface Order Tolerant | expand

Message

Grant Erickson Feb. 12, 2025, 11:39 p.m. UTC
This addresses and closes #135 by providing a secondary opportunity to
send D-Bus request to get Connection Manager interface properties and
contexts at the successful closure of 'try_create_device' since the
primary opportunity in 'modem_update_interfaces' is missed in the
following test case:

    # connmanctl disable cellular
    # /etc/init.d/connman stop
    # /etc/init.d/ofono stop
    # rm -rf /var/lib/ofono/*
    # rm -rf /var/lib/connman/cellular*
    # /etc/init.d/ofono start
    # /etc/init.d/connman start
    # connmanctl enable cellular

At this point, ofonod will create a fully-provisioned and -functional
Cellular service, with both IPv4 and IPv6 Cellular network
contexts. However, connmand has no network and no service associated
with it so, so any Connection Manager client observing the Cellular
service state will observe it failing, on timeout.

In this use case, the ordering of the oFono 'lte' (Long-term
Evolution) and 'cm' (Connection Manager) modem interfaces shared
between 'ofonod' and 'connmand' is different from what they normally
are in the case where a Cellular connection has already been
established. Consequently, when the 'cm' interface state change
notification addition arrives, the connman device has not yet been
created because in 'modem_update_interfaces' executing
'cm_get_properties' and 'cm_get_contexts' is dependent on the presence
of 'modem->device':

    if (api_added(old_ifaces, new_ifaces, OFONO_API_CM)) {
        if (modem->device) {
            cm_get_properties(modem);
            cm_get_contexts(modem);
        }
    }

Unfortunately, that does not and cannot happen until the 'lte' modem
interface is added because 'try_create_device' has these conditionals:

    if ((modem->capabilities & LTE_CAPABLE) &&
            !has_interface(modem->interfaces, OFONO_API_LTE))
        return false;

and the 'lte' interface is added only moments later (rather than
moments earlier as is normal outside this use case), but too late
nonetheless. So, the ofono plugin will never get 'cm' interface
properties or Cellular network contexts.

With this change, each call to 'try_create_device' now has an
opportunity to check if the 'cm' interface has been added and, if it
has, to request 'cm' properties and contexts.

Grant Erickson (4):
  ofono: Add additional 'DBG' statements.
  ofono: Use goto error-handling semantics in 'add_cm_context'.
  ofono: Documentation: Add comment about entry condition for
    'context_changed'.
  ofono: Provide a secondary opportunity to get CM props and contexts.

 plugins/ofono.c | 78 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 71 insertions(+), 7 deletions(-)

Comments

patchwork-bot+connman@kernel.org Feb. 14, 2025, 9:10 p.m. UTC | #1
Hello:

This series was applied to connman.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Wed, 12 Feb 2025 15:39:29 -0800 you wrote:
> This addresses and closes #135 by providing a secondary opportunity to
> send D-Bus request to get Connection Manager interface properties and
> contexts at the successful closure of 'try_create_device' since the
> primary opportunity in 'modem_update_interfaces' is missed in the
> following test case:
> 
>     # connmanctl disable cellular
>     # /etc/init.d/connman stop
>     # /etc/init.d/ofono stop
>     # rm -rf /var/lib/ofono/*
>     # rm -rf /var/lib/connman/cellular*
>     # /etc/init.d/ofono start
>     # /etc/init.d/connman start
>     # connmanctl enable cellular
> 
> [...]

Here is the summary with links:
  - [1/4] ofono: Add additional 'DBG' statements.
    (no matching commit)
  - [2/4] ofono: Use goto error-handling semantics in 'add_cm_context'.
    https://git.kernel.org/pub/scm/network/connman/connman.git/?id=36154342e546
  - [3/4] ofono: Documentation: Add comment about entry condition for 'context_changed'.
    https://git.kernel.org/pub/scm/network/connman/connman.git/?id=00e7dc2d528f
  - [4/4] ofono: Provide a secondary opportunity to get CM props and contexts.
    https://git.kernel.org/pub/scm/network/connman/connman.git/?id=0b091dd8fc8f

You are awesome, thank you!