Commit Graph

74 Commits

Author SHA1 Message Date
Andreas Eversberg d7e611472a ASCI: Add option to join voice group/broadcast calls without valid SIM
This option must be enabled in the VTY and is disabled by default.

Calls can be joined when service is limited or normal. With that option
enabled, calls can be joined even with invalid SIM.

Talking is allowed when service is normal. With that option enabled,
talking is always allowed. It depends on the network, if it accepts the
talker.

Change-Id: I6ea851a8cb015ff685b985335968c6184beca816
Related: OS#5364
2023-10-27 09:12:26 +02:00
Andreas Eversberg 014646fc66 ASCI: Change state correctly when leaving group mode
Use new_mm_state() to leave group mode. This will trigger IMSI detach
when returning to IDLE mode, if it has been delayed.

Related: OS#5364
Change-Id: I3c83c9e0fe10b35d60d125df6929fcb5ddc35f1a
2023-10-18 08:08:24 +02:00
Andreas Eversberg 86fed8fc97 ASCI: Select correct state when returning to idle or group receive mode
This fixes I05957182a57423ad947ab200b52f65fde859e110.

Related: OS#5364 and OS#6214
Change-Id: I626195161b987f1ba0065134afcf3936c9c090eb
2023-10-18 08:08:18 +02:00
Andreas Eversberg e45abc96ec ASCI: Ignore cell selection event during group receive mode
Cell selection is not supported during group receive mode. If it
happens anyway, give an error message and select correct sub-state.

This fixes I05957182a57423ad947ab200b52f65fde859e110.

Related: OS#5364 and OS#6214
Change-Id: Iea6fe623956003130000c59ec0e1b24b3177052d
2023-10-18 08:08:14 +02:00
Andreas Eversberg 2c0f71ac43 ASCI: Join a group/bcast call in correct MM states only
These states are:
	GSM48_MM_SST_NORMAL_SERVICE
	GSM48_MM_SST_ATTEMPT_UPDATE
	GSM48_MM_SST_LIMITED_SERVICE
	GSM48_MM_SST_LOC_UPD_NEEDED
	GSM48_MM_SST_PLMN_SEARCH  (limited service)
	GSM48_MM_SST_PLMN_SEARCH_NORMAL

If the service is limited, group/bcast calls can be joined, but uplink
access is not allowed.

Related: OS#5364
Change-Id: I2f8ff65f6e101972f9b1760013983d00ae6e7760
2023-10-18 08:08:10 +02:00
Andreas Eversberg bcc047e5e1 Provide create_conn_and_push_mm_hdr() with correct SAPI
Change-Id: I454178f45aed49417f8cd7744155be66b9ac509f
Fixes: 00507bdc "Cleaning gsm48_mm_data_ind()"
Related: OS#6216
2023-10-10 19:31:26 +07:00
Andreas Eversberg 6708699b22 Correctly detect the follow-on proceed information element
Even if follow-on proceed is not supported, the warning message about
not beeing supported should only show when the follow-on proceed
information element is included in the location update accept messages.

Change-Id: I2b1aceb8b85bdd9faabe354501f9036f1fc6fe33
2023-10-09 23:39:01 +02:00
Andreas Eversberg 1cc4c0f487 Fix potential NULL pointer dereferences, discovered by Coverity Scan
See: CID 323362 + CID 323363
Change-Id: I47aa506014d8bddb8c8ce9b506c1c5c7b8056d30
2023-10-04 12:55:03 +02:00
Andreas Eversberg 00507bdc13 Cleaning gsm48_mm_data_ind()
Get rid of goto and double switch/case by putting connection handling
code into a separate function.

Change-Id: I12454cab06c105ccd9e2495e3a6f0640f2884885
2023-10-02 19:37:24 +02:00
Andreas Eversberg 666ec1d761 ASCI: Add GCC/BCC layer to support voice group/broadcast calls
Related: OS#5364
Change-Id: I22eacd018f18c18ba83dbd3dd874cf029344674d
2023-10-02 19:37:13 +02:00
Andreas Eversberg 1678f53f99 ASCI: Add group receive and transmit mode support to MM layer
Related: OS#5364
Change-Id: I05957182a57423ad947ab200b52f65fde859e110
2023-10-02 19:37:05 +02:00
Andreas Eversberg 615a88f69b Fix reception of MM messages at gsm48_mm_data_ind()
The patch "ASCI: Add GCC/BCC (call control) to mobility management"
breaks reception of MM messages. No MM connection setup is possible.

