Commit Graph

46 Commits

Author SHA1 Message Date
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
Andreas Eversberg 210de12ec4 Fix of wong Classmark 2 when doing CM Service Request.
Same reason as the commit below... (3b2b3b09a)

Thanx again to Dieter for pointing this out.
2011-08-06 17:56:06 +02:00
Andreas Eversberg 3b2b3b09a9 Fix of wong Classmark 1 on Location Updating and IMSI Detach
The reason for the the wrong power capability comes from the fact that
"rr->cd_now" is not yet set and so the ARFCN is 0 which causes the
GSM900 power capability to be used. It is set to "Class 4" in the
configuration file per default, however this value is not defined for
GSM1800/1900.

Thanx to Dieter Spaar for finding this bug!
2011-08-04 19:30:29 +02:00
Andreas Eversberg 9548ac0a41 [layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.

The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.

There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.

In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:

enable
monitor network 1  (where '1' is the instance of the MS)

In order to see the current state of the processes, enter:

show ms
2011-07-17 11:12:15 +02:00
Andreas.Eversberg 58ac7e0e98 [layer23] Adding Quadband support and GSM 4x0 support
This makes it possible to use GSM 850 and PCS 1900 bands, as used in the
US. The support relies on the phone hardware.

Each band (900, DCS, 850, PCS, 480 and 450) can be enabled and
disabled individually for each setting.
2011-05-29 19:51:54 +02:00
Pablo Neira Ayuso d3ba2f6037 src: use namespace prefix osmo_timer*
Summary of changes:

s/struct timer_list/struct osmo_timer_list/g
s/bsc_add_timer/osmo_timer_add/g
s/bsc_schedule_timer/osmo_timer_schedule/g
s/bsc_del_timer/osmo_timer_del/g
s/bsc_timer_pending/osmo_timer_pending/g
s/bsc_nearest_timer/osmo_timers_nearest/g
s/bsc_prepare_timers/osmo_timers_prepare/g
s/bsc_update_timers/osmo_timers_update/g
s/bsc_timer_check/osmo_timers_check/g
2011-05-15 14:39:30 +02:00
Pablo Neira Ayuso ade79a0083 src: use new libosmogsm and include/osmocom/[gsm|core] path to headers
This patch changes include paths to get osmocom-bb working with
the current libosmocore tree.

Among all these renames, you can notice several tweaks that I
added on purpose, and that require some explanation, they are:

* hexdump() in osmocon.c and osmoload.c has been renamed to avoid
clashing with hexdump() defined in libosmocore.

* gsmmap now depends on libosmogsm. Actually I had to cleanup
Makefile.am because I was experiencing weird linking problems,
probably due to a bug in the autotools. With the change included
in this patch, I got it compiled and linked here correctly.

This patch has been tested with the phone Motorola C123 and the
following images files:

* firmware/board/compal_e88/hello_world.compalram.bin
* firmware/board/compal_e88/layer1.compalram.bin

Using the osmocon, bcch_scan and mobile tools.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-04-26 02:55:30 +02:00
Andreas.Eversberg 633b611dc1 [layer23] Adding LAI to debug output of LOCATION UPDATING REQEST 2010-11-20 08:30:45 +00:00
Andreas.Eversberg f8903f06d1 [layer23] Cleanup of mobile application
All functions for handling mobile instances and mobile relevant parts are
moved to mobile/app_mobile.c, the mobile/main.c and mobile/mncc.c become a
simple out-of-the-box mobile application. (making calls)

The mobile/main.c can be replaced easily by a different application now.
this application may have it's own call control implementation (layer 4).
Full configurations via VTY is still possible and required in this case.
2010-11-14 11:52:57 +00:00
Andreas.Eversberg 6f2b172780 [layer23] Added support for multiple MS instances
To create another instance: 'ms <name> create'

To remove an instance: 'no ms <name>'

If no instance exists, 'ms 1' is created automatically on startup.

Each instance can be enabled / disabled by using 'shutdown' or
'no shutdown'. Multiple instances may share the same layer2 socket (same
phone hardware), but in this case only one instance can be enabled at the
same time. This makes it much easier to select different settings without
modifying them.

A 'shutdown' initiates the IMSI detach procedure before shutdown is
completed. A 'shutdown force' will immidiately shutdown.

There is no need to restart the software anymore, if fundamental settings
are changed. In this case, a 'shutdown' followed by a 'no shutdown' will
do the job.

If you already have an old osmocom.cfg, you need to "no shutdown" it.
Everything else behaves as before.
2010-11-13 18:45:09 +00:00
Andreas.Eversberg 50be02f78e [layer23] Fixed header handling of some radio ressource SAP msgs 2010-10-16 08:18:31 +00:00
Andreas.Eversberg f0c807a682 [layer23] Rework of "support"-features, features can be disabled now
Supported features of hardware (support.c) can be disabled by config.
This way the full featured mobile can be downgraded to indicate less
features to the network, like disabling speech support or crypto support.
2010-10-03 10:51:31 +00:00
Andreas.Eversberg 0da908f3f1 [layer23] Disabled display of SYSINFO message at message handlers
This way the SYSINFO is logged once and not three times.
2010-09-29 13:29:31 +00:00
Andreas.Eversberg 53d8bf0faa [layer23] Added missing state change, if location update is not required. 2010-09-29 13:18:46 +00:00
Andreas.Eversberg e326e81728 [layer23] Handle invalidation of TMSI correctly 2010-09-26 22:30:15 +00:00
Andreas.Eversberg b3e44ab19f [layer23] Added debug about identity (TMSI/IMSI) at LOC.UPD / IMSI DETACH 2010-09-19 12:52:24 +00:00
Andreas.Eversberg 3ba9a03d28 [layer23] Added missing TMSI REALLOCATION COMPLETE reply
Fix by Dieter.
2010-09-18 13:30:28 +00:00
Andreas.Eversberg 66d8352a24 [layer23] Added missing state change 2010-09-17 09:42:06 +00:00
Andreas.Eversberg b349e38838 [layer23] CM service is now accepted when ciphering has started
Sylvain pointed out that CM SERVICE ACCEPT message is not requred, if
ciphering has been completed. In this case, an RR_SYNC_IND is sent
to mobility management, and treated there as CM SERVICE ACCEPT.
2010-09-17 09:07:29 +00:00
Andreas.Eversberg dece8977f4 [layer23] Fixed A5/1 support coding
Dieter pointed out that A5/1 is indicated as supported, if the A5/1 bit in
the classmark IE is 0.
2010-09-15 14:21:06 +00:00
Andreas.Eversberg 0d9a3b91c1 [layer23] Fixed security issue
Authentication must not be performed using SIM client, if different IMSI is
used, to protect identity of caller.
2010-08-29 11:05:07 +00:00
Andreas.Eversberg f20a1c3de8 [layer23] Layer 3 now uses SIM client to request and update SIM data
The SIM reader can be selected via VTY, but because it is not yet
implemented in layer1, nothing happens when selecting it.
2010-08-28 09:46:36 +00:00
Andreas.Eversberg 5fcccd3933 [layer23] Fixed handling of IMSI in special cases 2010-08-15 18:44:16 +00:00
Sylvain Munaut 9e9f99c0a0 layer23: Split [2/2] -> The header files
This split the headers and adapt the source.

We use osmocom/bb as a prefix because libosomore also
uses osmocom and generic names such as misc & common could
conflict in the future.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-27 20:49:27 +02:00
Sylvain Munaut de21ca4aaf layer23: Split [1/2] -> The source code
We split into :
 - common: Everything that can be shared
 - mobile: The real spec compliant mobile phones
 - misc:   Different test stuff

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-27 20:49:04 +02:00