Commit Graph

1874 Commits

Author SHA1 Message Date
Sicelo A. Mhlongo
d11edaa60d ussd: ensure ussd content fits in buffers
Fixes: CVE-2024-7539
(cherry picked from commit 389e2344f86319265fb72ae590b470716e038fdc)

Origin: upstream, https://git.kernel.org/pub/scm/network/ofono/ofono.git/commit/?id=389e2344f86319265fb72ae590b470716e038fdc
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078555
2025-10-17 04:21:02 +08:00
Sicelo A. Mhlongo
47d385606f atmodem: sms: ensure buffer is initialized before use
Fixes: CVE-2024-7540
Fixes: CVE-2024-7541
Fixes: CVE-2024-7542
(cherry picked from commit 29ff6334b492504ace101be748b256e6953d2c2f)

Origin: upstream, https://git.kernel.org/pub/scm/network/ofono/ofono.git/commit/?id=29ff6334b492504ace101be748b256e6953d2c2f
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078555
2025-10-17 04:21:01 +08:00
Sergey Matyukevich
b06759215d gemalto: radio-settings: cleanup
Enum ofono_radio_access_mode has been replaced by unsigned int.
This change allows to move handling of all the modes into
'switch' in the function gemalto_set_rat_mode.
2021-07-27 09:30:37 -05:00
Sergey Matyukevich
8e0871c284 gemalto: add radio-settings driver
Add support for Gemalto specific radio settings.
2021-07-15 13:09:32 -05:00
Denis Kenzior
1d86dbc6c8 radio-settings: Do not use enum ofono_access_mode
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.
2021-06-01 11:20:37 -05:00
Sean Nyekjaer
f10b870c25 qmimodem: Add handling of dual mode technology preference
Handled dual mode technology preference "lte,gsm" for Quectel BG96.
Quectel BG96 doesn't support ANY mode.
2021-06-01 10:52:48 -05:00
Marcel Holtmann
ec80a0b32a treewide: Introduce support for missing g_memdup2 2021-05-05 10:32:32 +02:00
Marcel Holtmann
d841e74199 treewide: Replace g_memdup with g_memdup2 2021-04-28 16:39:46 +02:00
Marcel Holtmann
dbbbebf92d mbimmodem: Remove usage of likely and unlikely 2021-04-28 16:38:55 +02:00
Alexey Andreyev
ce86a6c207 qmimodem: Add USSD indication support
Handle USSD QMI indication messages.
Add support for UCS2 USS Data coding scheme.
Check for User Action TLV type.
2021-02-22 10:02:16 -06:00
Sergey Matyukevich
7b3840c5ce gemalto: netmon measurements scaling
Gemalto modem reports raw measurements in dBm. Reported values may
include negative numbers. Meanwhile oFono follows ETSI TS 27.007,
so negative numbers do not really exist at the API level.

Modify gemalto netmon driver to report measurements according to
27.007. For this purpose re-scale from what Gemalto firmware
reports into something that 27.007 recommends.
2021-01-15 11:43:52 -06:00
Sergey Matyukevich
be8c907d91 gemalto: add netmon driver
Implement network monitoring driver for gemalto modems that
are able to provide serving cell information and basic
measurements using AT+CQS and AT^SMONI commands.
2021-01-15 11:26:32 -06:00
Sergey Matyukevich
23ad67e326 gemalto: gprs: support authentication settings
Add support for gprs contexts with username, password,
and specific authentication type.
2020-12-30 10:57:02 -06:00
Sergey Matyukevich
3303268d02 gemalto: gprs: support automatic context activation
Implement read_settings function to get configuration for automatic
contexts. AT^SWWAN command activates PDP context unless it has been
already activated automatically, and then starts DHCP server in the
ME. So AT^SWWAN command should be run for automatic context as well
in order to obtain IP settings from the ME.

This commit also fixes the issue uncovered by the added support for
automatic contexts: as per modem specs, AT+CGACT context should not
be reused for AT^SWWAN. Though that worked for some reason when
automatic context was reactivated without proper deactivation.

Note that in both cases success code is reported to the core before
AT^SWWAN response. This is because the ME waits until DHCP negotiation
has finished before sending the "OK" or "ERROR" result code.
2020-12-30 10:54:50 -06:00
Denis Kenzior
3c8f24769a gemalto: Fix compiler error
Fix compiler error introduced due to a bad merge

