Commit Graph

198 Commits

Author SHA1 Message Date
Jonas Bonn 1fd419e5b4 gprs: _cid_activated is an 'attaching' state
ofono_gprs_status_notify is an asynchronous notification that messes
with the 'attached' state of the GPRS atom.  This method is normally
prevented from running while an attach is in progress because the
attachment machinery wants to finish up and make it's own determination
of attach state.

When automatic context activation is relevant, as for LTE networks,
the ofono_gprs_cid_activated machinery replaces the usual set_attach
machinery for attaching to the network.  The cid_activated variant,
however, does not guard against simulatenous invocations of
ofono_gprs_status_notify.  This causes a race whereby status_notify
sets the state to 'attached' before the context is fully constructed
and set to active.  If the connection manager sees the 'attached'
state before there are any 'active' contexts, it may decide to
activate a context manually which is not the correct behaviour for
this type of network.

This patch makes the *_cid_activated machinery an 'attaching' state,
introducing the same guards that set_attached has to prevent
ofono_gprs_status_notify from running concurrently.
2017-04-14 17:28:46 -05:00
Christophe Ronco d43e48ae73 gprs: fix error check of gprs_cid_alloc function
When there is no context id available, idmap_alloc and
gprs_cid_alloc return max + 1.
2017-02-15 14:39:36 -06:00
Dragos Tatulea c2b489dca8 gprs: lte: set attached after successful activation
Otherwise the attached state gets to be set before the actual LTE
automatic context is ready. This triggers a race between connman
and ofono: connman sees status attached before the context is active
so connman will try to activate another context with same apn and will
fail over and over again.
2016-11-22 10:51:09 -06:00
Slava Monich 27a9428eec gprs: Check GPRS_FLAG_ATTACHED_UPDATE
... in pri_deactivate_callback

This prevents attached state from getting stuck at 0 like this:

1. Context deactivation is initiated over D-Bus, ctx->pending is set
2. Attached becomes FALSE, context is still marked as active
3. Attached becomes TRUE, gprs_attached_update sets GPRS_FLAG_ATTACHED_UPDATE
4. Deactivation completes, attached is 0, driver_attached is 1

Futher network status updates don't call gprs_attached_update because
driver_attached is still 1, so attached is staying 0 until we lose the
data registration again which may not happen for quite a long time.
2016-11-03 14:24:41 -05:00
Caiwen Zhang 20d8cf9495 gprs: fix crash removing a context being activated
If remove the context before context activation is completed, it may
cause a crash.
2016-11-01 11:29:37 -05:00
Alfonso Sanchez-Beato 154f4aca65 gprs: Deactivate old contexts on attach
In some cases it is possible that a context is opened after a detach
event has been received, and right before an attach, depending on the
modem. We make sure that those contexts are removed to keep
consistency.
2016-04-04 14:48:05 -05:00
Dragos Tatulea a4cfaa1b6c gprs: assume attached state when registered on LTE
LTE doesn't really use the concept of an attached state. However,
the oFono API needs it. ConnMan needs it as well.
2016-03-21 10:59:44 -05:00
Dragos Tatulea e71b3b265a gprs: implement ofono_gprs_cid_activated
It works by looking for a context with the same APN and tries to use
that. Otherwise it will create it's own.