This patch fixes the issue.

Change-Id: I263739bb0220d19f14114714fe9d82505bdbd267
2023-09-28 13:53:49 +02:00
Andreas Eversberg c3467236a3 ASCI: Add channel notification event to MM events
This is required to notify MM layer about new and ceased group and
broadcast calls.

Related: OS#5364
Change-Id: Ifee286ba4628356cc19b5dc75f1843287c5d2342
2023-09-28 10:42:53 +02:00
Andreas Eversberg dd60a527be Refactoring encoding of mobile identity at mobile application
Deprecated functions gsm48_generate_mid_from_*() are replaced by
osmo_mobile_identity_encode_msgb(). Clean up code.

Change-Id: I9ff429bd50d718530fdad64a276053a35c8928f2
2023-09-28 10:42:43 +02:00
Andreas Eversberg b7663882c0 ASCI: MM connections are defined by 'ref' and 'protocol' tuple
VGCS and VBS calls may share the same (call) ref or share with other
protocols. Therefore the MM connection is defined by the reference and
the prococol discriminator.

Related: OS#5364
Change-Id: Ic280cd8c666660077bb2c2ef641f4cddd3b36eee
2023-09-27 14:02:41 +00:00
Andreas Eversberg 975351e250 ASCI: Add GCC/BCC (call control) to mobility management
GCC is the call control for voice group calls, BCC is the call control
for voice broadcast calls.

This patch includes the new message primitives between MM layer and the
GCC/BCC layers.

Related: OS#5364
Change-Id: If6f3cea4b2ca839559596a6ee5a3d169c6d85dbe
2023-09-27 14:02:41 +00:00
Pau Espin c2402244c1 layer23: Define imsi_attached field as bool
Change-Id: I47e234dcef4c5af09023318dda45d40c8c92b312
2023-05-22 16:12:09 +02:00
Pau Espin 3348f49179 Migrate network identifier fields to modern osmocom structures
This allows using well tested standarized API to print, compare, etc. usual
identifiers like PLMN, LAI, etc.
It also simplifies code by avoiding passing lots of parameters and
making it easier to identify which fields go packed together.
This is specially important since in the future more of those
identifiers will be added for GPRS.

Change-Id: I07a9289825c09ed748e53d36a746ea164c8a5d7f
2023-05-22 16:12:04 +02:00
Pau Espin 7626d0816f layer23: Use GSM_RESERVED_TMSI from libosmocore everywhere
Change-Id: Ib9483b8ae4067994aef523291733ae706ffabe7a
2023-04-26 14:14:29 +02:00
Pau Espin a7bf51ac0e layer23: Move vty_notify() to common/
Change-Id: Ic0a98e66adffa9fefeee6e69a4b5c691e0e9c789
2023-04-24 16:54:11 +02:00
Max e2930dad35 mobile: log state/event details on error
Change-Id: I24a4635e9a9a0984c0e1036e8b6ea19b08a06223
2023-03-06 17:27:39 +00:00
Max 69bbbc5249 mobile: log MCC/MNC of the network while registering
Change-Id: I114eade36303f161fea171745a1a9b05e461e349
2023-03-06 15:16:35 +00:00
Pau Espin f15eeadb21 layer23: Move subscriber.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I3727e40bcc9a4ee93aaf2c4ced070cc789653e80
2023-01-16 13:34:31 +01:00
Pau Espin 1953a21515 layer23: Move osmocom_ms to a separate file
This way we can extend its API and contents more easily,
and keep most of it together in one place.

Change-Id: Icb4891cc1e4a0ecb5f09cb8a84b0ebe1b91a46b8
2023-01-16 10:30:12 +01:00
Pau Espin ed9ae46f1d layer23: Add missing header dependencies to several files
Change-Id: I9819b12d1c24f6ee197daa887452b09418d689e8
2023-01-16 10:19:34 +01:00
Oliver Smith 1741372556 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I73be012c01c0108fb6951dbff91d50eb19b40c51
2021-12-14 12:52:04 +00:00
Vadim Yanitskiy 8194febb09 layer23/mobile: implement handling of TCH test loop commands
For more information, see 3GPP TS 44.014, sections:

  - 5.1 "Single-slot TCH loops", and
  - 8 "Message definitions and contents".

