summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* voicecall: Make sure SIM ecc numbers are always readIvaylo Dimitrov2022-09-191-12/+28
| | | | | | | | | | It might happen that by the time ofono_voicecall_register() is called, SIM is already in OFONO_SIM_STATE_READY state so SIM emergency numbers are never read. Fix that by adding code that reads emergency numbers even in the above case. Also, make sure ECC file watch is properly removed and sim_context is free()-ed.
* call-barring: Quiet GCC warningDenis Kenzior2022-09-081-3/+3
| | | | | | | | | | | | | CC src/call-barring.o In function ‘cb_lock_property_lookup’, inlined from ‘cb_set_property’ at src/call-barring.c:854:7: src/call-barring.c:776:18: error: ‘len’ may be used uninitialized [-Werror=maybe-uninitialized] 776 | property += len; | ~~~~~~~~~^~~~~~ src/call-barring.c: In function ‘cb_set_property’: src/call-barring.c:759:16: note: ‘len’ was declared here 759 | size_t len; | ^~~
* simfs: Fix reads beyond the first blockSlava Monich2021-07-301-8/+6
|
* radio-settings: Do not use enum ofono_access_modeDenis Kenzior2021-06-011-8/+7
| | | | | | | Originally the enum was only meant to signify a single radio access mode preference, but over time its meaning was overloaded to be a bitfield with multiple preferences. Switch away from using an enum value to using an unsigned int to make it clearer that the value is a bitfield.
* radio-settings: Add handling of dual mode technology preferenceSean Nyekjaer2021-06-011-0/+6
| | | | | Allow setting of "lte,gsm" mode, for modems that doesn't support ANY mode.
* sim-auth: Parse auth response according to TS 31.102Slava Monich2021-06-013-56/+137
|
* simutil: Fill unused part of AID with FFsSlava Monich2021-06-011-0/+1
| | | | | Correct handling of short AIDs will take more than that, but leaving part of the array uninitialized is wrong in any case.
* treewide: Introduce support for missing g_memdup2Marcel Holtmann2021-05-058-1/+31
|
* sim-auth: Only close open sessionsSlava Monich2021-04-301-1/+2
| | | | Session has to be open in order to have a valid session_id
* sim-auth: Remove watch if open_channel failsSlava Monich2021-04-301-0/+2
| | | | Otherwise open_channel won't be called again after a failure.
* treewide: Replace g_memdup with g_memdup2Marcel Holtmann2021-04-287-14/+14
|
* sim: validate IMS private identitySergey Matyukevich2021-01-191-1/+2
| | | | | | Make sure that IMS private identity is a valid UTF8 string before setting sim->impi field. Otherwise ofono may crash on dbus assert when SIM properties are reported via org.ofono.SimManager interface.
* simutil: add validate_utf8_tlvSergey Matyukevich2021-01-192-0/+15
| | | | | | Add helper to validate if TLV value is a valid UTF8 string. Note that both null-terminated and non null-terminated UTF8 strings are considered valid.
* util: Fix implicit enum conversionRichard Röjfors2020-12-221-1/+4
| | | | | | | | | | | | GCC10 complains about the following: src/smsutil.c: In function ‘sms_text_prepare_with_alphabet’: src/smsutil.c:3594:8: error: implicit conversion from ‘enum sms_alphabet’ to ‘enum gsm_dialect’ [-Werror=enum-conversion] 3594 | alphabet, &used_locking, smsutil and util has an enum each for representing the same thing; The SMS alphabet. They share the same values, so an explicit type cast makes GCC happy.
* common: APN with a dot in second position are not invalidChristophe Ronco2020-09-291-1/+1
| | | | | APN with a dot in second position (example: "t.est") are wrongly considered invalid.
* netmon: added PCI, TAC, SNR valueJongSeok Won2020-07-311-0/+21
| | | | To support cell type LTE, the value of PCI, TAC, SNR is added
* gprs: clean context properlyJimmy Gysens2020-06-251-8/+16
| | | | | | | | After a context is detached, the context is not properly cleared. In addition to releasing the context: - Reset the context settings (IP, DNS, interface, ...). - Signal the Active flag as false.
* lte: Use the right D-Bus interface for property change signalSlava Monich2020-06-181-1/+1
|
* cbs: Allow the last CBS fragment to be truncatedSlava Monich2020-06-182-8/+16
| | | | That does happen in real life.
* sim: handling crash in error scenario for SIM PIN queryAntara Borwankar2019-12-201-1/+3
| | | | | | | | In case of error in sim_pin_query_cb function. pin_type is set to -1. This is causing segmentation fault in function sim_passwd_name due to invalid index pin_type = -1. Fixing this issue by handling error case before calling sim_passwd_name function.
* gprs: Update attach state on context deactivation for LTERichard Röjfors2019-12-111-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To be considered attached on LTE a context should be activated. But in case the context got deactivated we did not update the attached state, it remained attached. That caused the connection manager to try to re-activate the context manually, but for LTE thats done automatically. In the case of ublox it returns errors, which is passed on to the connection manager, which tries again and again, until we get attached again. It looked like this: 12:03:18 ofonod[547]: Aux: < \r\n+CIEV: 2,3\r\n 12:03:23 ofonod[547]: Aux: < \r\n+CIEV: 2,2\r\n Deactivated 12:16:01 ofonod[547]: Aux: < \r\n+CGEV: NW PDN DEACT 4\r\n 12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgev_notify() cid 4, active cid: 4 12:16:01 ofonod[547]: src/gprs.c:ofono_gprs_context_deactivated() 0x1743e50 0x17424a8 4 Connection manager now try to activate, over and over again because Attached remains TRUE 12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1 12:16:01 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r 12:16:01 ofonod[547]: Aux: < \r\nOK\r\n 12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1 12:16:01 ofonod[547]: Aux: > AT+CGACT=1,1\r 12:16:01 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n 12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0 12:16:01 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0 12:16:01 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: No network service 12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1 12:16:02 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r 12:16:02 ofonod[547]: Aux: < \r\nOK\r\n 12:16:02 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1 12:16:02 ofonod[547]: Aux: > AT+CGACT=1,1\r 12:16:02 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n 12:16:02 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0 12:16:02 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0 12:16:02 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: No network service . . . 12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1 12:16:14 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r 12:16:14 ofonod[547]: Aux: < \r\nOK\r\n 12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1 12:16:14 ofonod[547]: Aux: > AT+CGACT=1,1\r 12:16:14 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n 12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0 12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0 12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: No network service 12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1 12:16:14 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r 12:16:14 ofonod[547]: Aux: < \r\nOK\r\n 12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1 12:16:14 ofonod[547]: Aux: > AT+CGACT=1,1\r The context got activated again 12:16:14 ofonod[547]: Aux: < \r\n+CGEV: ME PDN ACT 4\r\n\r\n+CIEV: 9,2\r\n\r\n+CTZE: +04,0,"19/12/11,13:17:58"\r\n 12:16:14 ofonod[547]: drivers/ubloxmodem/network-registration.c:ctze_notify() tz +04 dst 0 time 19/12/11,13:17:58 12:16:14 ofonod[547]: src/network.c:ofono_netreg_time_notify() net time 2019-12-11 13:17:58 utcoff 3600 dst 0 12:16:14 ofonod[547]: Aux: < \r\n+CME ERROR: 100\r\n 12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0 12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0 12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context failed with error: Unknown error
* gprs: Don't modify the context if assign failsRichard Röjfors2019-12-111-28/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was an issue while running LTE and the connection manager tried to activate the context with CID 1 while it got automatically activated at the same time with CID 4. When the automatic activation happened ofono_gprs_cid_activated got called which tried to assign the context, but that failed since the driver context was considered in use (by the activation call). Eventhough it failed, the context was modified, cid was set to 0 (making cid 1 leak). Then release_context got called which clear pointers assigned to the context. A bit later the activation callback got called, in my case activation failed. Due to the failure it tries to clean up by calling context_settings_free, but unfortunately the pointers where reset above causing ofono to segfault du to null pointer derefs. Instead we make sure assign_context does not touch the context unless it succeeds. Then there is no need to call release_context if assign fails. That ensures the context being intact when the activation callback gets called. 03:23:21 ofonod[545]: Aux: < \r\n+CGEV: ME PDN ACT 4\r\n\r\n+CTZE: +04,0,"19/12/10,04:25:03"\r\n 03:23:21 ofonod[545]: drivers/ubloxmodem/network-registration.c:ctze_notify() tz +04 dst 0 time 19/12/10,04:25:03 03:23:21 ofonod[545]: src/network.c:ofono_netreg_time_notify() net time 2019-12-10 04:25:03 utcoff 3600 dst 0 03:23:22 ofonod[545]: Aux: > AT+CGDCONT?\r 03:23:22 ofonod[545]: drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1 Connection manager requests activation, will mark the context in use and assign it cid 1. 03:23:22 ofonod[545]: Aux: < \r\n+CGDCONT: 1,"IP","m2m.tele2.com","",0,0,0,0,0,0\r\n 03:23:22 ofonod[545]: Aux: < +CGDCONT: 4,"IP","m2m.tele2.com.mnc003.mcc248.gprs","100.69.174.133",0,0,0,0,0,0\r\n 03:23:22 ofonod[545]: Aux: < \r\nOK\r\n 03:23:22 ofonod[545]: drivers/atmodem/gprs.c:at_cgdcont_read_cb() ok 1 03:23:22 ofonod[545]: src/gprs.c:ofono_gprs_cid_activated() cid 4 03:23:22 ofonod[545]: Can't assign context to driver for APN. Since its marked in use above, we fail to assign it cid 4. When that fails the cid is cleared an all context pointers are set to NULL. 03:23:22 ofonod[545]: Aux: > AT+CGDCONT=1,"IP","m2m.tele2.com"\r 03:23:22 ofonod[545]: Aux: < \r\nOK\r\n 03:23:22 ofonod[545]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1 03:23:22 ofonod[545]: Aux: > AT+CGACT=1,1\r 03:23:22 ofonod[545]: Aux: < \r\n+CME ERROR: 100\r\n 03:23:22 ofonod[545]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0 03:23:22 ofonod[545]: src/gprs.c:pri_activate_callback() 0x853480 03:23:22 ofonod[545]: src/gprs.c:pri_activate_callback() Activating context failed with error: Unknown error Activation callback, and it failed. Will try to clean up, but the pointers are NULL'ed... Dec 10 03:23:22 ofonod[545]: Aborting (signal 11) [/usr/sbin/ofonod]
* gprs: Remove pointless checkDenis Kenzior2019-11-131-1/+1
| | | | name is declared as an array, so the check will always evaluate to true
* simutil: Remove pointless checkDenis Kenzior2019-11-131-4/+0
| | | | len is already checked >= 16 above
* log: Remove dead codeDenis Kenzior2019-11-131-9/+0
|
* simutil: Fix EF structure bit processingDenis Kenzior2019-11-131-1/+1
| | | | | | The intent here was to find the contents of the 3 low order bits according to Table 11-5 in ETSI 102.221. However, the mask ended up only grabbing the contents of the 2 low order bits.
* call-forwarding: Increase string buffer to avoid overflowMarcel Holtmann2019-10-311-1/+1
|
* gprs: update attached on netreg updates when running LTERichard Röjfors2019-10-111-2/+7
| | | | | | | | | There was a race condition where a context might be registered before the netreg status updates to LTE. The code took for granted the context is activated after the technology update. With this change, any order is is accepted.
* gprs: free interface name in gprs_context_remove()Martin Hundebøll2019-09-261-0/+1
|
* gprs: Do nothing on detached when attaching.Richard Röjfors2019-09-241-0/+9
| | | | | | | Its incorrect to fiddle with the driver attach state when attaching. When attaching the state is transitioning, and the correct state will now always be assigned in the end of the attach process, regardless of result.
* gprs: Only release detachable context on de-attachRichard Röjfors2019-09-201-15/+40
| | | | | | | | | | | | | | Currently there is an issue if the attach state changes and there are active contexts of which the driver does not implement the detach_shutdown. In that case we just release the context (clears CID and active state), but nothing is signalled on D-Bus or towards the modem. Ofono is then out of sync with both the connection manager and the modem, this manifests itself later on if the modem changes state of the context, then ofono will not find it since the CID is cleared, and the connection manager won't be notified.
* gprs: deattach driver when gprs status indicates unregisteredRichard Röjfors2019-09-201-6/+6
| | | | | | | | | | | | In the same way as we consider the driver attached when the gprs status indicates we are registered, we should consider it deattached when the status indicates unregistration. If we don't, then we would not always recover from the case when deattaching the driver fails. We would just revert back the driver attached status to true, and "ignore" if the status indicates the opposite when we check the registration status afterwards.
* gprs: Remove prior attaching state logicRichard Röjfors2019-08-211-18/+1
| | | | | | | | | | | Commit 1fd419e5b4b3a87673f8e0219edb0f3ed9fca774 and 0167c3339ca8f17a653592af995f439d24405de8 introduced logic that treated ofono_gprs_cid_activated as an 'attaching' state. Since gprs_attached_update now guarantees that we will not get attached without having a context activated in LTE, this is not needed anymore. It also potentially interferes in case the driver was actually attaching.
* gprs: Check for LTE in gprs_attached_updateRichard Röjfors2019-08-211-23/+28
| | | | | | | | Since we have a different condition for the attach state when running on LTE, we should consider it in gprs_attached_update. Previously it's done in some instances. But for instance if the driver got detached from GPRS but now running on LTE with a context up, we would be deattached.
* gprs: Ignore activated contexts during init, list them laterRichard Röjfors2019-08-131-1/+19
| | | | | | | | | There is an issue if an context gets auto activated early, then provisioning might not have run yet for instance, so a "new" context is created, which might be duplicated by a provisioning context later. So ignore the activated contexts until gprs is ready, then it calls the driver to list active contexts.
* gprs: Do not detach when running LTE and GPRS is unavailable.Richard Röjfors2019-08-121-3/+20
| | | | | | | | There are cases where the gprs status might updated to for instance "unknown" while LTE is the bearer. In that case we should not set the attach state to FALSE, since then running LTE the conext activation reflects the attached state.
* gprs: Do not leak CID on failure to assign contextRichard Röjfors2019-08-071-0/+3
|
* gprs: Use -1 as netreg status during init.Richard Röjfors2019-08-071-2/+21
| | | | | | | | | | | | Previously the valid "unknown" netreg status was set during startup, but its a bit problematic for gprs. There might be cases where a LTE context is activated before netreg is finished updating its status. Resulting in gprs taking faulty actions. Instead we set the status to -1 until we are updated with a known value. During the time the status is -1, gprs postpones actions until the status is valid (>= 0).
* netmon: adding get functionality for neighbouring cell informationAntara Borwankar2019-06-071-69/+184
| | | | | Handled the get neighbouring cell information function which returns an array of signal strength of all neighbouring cells.
* treewide: Use L_TFR macroDenis Kenzior2019-05-243-28/+23
|
* main: Quiet ld errors with external ellDenis Kenzior2019-05-161-0/+1
| | | | | | | | | | | | When oFono is built with --enable-external-ell, the compiler for some reason does not generate a debug section on some systems. This is due to the fact that l_debug is never called. However, ell also does not call l_debug, yet when built-in ell is used, the section is created by the compiler. For now work around this by adding a no-op l_debug() call in main.c. The real fix is to migrate all of the oFono logging functionality to use ell instead.
* core: Quiet warning about strncpy useDenis Kenzior2019-05-164-5/+5
|
* radio-settings: handling of dual mode technology preferenceAntara Borwankar2019-05-161-2/+14
| | | | | Handled two new dual mode technology preferences "umts,gsm" and "lte,umts".
* voicecall: Fix possible crashDenis Kenzior2019-04-301-0/+3
|
* netmon: Fix logic errorDenis Kenzior2019-04-301-1/+1
|
* sim-auth: Use memcpy instead of strncpyDenis Kenzior2019-04-301-2/+2
| | | | | The code is not really copying strings but 2 or 3 character sof the MNC. Make this clearer.
* message-waiting: Fix logic errorDenis Kenzior2019-04-291-2/+2
|
* gprs: Remove unneeded if conditionsDenis Kenzior2019-04-291-2/+2
| | | | | ctx->message_center and ctx->message_proxy are arrays and thus always evaluate as true
* gprs: Fix invalid string comparisonDenis Kenzior2019-04-291-1/+1
| | | | | The default context created when provisioning fails is simply a context with an empty APN
* gprs: Remove unneeded if statementDenis Kenzior2019-04-291-3/+1
| | | | if (ctx->message_proxy) always resolves to TRUE