Then it assigns a gprs context driver and calls it's read_settings if
it exists.
2016-03-18 10:08:08 -05:00
Dragos Tatulea 9173d7e2e4 gprs: pri_set_apn: make reply msg optional
Automatic context activation will set the apn by itself. No
dbus message to reply to.
2016-03-17 12:39:24 -05:00
Dragos Tatulea 02dcc2f36e gprs: custom cid for assign_context
It's optional though. If 0 a cid is picked up automatically from the
allowed range.
2016-03-17 12:27:17 -05:00
John Ernberg ff476aa06f gprs: Fix the ContextAdded() signal Introspection
This matches the behavior described by the documentation the signal
value returned by the code. This was causing a headache when using
stricter D-Bus wrappers like dbus-c++.
2015-12-22 10:23:44 -06:00
Denis Kenzior 133165b5ca gprs: Implement ofono_gprs_context_get_type 2015-12-13 22:20:58 -06:00
Denis Kenzior 6fbb1e18f8 gprs: Implement ofono_gprs_get_modem 2015-12-03 13:23:28 -06:00
Denis Kenzior 418ca19f25 gprs: Allow synchronous callbacks for set_attached 2015-11-13 16:08:32 -06:00
Tony Espy f2f279b28d src: make bearer/operator enums public
Move enums for operator_status and packet_bearer to common.h to avoid
duplication in drivers.
2015-10-13 16:00:17 -05:00
Denis Kenzior dbb3ec13e5 gprs: Try re-attaching when we switch cells 2015-07-20 13:51:29 -05:00
Alfonso Sanchez-Beato e70afdd9dc gprs: Add comment to gprs_reset_contexts 2015-05-18 12:13:04 -05:00
Alfonso Sanchez-Beato 946b568f43 gprs: Refactor to remove forward declaration 2015-05-18 09:08:33 -05:00
Alfonso Sanchez-Beato 444611c086 gprs: Add DBus method to reset contexts
Add DBus method that removes the current contexts and re-provisions
using the APN database.
2015-05-18 09:08:13 -05:00
Philip Paeps c144fadca6 gprs: provision the authentication method 2014-06-24 12:46:18 -05:00
Denis Kenzior 3e13676766 gprs: Make the code a bit easier to read 2014-06-21 12:02:05 -05:00
Philip Paeps 73831c3d76 gprs: make PPP authentication method configurable
Add a new "AuthenticationMethod" property to select between "pap"
and "chap" PPP authentication, defaulting to "chap" (i.e.: previous
behaviour).
2014-06-21 11:58:03 -05:00
Christopher Vogl df05259e90 gprs: fix bearer dbus signal interface
According to the documentation the data bearer property should be
located on interface org.ofono.ConnectionManager.
2012-08-13 09:48:50 -05:00
Guillaume Zajac 05b8fe4794 gprs: Call detach_shutdown when network is lost 2012-07-15 20:05:23 -05:00
Marcel Holtmann 0d4e80c002 gprs: Avoid shadowing error variable 2012-07-15 20:26:12 -03:00
Marcel Holtmann 543db63f19 gprs: Use ofono_bool_t instead of gboolean 2012-06-17 22:23:23 -07:00
Lucas De Marchi e0d6f9f0ce Do not set signature and reply in GDBus tables
Use GDBUS_* macros, so signature and reply fields are not set in each
method/signal.
2012-05-20 02:47:57 -07:00
Lucas De Marchi b3489f2ee8 Convert GDBus methods to use macro helpers
With these macro helpers we can separate in/out arguments and use their
own vector.
2012-05-20 02:47:57 -07:00
Henrique Dante de Almeida 924ee02ff7 Constify GDBus signal tables
Constify signal tables with the following command:

    find . -name '*.[ch]' -exec \
             sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;
2012-05-20 02:47:56 -07:00
Henrique Dante de Almeida 63bbdebdf2 Constify GDBus method tables
Constify method tables with the following command:

find . -name '*.[ch]' -exec \
             sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;
2012-05-20 02:47:56 -07:00
Denis Kenzior 878573b831 gprs: Use __ofono_atom_find 2012-01-18 12:36:37 -06:00
Denis Kenzior b5d6d835fa gprs: Trivial code reflow 2012-01-18 10:33:56 -06:00
Oleg Zhurakivskyy 9ebdfe29db gprs: Use sim SPN watch API 2012-01-18 10:26:03 -06:00
Oleg Zhurakivskyy 60976f1357 gprs: Minor whitespace and style fixes 2011-12-28 16:07:48 -06:00
Marcel Holtmann 7e6afe37bf core: Update copyright information 2011-10-10 13:39:42 -07:00
Denis Kenzior 51d0ac1ce4 gprs: Allow NULL context names while provisioning 2011-09-08 23:50:19 -05:00
Denis Kenzior ddbacc2dda gprs: Experimental fix for twitchy Huawei firmware 2011-08-18 14:23:04 -05:00
Denis Kenzior ea07cbfa1b gprs: Unify logic inside registration_status_cb
And delay reseting the ATTACHING flag until we had a chance to query the
CGREG status.
2011-06-02 15:56:18 -05:00
Gustavo F. Padovan fe4b81d69a gprs: remove set but not used var 2011-05-20 15:04:59 -05:00
Denis Kenzior 543b54a34e gprs: Make sure to clean up interfaces
When going down, it is sometimes possible for us not to ifconfig down
the interface or reset the MMS context IPv4 address propertly
2011-05-11 13:29:33 -05:00
Denis Kenzior 4714d8199a gprs: Mark context inactive on removal 2011-05-11 12:11:23 -05:00
Denis Kenzior 623183d996 gprs: Fix valgrind error
This fixes an invalid access condition for the case where the
gprs atom is destroyed before context atoms are.
2011-05-11 12:11:23 -05:00
Denis Kenzior de0b882acf gprs: emit Active changed for contexts being removed 2011-05-11 12:11:23 -05:00
Denis Kenzior 5646ecaf35 gprs: Add additional debug statements 2011-05-11 12:11:23 -05:00
Mika Liljeberg 0eedf42921 core: remove redundant code 2011-03-30 12:33:54 -05:00
Mika Liljeberg b52c06210c gprs: fix memory leak 2011-03-24 13:22:46 -05:00
Denis Kenzior 88402f02b2 gprs: Core changes for IPv6 support 2011-03-15 17:14:23 -05:00
Denis Kenzior 3d71a15c74 gprs: Move settings structure
Move the settings structure from pri_context to ofono_gprs_context in
preparation for new IPv6 support APIs.
2011-03-15 17:11:58 -05:00
Denis Kenzior 91a9425f21 gprs: Add support for dual stack contexts 2011-03-15 17:11:58 -05:00
Denis Kenzior ae096831e5 gprs: Also reset active in release_context 2011-03-15 17:11:58 -05:00