Fixes: de0d5a19 ("gemalto: gprs: support different gprs protocols")
2020-12-26 11:36:00 -06:00
Sergey Matyukevich
de0d5a19c1 gemalto: gprs: support different gprs protocols
Add support for IPv6 and dual mode gprs contexts.
2020-12-22 10:36:46 -06:00
Sergey Matyukevich
3551cc89ec gemalto: gprs: cgev gprs context deactivation
Gemalto ELS81x modems use 'ME PDN DEACT' message to notify about gprs
context deactivation. Process this 'deactivate' event in CGEV handler.
2020-12-22 10:34:48 -06:00
Richard Röjfors
66cd5df5d7 huawei: Fix implicit enum conversion
GCC 10 warns about this implicit conversion:

drivers/huaweimodem/radio-settings.c: In function ‘band_gsm_from_huawei’:
drivers/huaweimodem/radio-settings.c:107:10: error: implicit conversion from ‘enum ofono_radio_band_umts’ to ‘enum ofono_radio_band_gsm’ [-Werror=enum-conversion]
  107 |   return OFONO_RADIO_BAND_UMTS_ANY;

Member from the incorrect enum was returned, both had the value 0, so
the code would still work.
2020-12-22 09:43:36 -06:00
Pavel Machek
cb79f71ffe droid 4: special handling for SMSes
Droid 4	 modem is "special" (aka broken) so and getting incoming SMSes
to work is quite tricky. This should get it right.
2020-09-15 10:21:44 -05:00
Pavel Machek
25fd00588a droid 4: add special handling required for voice calls and SIM
Droid 4 modem is "special" (aka broken) so it seems to need a bit of
error handling.
2020-09-15 10:17:55 -05:00
Denis Kenzior
52091a1af0 qmimodem: Fix format warning
../../drivers/qmimodem/network-registration.c: In function
‘extract_ss_info’:
../../drivers/qmimodem/network-registration.c:131:54: warning: ‘%03d’
directive output may be truncated writing between 3 and 5 bytes into a
region of size 4 [-Wformat-truncation=]
  131 |   snprintf(operator->mcc, OFONO_MAX_MCC_LENGTH + 1, "%03d",
        |                                                      ^~~~
	../../drivers/qmimodem/network-registration.c:131:53: note:
	directive argument in the range [0, 65535]
  131 |   snprintf(operator->mcc, OFONO_MAX_MCC_LENGTH + 1,
	      "%03d",
	            |
		    ^~~~~~

The MCC/MNC fields are limited to three digits.  Clamp the input to 999
to avoid the warning.
2020-09-08 11:19:54 -05:00
Lars Poeschel
21f148afe9 atmodem: Detect usage of AT+CGEREP
Currently AT+CGEREP=2,1 is sent in case we don't know what the modem
needs. (default case) Not all modems understand this. So, we first query
what the modem supports with AT+CGEREP=? and then use this information
to be nice to the modem. This way modems, like the Quectel M95 that do
only understand AT+CGEREP=1 do also work nicely.
2020-09-01 11:10:14 -05:00
Lars Poeschel
a811aca98a atmodem: Signal quality on quectel serial modems
As the default way of getting the signal quality with +CIND is also
unstable on quectel serial modems (the same as on quectel EC21). In fact
the signal quality is only updated on cell changes. Those trigger a
manual AT+CSQ in ofono and get an update this way, but the URCs do not
work.
So we implement a quectelish way here as well. The quectelish way is
very similar to the way ifx modems work. We can reuse their csq_notify
function.
2020-08-25 11:39:58 -05:00
Lars Poeschel
dbc1fb62ac atmodem: Deactivate AT+CPSB for quectel serial modems
There are at the moment two quectel modems in ofono vendored as
OFONO_VENDOR_QUECTEL_SERIAL: The M95 and the MC60.
Both modems are GSM only modems, and their official documentation does
not mention the AT+CPSB command.
I have a M95 here that gives an error on issuing the AT+CPSB=1 command.
So skip this command for these two modems.
2020-08-19 09:57:09 -05:00
Sergey Matyukevich
da1ef6588b drivers: gemalto: add gprs-context driver
Some gemalto modems provide USB ethernet interfaces for data path.
Implement gprs-context driver for such modems to send data via
USB ethernet rather than fallback to PPP.
2020-08-19 09:50:39 -05:00
Lars Poeschel
288f263ab6 gprs: Quectel EC21 does not understand AT+CPSB
The Quectel EC21 modem does not understand the AT+CPSB command, and we
did not find a suitable replacement in the
Quectel_EC25&EC21_AT_Commands_Manual_V1.3.pdf
AT+CPSB gives an error on this modem, so we just skip it.
2020-08-17 10:14:38 -05:00
Lars Poeschel
a01613ad13 atmodem: Get strength and tech the quectel way on EC21
I had some trouble getting network strengh and access technology the
standard way on Quectel EC21. It does work - but only kind of. I did not
get URCs when I am sure I should. This way through CIEV, CIND and CMER
is also not documented in Quectel documentation, so I suspect this to be
unsupported.
This is now changed to the "quectelish" way of gettings those values and
this does work more fine-grained and reliable on the Quectel EC21.
2020-08-11 10:47:58 -05:00
Lars Poeschel
3401d9e29c Add a vendor OFONO_VENDOR_QUECTEL_EC2X
The distinction between OFONO_VENDOR_QUECTEL and
OFONO_VENDOR_QUECTEL_SERIAL does not suffice for EC21/EC25 in some
places, so introduce and use a new vendor:
OFONO_VENDOR_QUECTEL_EC2X
2020-08-11 10:47:36 -05:00
JongSeok Won
325a4b2998 rilmodem: support cell type LTE for netmon 2020-07-31 10:21:00 -05:00
JongSeok Won
7a6872b3ee rilmodem: set proto type during setting initial attach apn
Added the protocol type of initial attach apn depends on protocol
type in LTE Atom.
2020-07-21 08:55:56 -05:00
JongSeok Won
1708c2b0c8 rilmodem: fix typo error in netmon.c 2020-07-21 08:38:03 -05:00
Jimmy Gysens
b513bf8d33 huawei: fix AT^SYSCFGEX acqorder "0201"
Commit 6c574ee24a ("huawei: the AT^SYSCFGEX
command supports additional modes") has a mistake for acqorder "0201". It
should be UMTS and GSM preferred.
2020-06-26 10:30:10 -05:00
Jimmy Gysens
6c574ee24a huawei: the AT^SYSCFGEX command supports additional modes
- LTE and UMTS preferred (acqorder = 0302);
AT^SYSCFGEX="0302",40000000,2,4,40000000

- UMTS and GSM preferred (acqorder = 0201);
AT^SYSCFGEX="0201",40000000,2,4,40000000

For AT^SYSCFG, the modes are not available.
2020-06-25 11:33:58 -05:00
Christophe Ronco
6cc1851b18 huawei: use AT^SYSCFG for radio setting operations on 3G only modems
AT^SYSCFGEX must be used on LTE Huawei modems to enable LTE support.
But some modems (or firmwares?) do not support this command and AT^SYSCFG
must be used to get/set radio settings.
This has been introduced in commit:
22adf6402c

There is a bug in this commit and AT^SYSCFGEX commands are used even on
modems not supporting it.
2020-06-11 09:30:04 -05:00
Marius Gripsgard
4e61dc355e qmimodem: Implement data capability bearer notify
This implements data capability bearer notify to qmi modem.
Since this is included in the serving system response this
just adds a new data extraction for dc.
2020-06-10 14:23:06 -05:00
Lars Poeschel
f7f3b754ad voicecall: Quectel modem do not understand AT+CNAP 2020-05-21 08:28:20 -05:00
JongSeok Won
48c5ab07af rilmodem: update call direction from the isMT value
oFono cannot determines the call of direction when the voicecall
is triggered in rilmodem
2020-04-02 18:09:55 -05:00
Richard Röjfors
952f1d00be ublox: network-registration: Handle UREG unsolicited during poll
In the case a unsolicited indication for UREG was received
while the status was polled. The poll response failed to parse.
This since the unsolicited indication only carries one
parameter, while the poll response is expected to carry two.

Update the code to loop until the response is found.

The log below shows a case where this happened.

10:07:55 ofonod[520]: Aux: > AT+UREG?\r
10:07:55 ofonod[520]: Aux: < \r\n+CGREG: 4\r\n\r\n+UREG: 0\r\n\r\n+CIEV: 9,1\r\n
10:07:55 ofonod[520]: src/gprs.c:ofono_gprs_status_notify() /ublox_0 status unknown (4)
10:07:55 ofonod[520]: src/gprs.c:ofono_gprs_detached_notify() /ublox_0
10:07:55 ofonod[520]: Aux: < \r\n+UREG: 1,0\r\n
10:07:55 ofonod[520]: Aux: < \r\nOK\r\n
2020-02-14 11:24:14 -06:00
Richard Röjfors
90dadace21 Instead of implementing an own copy of requesting and parsing
CREG, reuse the existing one from at-modem.
2020-02-07 10:49:10 -06:00
Denis Kenzior
4a078b353b atutil: Add missing va_end 2019-11-13 17:01:15 -06:00
Denis Kenzior
66bc5b3fd4 mbim: Don't copy too much
_mbim_message_build doesn't really care about the fragmentation header
contents, so just don't copy those unnecessarily.
2019-11-13 17:01:15 -06:00
Marcel Holtmann
96a83c167e huawei: Increase string buffer to avoid overflow 2019-10-31 08:38:47 +01:00
Richard Röjfors
78a5b4b735 ublox: netreg: Also subscribe to UREG URC's
It turns out that both L2xx and L4xx modems are a bit
buggy when it comes to send CREG URC's when the tech changes.
Try to overcome this by subscribing to both UREG and CREG,
and poll the other when any of the URC's are received.
Protect from doing simultaneous polls though.
2019-10-01 11:22:33 -05:00
Antara Borwankar
b9da075d63 atmodem: CGDCONT handling for cid 0
Added handling for cid 0 in +CGDCONT callback.
2019-09-30 11:14:50 -05:00
Martin Hundebøll
f8090396b8 atmodem: sim: remove quectel serial vendor quirk
The sim inserted/initialized state is handled properly in the quectel
plugin now, so remove the "auto-initialized" quirk from the atmodem
sim driver.
2019-09-26 16:38:39 -05:00
Richard Röjfors
388248d6a1 ublox: network-registration: Check ureg for tech also for L2 modems
It seems like the CREG reporting from the L2 modems are quite
buggy. An example for a L210 where CREG reports UTRAN while
COPS and UREG reports LTE. A manual poll also indicates LTE.

I also found that the technology mapping was incorrect,
probably confused with enum packet_bearer.

A commented log showing where CREG is not trustable:

UREG indicates LTE
21:59:29 : < \r\n+UREG: 7\r\n
21:59:29 : < \r\n+CIEV: 9,2\r\n
21:59:29 : < \r\n+CGEV: NW MODIFY 1,0,0\r\n
21:59:31 : < \r\n+CIEV: 2,2\r\n
21:59:39 : < \r\n+CIEV: 2,3\r\n
21:59:44 : < \r\n+CIEV: 2,2\r\n
22:01:38 : < \r\n+CIEV: 2,3\r\n
22:01:43 : < \r\n+CIEV: 2,2\r\n

A CREG indicating UTRAN with HSDPA and HSUPA
22:29:39 : < \r\n+CREG: 5,"0000","00000000",6\r\n
22:29:39 : > AT\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS=3,2\r
22:29:39 : < \r\n+CIEV: 9,2\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS?\r

An immediate cops indicating LTE
22:29:39 : < \r\n+COPS: 0,2,"24007",7\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CSQ\r
22:29:39 : < \r\n+CIEV: 2,4\r\n
22:29:39 : < \r\n+CSQ: 26,4\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CGATT=1\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS=3,0\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS?\r

Another cops also indicates LTE
22:29:39 : < \r\n+COPS: 0,0,"Tele2",7\r\n <- 7: LTE
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CGREG?\r

CGREG indicates unknown -> normal on LTE
22:29:39 : < \r\n+CGREG: 2,4\r\n
22:29:39 : < \r\nOK\r\n
22:29:44 : < \r\n+CIEV: 9,2\r\n
22:29:46 : < \r\n+CIEV: 2,2\r\n
22:56:23 : < \r\n+CIEV: 2,3\r\n
22:56:28 : < \r\n+CIEV: 2,2\r\n
22:59:40 : < \r\n+CIEV: 2,4\r\n

Manual poll shows we are running LTE
at+creg?
+CREG: 2,5,"2AFC","01DB0206",7

OK
2019-09-25 20:53:08 -05:00
Antara Borwankar
f3a5016a67 xmm7modem: Fix to set gateway in pdp context
gateway was not being listed in context settings. Fixed teh bug
to show correct gateway address.
2019-09-20 09:54:50 -05:00
Martin Hundebøll
b73a681972 atmodem: sms: don't request URC buffering for Quectel UC15 modems
Add a vendor quirk to avoid an error being returned when setting up sms
notification for Quectel UC15 modems.
2019-09-04 07:23:46 -05:00
Richard Röjfors
2d868fac1f ublox: gprs: React on context deactivation
In case a context get deactivated when a AT+CGACT=0 is
not issued, indicate that to gprs core.
This can happen if the device has an auto activated
LTE context and modem switches over to for instance UTRAN.
2019-09-02 16:39:02 -05:00
Pavel Machek
30fd4b3e34 atmodem: introduce send_clcc() to reduce code duplication
Reduce code duplication by introducing send_clcc function.
2019-08-19 14:45:16 -05:00