This feature has nothing to do with the Mobility Management, so
let's handle GSM48_PDISC_TEST messages in the Radio Resources
layer implementation (gsm48_mm.c -> gsm48_rr.c).

Change-Id: If8efc57c7017aa8ea47b37c472d1bbb1914389ca
2020-07-31 00:48:06 +07:00
Vadim Yanitskiy e7e4d86f0e layer23/mobile: cosmetic: use GSM48_PDISC_TEST from gsm_04_08.h
Change-Id: Ie1f14b37f6138f5a019a25bdbc8a3531418df6c2
2020-07-29 03:58:23 +07:00
Martin Hauke 1f7a2ab5d3 Fix common misspellings and typos
Change-Id: I962b42871693f33b1054d43d195817e9cd84bb64
2019-10-17 08:07:39 +00:00
Vadim Yanitskiy cb9e020471 mobile/gsm48_mm.c: use proper types for gsm48_rr_hdr
Change-Id: I29ed122b8956260b9f847cc0e3e81a28d6762632
2019-05-03 00:57:50 +02:00
Holger Hans Peter Freyther 812866daab Move from libc random() to osmo_get_rand_id (2nd attempt)
When starting multiple mobile in the same second, the libc random number
generator will be seeded to exactly the same value.

The random bits inside the RACH request(s) will be exactly the same
across multiple mobile and when the channel fails they all pick the same
randomized back-off timing.

Use stronger random numbers and replace all calls to random(2) with
osmo_get_rand_id. Add a fallback to try random().

[v2: Add helper to make sure the result is int and between 0 and
RAND_MAX]

Change-Id: Icdd4be88c62bba1e9d954568e48f0c12a67ac182
2018-07-23 20:55:45 +01:00
Vadim Yanitskiy a0eef8d2e8 Revert "Move from libc random() to osmo_get_rand_id"
It was decided to migrate to osmo_get_rand_id() and use random()
as a fall-back. But there is a critical difference between both
functions: osmo_get_rand_id() fills an input buffer with random
bytes (0x00 - 0xff), while *random() returns a value in range
between 0 and RAND_MAX.

osmo_get_rand_id() was used in a wrong way, so in some cases we
could get a negative value (how about IMEI starting from '-'?),
what isn't expected in many cases and could lead to unexpected
behaviour and segmentation faults...

This reverts commit 6d49b049ee.

Change-Id: I7b2a8a5c63cf64360a824926a2219fd7e419b1bb
2018-07-17 05:09:58 +07:00
Holger Hans Peter Freyther 6d49b049ee Move from libc random() to osmo_get_rand_id
When starting multiple mobile in the same second, the libc random number
generator will be seeded to exactly the same value.

The random bits inside the RACH request(s) will be exactly the same
across multiple mobile and when the channel fails they all pick the same
randomized back-off timing.

Use stronger random numbers and replace all calls to random(2) with
osmo_get_rand_id. Add a fallback to try random().

Change-Id: Ie0cc64663cd4b90c027b79545dc5d3ac9d87b9dd
2018-07-11 21:13:11 +00:00
Holger Hans Peter Freyther f976ad9dc4 mobile: Notify MM status changes and generate primitive op ind
Notify once the mm state has been changed. Unfortunaley one state
transition can immediately trigger more transitions (recursively).
In the mid-term it might be best to force all primitives to be
async to avoid unpredictable behavior (e.g. make a shutdown while
being a recursion down?)

Change-Id: I8e9dcf7fd9116985aa060ba027ba74107a19223a
2017-12-03 12:58:52 +00:00
Holger Hans Peter Freyther eddf339871 mobile: Instead of putting semantic in a comment, use an enum
The enum was created to understand the different states during
the shutdown and find places where it is used. The normal
transitions are like.

	Idle -> Imsi Detach -> L1 Reset -> Done
	Idle -> L1 Reset -> Done

The shutdown can get stuck in case:

* Out of memory situation while handling IMSI detach (timeout)
* Never receiving l1 reset acknnowledgment.

The code could benefit from the move to osmo fsm to deal with
proper timeouts.

Change-Id: Iee1140e4848923c7270495c381bf87b7e3fddee1
2017-11-27 17:54:03 +08:00
Vadim Yanitskiy 8dbacacd37 mobile: get rid of unused variables / functions
Change-Id: Id867ffed9b2b67025320d002e1e009e19c759a23
2017-11-05 23:41:42 +07:00
Vadim Yanitskiy b353686451 mobile/gsm48_mm.c: use secure gsm_7bit_decode_n
Since some 'gsm_7bit_*' functions were deprecated and replaced by
more secure ones with the '_n_' postfix in names, it's better to
use the updated functions.

Change-Id: I4499b592a0dfea71462aed19fe641419d79b3cbd
2017-11-05 23:41:42 +07:00
Vadim Yanitskiy 3aaf127cc1 mobile/gsm48_mm.c: strip unused variable
Change-Id: I2708628263bec4bc6bf53a357928e23609b40c64
2017-05-25 02:11:53 +03:00
Bhaskar 2542a55c87 gsm48_mm.c: Bugfix: payload_len should be signed int
As we later check if payload_len < 0, it should be signed, not unsigned.
2013-05-23 07:49:50 +02:00
Andreas Eversberg 97eb0c701d Fix: Check if cell is barred, before performing location updating
If not checked, the MM process will crash, due to an endless loop
of trying to do location updating to barred cell.
2012-12-29 15:37:31 +01:00
Andreas Eversberg 07f8345646 Fixed decoding of hexadecimal LAI components
libosmocore has changed its LAI decoding from hex to decimal. This caused
wrong decoding of MCC and MNC. In order to provide required hex
transcoding, special hex encoding and decoding function are added to
mobile/sysinfo.c.
2012-10-30 10:26:20 +01:00
Tim Ehlers b4a8badc45 mobile: Add vty option to force rekeying for every new channel
Written-by: Tim Ehlers	<osmocom@ehlers.info>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-02-14 23:54:25 +01:00
Andreas Eversberg 52f2d586ae mobile/MM: Fixed handling of T3230 (MM connection timeout)
If network will not respond to (additional) service request, the timeout
will abort the pending MM connection and return to the state before the
MM connection was requested or wait for network command.
2011-11-17 21:01:38 +01:00
Andreas Eversberg 0730907840 mobile/MM: Fixed handling of T3220 (IMSI detach timeout)
If network will not terminate radio connection, the timeout will abort
the radio connection.
2011-11-17 21:01:26 +01:00
Andreas Eversberg c0c1195a57 host/mobile: Indicate unsupported TS 04.14 test messages in log
There is no support for TS 04.14. A logging message will inidcate this,
if a tester requests test functions. A STATUS message will be sent
as it is for for other usupported protocol types received.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:20 +01:00
Andreas Eversberg 3426063f56 host/mobile: Adding (partly implemented) supplementary service support
Use VTY to request your extension number form OpenBSC:

en
service 1 *100#

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:20 +01:00
Andreas Eversberg fb7be589e6 host/mobile/sms: Adding SMS support for osmocomBB/mobile
Both MO and MT SMS are supported.

Transmission an reception can be controlled via VTY:

en
sms 1 <destination> <text>

All received SMS are stored in "~/.osmocom/bb/sms.txt".

SMS transmission is performed on SAPI 3 datalink, using DCCH or ACCH.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:20 +01:00
Andreas Eversberg cf55219d45 host/mobile/sms: Adding SAPI 3 support to MM and RR layers
RR now handles SAPI 3 datalink.

MM connections now have and individual sapi, so MM can use right SAPI
for communication with other layers, as well as releasing the right
MM connections in case of link release.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:20 +01:00
Sylvain Munaut 9311c0025f host/mobile: Whitespace fixes, no functional changes
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:19 +01:00
Andreas Eversberg 1a2778e7d4 host/mobile: Prevent the MM layer from making calls when not attached
If location updating (attachment) fails, the mobile returnes into idle
state. Because the SIM may be valid in this location area, the mobile must
check if the SIM is already attached. If not it may not change to normal
service.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:19 +01:00