Commit Graph

333 Commits

Author SHA1 Message Date
Vadim Yanitskiy 3483d4d844 mobile/gsm322.c: prevent buffer over-/under-run
Change-Id: Ic12587a6c6456b8663e5357cf68a22c6d1927a07
2017-11-09 03:46:41 +00:00
Vadim Yanitskiy 43ecde0fce mobile/gsm322.c: prevent calling memset() with zero length
This change prevents a possibility of calling memset()
with constant zero length parameter, and the corresponding
compiler warning.

Change-Id: I2d8d78474614939659a7f24d5007b1c890776b1a
2017-11-09 03:46:41 +00:00
Holger Hans Peter Freyther 52fbe66ca7 mobile: Do not exclude DGPS from the list of default categories
I don't remember why we parse the categories like this. First if
the mobile doesn't use a subsystem there is no harm to have it
enabled, second the default levels can be adjusted for all apps
and third we have the VTY to reconfigure these logging targets.

Change-Id: Ia874b7ed127026b8395072a3bac2aed9944b1cce
2017-11-09 03:45:24 +00:00
Neels Hofmeyr 87038afe86 vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I300a4b34a2031fd09d110ef18375d140a6dca7ba
2017-11-09 01:14:49 +00:00
Vadim Yanitskiy d0ed4de085 host/mobile: use osmocom_ms as talloc context
As we use talloc, it's absurdly not to use the main feature of
the library - hierarchical memory management. This change sets
talloc context of all sub-allocated objects to related osmocom_ms
instance. So, as soon as osmocom_ms instance is destroyed, all
sub-allocated chunks are getting destroyed too.

Change-Id: I6e3467ff739f3e6dc8dd60cc6d1fcd3f8e490ce9
2017-11-08 18:46:57 +07:00
Vadim Yanitskiy 8dbacacd37 mobile: get rid of unused variables / functions
Change-Id: Id867ffed9b2b67025320d002e1e009e19c759a23
2017-11-05 23:41:42 +07:00
Vadim Yanitskiy 4fbf93040e mobile/gsm411_sms.c: use secure gsm_7bit_(en|de)code_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: I58150e9b74699e5f54b9a83416ad8efcb2eccd8e
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 37872f1032 mobile/gsm480_ss.c: use secure gsm_7bit_(en|de)code_n_ussd
Since some 'gsm_7bit_*' functions were deprecated and replaced by
more secure ones with the '_n_' suffix in names, it's better to
use the updated functions.

Change-Id: If8a1983592f5800e3981f29962eb333ac9473f40
2017-11-05 23:41:42 +07:00
Vadim Yanitskiy 584cc7a26b mobile/vty_interface.c: fix incompatible pointer type warning
According to the vty_app_info struct definition, the go_parent_cb()
should return an integer, but not enum. So, this change fixes the
following compiler warning:

> warning: initialization from incompatible pointer type
>   .go_parent_cb = ms_vty_go_parent,

Change-Id: Ib55e43eaaebdd9fe0d74a030b1057ae82804a77e
2017-11-05 23:41:42 +07:00
Vadim Yanitskiy b7ff8b5893 mobile/main.c: fix deprecated call to msgb_set_talloc_ctx()
The usage of msgb_set_talloc_ctx() was deprecated many days ago,
so it's time to use the proper replacement.

Change-Id: I56440d8e2152c4bb2e5ad677f88c61742d2ad9ca
2017-11-02 14:21:16 +00:00
Vadim Yanitskiy aceb6a80d8 mobile/vty_interface.c: add missing 'vty/misc.h' header
This header contains declaration of the osmo_talloc_vty_add_cmds().

Change-Id: Icdafb22758897cfb67e249f37991f4af4213a5fa
2017-11-02 14:21:16 +00:00
Vadim Yanitskiy 8a617cd160 mobile: register the talloc context introspection command
This change registers the command, which is now implemented in
libosmocore since the 463deef8c209dd7eb023ac70bf41fa9893ad35ed
and allows to introspect mobile application's talloc context
directly from the VTY interface.

Change-Id: I979d64ae63d385f4fd082a4e3f981cbf5ab28338
2017-10-29 17:46:10 +00:00
Vadim Yanitskiy 363d4d22da mobile: clean up and share example configs
It is better to have a shared example config files directory,
like other Osmocom projects do.

Change-Id: I903f31a8afc518ac258cdaeaf76430de07f7edea
2017-10-23 15:11:16 +03:30
Vadim Yanitskiy da9e830af0 mobile/vty_interface.c: do not write 'exit' to config
Since we use indenting as means to implicitly exit child nodes,
no need to write 'exit' at the end of each child node.

Change-Id: I73b0f3926d766d21ca68c8e01b7fc70b2b4636c9
2017-10-23 00:33:58 +03:30
Vadim Yanitskiy c5a08ef4f4 mobile/vty_interface.c: do not install default commands
Since in recent version of libosmocore default commands (such as
'exit' and 'end') are being installed by default, no need to
install them twice. This will crash the program.

Change-Id: I82c8d04ccc7dc3f19589a79b859a2c993bd1d39c
2017-10-23 00:33:29 +03:30
Vadim Yanitskiy ae31c37d2b mobile/main.c: clean up config file selection logic
The 903e2515 introduced the following problems:

  - The home variable is allocated dynamically by talloc,
    but not being freed. There is no need for dynamical
    memory allocation, as the getenv() returns a pointer
    to a value in the environment or NULL.

  - In case of custom configuration file, a pointer to
    a part of stack (not heap) is passed to talloc_free().
    This may cause unexpected behaviour of segfault.

Let's fix both of them.

Change-Id: I79cc3b954c3018b7e780f6351c3030c3062470b5
2017-09-09 00:40:43 +03:00
Max 903e2515f5 Add arbitrary config file location support
All other Osmocom projects use '-c' command line option to specify the
location of config file. Let's do the same with fallback to existing
implicit config file name logic.

Also print config file path and vty host on startup.

Change-Id: Idaac3ff8d1f8541e00c45290db948a67bb899311
2017-09-07 18:08:03 +02:00
Vadim Yanitskiy a52abd5d4f vty_interface.c: use RPLMN from settings if preset
Previously, when testcard was attached via VTY interface, the
initial values were used for MCC / MNC, LAC and TMSI, even if
correct RPLMN settings were set.

Change-Id: Ic70889cdb6be95f06d0c2df710524b4128b5f72b
2017-07-27 12:25:34 +06:00
Vadim Yanitskiy 064ffe6563 host/mobile: use talloc for ms->name allocation
The approach of talloc memory management reduces memory usage,
and prevents some buffer overflows, which were possible before.

Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
2017-05-25 11:43:49 +00:00
Vadim Yanitskiy 3aaf127cc1 mobile/gsm48_mm.c: strip unused variable
Change-Id: I2708628263bec4bc6bf53a357928e23609b40c64
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy b2a1f72710 mobile/gsm480_ss.c: gsm480_mmss_ind: return rc
Change-Id: Iabaccdbdfc5a5eb6424bd1603f405241650f13d8
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy 81b6e7d9f4 mobile/gsm48_rr.c: fix BA range exceed check
Change-Id: Ic2ebe9faeeda7ce812527962d209e6049f2dfc75
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy e569ac3bc5 mobile/gsm480_ss.c: fix copy-paste error
Change-Id: I23287c0f31bee9c1b710f17f932633d2c621dab0
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy 03485409be mobile/gsm322.c: fix mcc/mnc typo
Change-Id: I4a3aaa0465598b17ccd30ec4cbeb90429216540e
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy 06f44d3772 mobile/gsm322.c: check fwrite() return value
Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy 03aace5818 host/app_mobile.c: do not exit in mobile_new()
Previously, if there was any error during a new osmocom_ms
structure allocation, the mobile_new() used to call exit()
directly. Since we always check return value of this function
it would be more correct to return NULL in any bad case.

Change-Id: I9a594dd1d133f0c0740dc3bff41633f94099b593
2017-05-25 02:11:53 +03:00
Harald Welte 0cdf4b0a68 Support Early Classmark Sending
If SI3 rest octets indicate early CM Sending is allowed, and the
'support' indicates we support it (which we now do by default), then
send the classmark change message every time a LAPDm link layer is
established.
2017-01-15 20:46:27 +01:00
Harald Welte c9ad46ac75 Fix encoding of padding at end of CLASSMARK 3 IE
Contrary to e.g. SI rest octets, the padding at the end of a CLASSMARK 3
Information Element is padded with zeros, not with L.  There is no 0x2b
padding in this case.
2017-01-15 20:46:26 +01:00
Harald Welte 214236fd5d mobile.c: Don't register 'end' command to CONFIG_NODE
The CONFIG_NODE already has an 'end' command, and recent versions of
libosmocore actualyl check for conflicting/duplicate command
registrations and make the application crash in this case.
2017-01-15 20:46:26 +01:00
Harald Welte f95d518c63 mobile: Finally fix copyright notice
After 7 years it is about time...
2017-01-15 20:46:26 +01:00
Яницкий Ва дим bec943f0b7 host/mobile: Improved SAP interface integration
1) Now the SAP interface is selectable as SIM source using the 'sim sap'
   command in VTY.
2) SAP connection starts only if it is configured as SIM source.
3) Fixed sap_socket_path configuration r/w errors.

Written-by: Яницкий Ва дим <axilirator@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2016-01-18 21:08:45 +01:00
Яницкий Ва дим 65f05ce618 mobile: Fix for "Added runtime selection of gps device"
The 'gps host HOST:PORT' line in the config file now is generated correctly.
So that it is parsed correctly when loading the config on next startup.
Also the gpsd port now is parsed as it should without a colon.

Written-by: Яницкий Ва дим <axilirator@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2016-01-18 21:08:45 +01:00
Harald Welte c400827539 autoconf: Migrate from INCLUDES to AM_CPPFLAGS 2015-12-31 14:12:14 +01:00
Sylvain Munaut fc20a37cb3 host/mobile: Finish working support for the SAP interface
Patch mostly written by Nico Golde
and some cleanup/testing by Domonkos Tomcsanyi

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-04-28 15:57:54 +02:00
Max d7b69212f8 mobile: Use osmocom auth API instead of direct calls
Submitted-by: Max <max.suraev@fairwaves.co>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-06-15 19:00:13 +02:00
Andreas Eversberg 2d0a5acaf3 mobile/SS: Fixed bug in parsing of known supplemenary service codes
Use correct variable to check if supplementary service code is known
or not.
2013-12-24 07:33:58 +01:00
Bhaskar 761127b6b4 host/mobile: Fixup in error checking path of l23_app_init
From: Bhaskar <niceguy108@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-05-23 08:28:18 +02:00
Sylvain Munaut 2529320420 host/mobile: Fix trans_assign_trans_id() users error checking
The returned value of trans_assign_trans_id() must be stored into a
'int' rather than uint8_t to allow proper testing of negative return
values (errors).

Thanks to Bhaskar <niceguy108@gmail.com> for the original
patches.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-05-23 08:22:48 +02: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
Sylvain Munaut 7684cdd20c host/mobile: Remove duplicate A5/1 support indication in vty 'show support'
Patch-by: Martin Hauke <mardnh@gmx.de>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-04-14 09:00:51 +02:00
Harald Welte 1a80966cbd support.c: fix typo in comment 2013-03-07 17:33:58 +00:00
Andreas Eversberg 6fead1c78c layer23: Be sure to close mncc socket on exit of mobile instance 2013-01-13 22:35:01 +01:00
Andreas Eversberg fed1774b65 mobile: Fixed CLIR invokation / suppression
If "clip" is given at vty, CLIR must be suppressed, which results in
presentation of caller ID digits, even if suppressed by network.

If "clir" is given at vty, CLIR must be invoked, which results in
restriction of caller ID digits, even if not suppressed by network.

Note: This only work for outgoing caller ID. Incomming caller ID
restriction cannot be suppressed.
2013-01-10 19:31:12 +01:00
Dario Lombardo dadafc49fb misc: Fix typos 2013-01-08 22:12:25 +01:00
Andreas Eversberg bff6bb7b54 mobile: Fixed ignoring of MDL-ERROR-IND
Some MDL-ERROR causes must not lead to link failure. The missing
"return 0" causes all errors to be ignored which are not listed inside
switch/case statement.
2013-01-08 13:30:35 +01:00
Andreas Eversberg f6b52d74dd mobile: Allow test card to be maked as already attached
This way it is possible to use test card without making attachment
to the network, if the LAI matches. It can be used to do faster
testing.
2013-01-07 11:22:08 +01:00
Andreas Eversberg 25c5e8221d mobile: Improved exit of mobile process, reset phone
If mobile phone has started, it is reset after shutdown. This
ensures that the phone is not transmitting anymore, especially
while shutting down in dedicated mode.

Using CTRL+c:
The first signal causes initiating of shutdown with detach
procedure. The second signal causes initiating of shutdown
without detach procedure. The third signal will exit process
immidiately. (in case it hangs)

Using CTRL+z:
The first signal causes initiating of shutdown without detach
procedure. A subsequent CTRL+c would exit process immidiately.
2013-01-07 10:39:59 +01:00
Sylvain Munaut 4df6653d8d mobile/gsm411: Fix printf format warning
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-02 20:44:10 +01:00
Sylvain Munaut 9c1d7b10b8 mobile/gsm411: Adapt to new libosmocore API for SMC/SMR by adding id
Here we just use the transaction ID

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-02 20:44:10 +01: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 d72cb4401e Rename various "rxlev" variable to "rxlev_dbm" and correct their signess
All levels in range of 0..63 are now uint8_t and use "rxlev" as
variable name. All levels in range of -110..-47 are now int8_t and use
"rxlev_dbm" as variable name.
2012-11-22 16:00:33 +01:00
Harald Welte 85f4e1b3b8 fix previous commit: use dbm2rxlev()
As andreas points out, there are structure members that are called
'rxlev' but which don't use the scaling (0..63) of the GSM specs, but
which are already a signed type and in dBm.  So they need to be
converted.

TODO: Rename those structure members to rxlev_dbm or something that
explicitly states it is _not_ an 'RXLEV' value in terms of GSM.
2012-11-22 10:15:10 +01:00
Harald Welte 73a809e57b Tell L1CTL_FBSB_REQ the expected received signal level
As Dieter points out, this drastically improves the resiliance to high
receive levels on the C155.  We cannot blindly assume a received signal
level of -85 dBm if the BTS is 2m away and we actually receive -40 dBm.

This patch extends the L1CTL_FBSB_REQ data structure in layer 1 with the
respective field, as well as the l1ctl_tx_fbsb_req() API function called
from the various layer23 apps.

"mobile" and "bcch_scan" already did a PM request and thus know the
expected signal power.  "ccch_scan" and "cbch_sniff" apparently don't
do, so the -85 dBm constant is now hardcoded into the host-side source
code there, and should probably be fixed in a follow-up patch.
2012-11-20 10:13:44 +01:00
Pavel Baturko 2879e77bd3 Fix wrong print of scan freq when using gsm_print_arfcn twice for the same log message 2012-11-16 14:47:54 +01:00
Joshua Lackey 50c3ca922b Fix: Correctly convert ARFCN to index.
If you enable PCS, you'll never make it out of power-measurement without
this patch.
2012-11-15 10:42:18 +01:00
Andreas Eversberg 570c9716c2 Fix: Change T200 of LAPDm if SAPI 0 and SAPI 3 share bandwidth on SDCCH
We use 1 second on FACCH and 2 seconds on SACCH when SMS is transfered
during a call on TCH. There is no impact on bandwidth, because SAPIs use
differen channels.

In order to correctly transfer SMS during SDCCH, the T200 must be raised
from 1 (SAPI 0) to 2 (SAPI 0 and 3), so T200 will not timeout before
receiving acknowledge from BTS. This is because both SAPIs share the same
ressource on SDCCH. After release of SAPI 3, T200 is lowered back to 1.
2012-10-30 16:11:35 +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
Kevin Redon ca05975c8f Fix linking with GNU ld 2.22 and libgps
Error:
gcc -Wall -I/home/kevredon/osmocom-bb/src/shared/libosmocore/include -I/home/kevredon/osmocom-bb/src/shared/libosmocore/include -g -O2 -D_HAVE_GPSD  -lgps -o cell_log main.o app_cell_log.o cell_log.o geo.o ../common/liblayer23.a /home/kevredon/osmocom-bb/src/shared/libosmocore/build-host/src/.libs/libosmocore.a /home/kevredon/osmocom-bb/src/shared/libosmocore/build-host/src/gsm/.libs/libosmogsm.a /home/kevredon/osmocom-bb/src/shared/libosmocore/build-host/src/codec/.libs/libosmocodec.a -lm
../common/liblayer23.a(gps.o): In function `osmo_gpsd_cb':
/home/kevredon/osmocom-bb/src/host/layer23/src/common/gps.c:79: undefined reference to `gps_waiting'

Fix:
Holger told me to do so (he knows better then me about autoconf)
- set CFLAGS and LIBS for LIBGPS in layer23
- add libgps CFLAGS and LIBS in Makefile.am for common, misc, mobile
I would have done the following (which also works):
-AC_CHECK_LIB(gps, gps_waiting, CFLAGS+=" -D_HAVE_GPSD" LDFLAGS+=" -lgps",,)
+AC_CHECK_LIB(gps, gps_waiting, CFLAGS+=" -D_HAVE_GPSD" LDFLAGS+=" -lgps" LIBS+=" -lgps",,)
2012-09-17 08:40:44 +02:00
Tim 43c588b6c6 l23: Add option for mobile-app to bind to other interfaces than localhost
Signed-off-by: Tim Ehlers <osmocom@ehlers.info>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-03-01 22:45:51 +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
Kurtis Heimerl 987787f0cb Just a quick bug fix to gsm322.c.
Basically, there were two commands in an "else" block without brackets,
causing the

"end = 1023+299"

command to execute regardless of the state of index.

Signed-off-by: Andreas Eversberg <jolly@eversberg.eu>
2012-02-02 08:39:56 +01:00
Andreas Eversberg c2b823faf0 layer23/mobile: Fixed cell re-selection after loosing signal
Test showed that loosing the signal in dedicated mode caused a complete
rescann of all cells. By keeping the cell selected, the process can use
the neighbour cell informations to do a quick search for the best cell
afterwards.
2012-01-02 02:21:19 +01:00
Andreas Eversberg 5e1765c332 layer23/mobile: Minor fix of debugging output 2012-01-02 02:15:26 +01:00
Andreas Eversberg 925322c634 layer23/mobile: Enable SIM reader by default
If there is no SIM card in the reader, the SIM process would
automatically proceed without SIM anyway.
2012-01-02 02:08:08 +01:00
Holger Hans Peter Freyther 950f7d15e8 layer23: Call talloc_free unconditionally
talloc_free will check for NULL and return -1.

_talloc_free(void *pyr)
{
        if (unlikely(ptr == NULL)) {
                return -1;
        }
...
2011-12-11 15:47:30 +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 fe2e57bc80 host/mobile: Mobile will use SMS Service Center Address from SIM
In case the SMS Service Center Address is not set in the config, the
Address from the SIM card is used. The mobile checks if either one is
defined, otherwise it will refuse sending SMS.

Since records of SIM are read, this patch includes fixes to talk
correctly with the SIM client.

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 8f77cbecb4 host/layer23: Removed local copy of LAPDm, using libosmocore instad
Since libosmocore already has LAPDm implementation, we don't need the
local copy of LAPDm code anymore.

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 97f688a7af host/mobile: Fixed paging response with correct identity type
In case we got paged with IMSI, but even if we have a valid TMSI, we need to
respond with IMSI, because the network may not know our TMSI anymore.

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 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 11b4028664 host/mobile: Fix indentation in gsm48_cc, no functional change
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 0be0680ab5 host/mobile: Adding memory leak debugging
When mobile exits, a list of allocated memory chunks are dumped to
stderr. This helps to find talloc_free / msgb_free leaks.

During process, a SIGUSR1 or SIGUSR2 can be used to dump currently
allocated memory chunks.

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 321e3ae2fb host/mobile: Adding telnet_exit to free telnet connection ressources
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:19 +01:00
Holger Hans Peter Freyther 6d1f116338 misc: u_intX -> uintX in the host directory
Use C99 stdint.h for the inttypes.
2011-11-06 21:55:40 +01:00
Andreas Eversberg 4d077b0e4c [mobile] Adding option to run as daemon 2011-09-04 19:37:57 +02:00
Andreas Eversberg c9927c72ea [mobile] Using socket application interface with mobile application
Use "-m" with mobile app, to use it in conjunction with LCR or other
applications.
2011-09-04 10:02:43 +02:00
Andreas Eversberg 5c8b76e74e [mobile] Adding socket application interface code from OpenBSC. 2011-09-04 09:57:51 +02:00
Andreas Eversberg d84ba5616f [mobile] Disable SMS by default, because SMS is not supported 2011-08-13 09:40:09 +02:00
Steve Markgraf fda9135874 mobile/vty: Add missing 's' for 'skip-max-per-band' configuration parameter
Thanks to Sylvain for pointing this out.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2011-08-11 13:45:31 +02: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 1a5461fb2b layer23: Add mobile support for sending / receiving voice frame through MNCC
Support GSM FR codec only so far.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28 21:30:51 +02:00
Andreas.Eversberg aa4a819d68 layer23: Adapt to new logging API: fix calls to log_init
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28 21:30:50 +02:00
Andreas Eversberg 8d24b2f395 [mobile] Added missing curly braces, as proposed by Harald 2011-07-17 12:23:59 +02:00
Andreas Eversberg 051dedd235 [layer23] Added special return value for invalid MCC/MNC input
This way an MNC of 000 can be entered.
2011-07-17 12:15:04 +02:00
Andreas Eversberg 9cfc096477 [layer23] Correctly report to restart mobile instance after band change
Mobile instance must be restarted (shutdown / no shutdown) in order to
apply changes to the available ARFCNs.
2011-07-17 12:13:34 +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 c99e2778f0 [mobile] Corrected output value of PCS power class 2011-07-17 10:58:21 +02:00
Andreas Eversberg 072c2d4641 [mobile] Adding option to hide most default values in config
In order to shrink config output, a new config option "[no] hide-default"
is added. The config is now easier to read, but does not show all available
options, if they are set to default. Newcommers may want to see all
available options in config. Therefore all options are show by default.

To hide default options, enter:

configure terminal
hide-default
end
2011-07-17 10:52:05 +02:00
Andreas Eversberg a33bc87fe7 [mobile] Adding PCS band to list of maximum ARFCNs to scan in one band 2011-07-17 10:23:35 +02:00
Andreas Eversberg cc10636f91 [mobile] Adding security warning, if default IMEI is not changed 2011-07-17 10:18:46 +02:00
Andreas Eversberg af06f00219 [layer23] Adding "neighbour cell" logging category: DNB 2011-07-17 10:03:34 +02:00
Andreas Eversberg 599d922134 [layer23] Detach SIM, if reading fails
This way the mobility management and cell selection process continues as
if no SIM has been inserted.
2011-07-17 09:50:36 +02:00
Andreas Eversberg e91dfa950e [layer23] Fixed handling of channel 0 in certain loops
The ARFC counts from 1 to 1023, and then to 0. The index of these loops
count from 1 to 1024. The index 1024 stands for ARFCN 0.

This also reverses commit eb77945e16.
2011-07-17 09:09:32 +02:00
Harald Welte cd4da1d350 gsm48_rr: Don't overflow array boundary
Detected by Smatch:
src/host/layer23/src/mobile/gsm48_rr.c +3021 gsm48_rr_render_ma(89) warn: buffer overflow 'cd->freq_seq_lv' 10 <= 10
src/host/layer23/src/mobile/gsm48_rr.c +3023 gsm48_rr_render_ma(91) error: buffer overflow 'cd->freq_seq_lv' 10 <= 10
2011-07-16 17:37:34 +02:00
Harald Welte 04190eabd3 lapdm: Introduce LAPDM_MODE_{BTS,MS} to run on both sides
We also introduce some related functions like
	lapdm_{entity,channel}_set_mode()
	lapdm_{entity,channel}_reset()

This is all in preparation for the Osmo-BTS Work.
2011-06-24 12:23:17 +02:00
Harald Welte e4ea01041e lapdm: remove get_rsl_name() and use libosmogsm:gsm_rsl_name() instead 2011-06-23 23:57:34 +02:00
Harald Welte 3538c38835 further decouple lapdm code from osmocom_ms and l1ctl
we introduce a new primitive layer betwen PH and DL, enabling the
use of the LAPDm code in applications that are not based on L1CTL
2011-06-23 23:55:20 +02:00
Harald Welte 5d65fcba6c add l1ctl_proto.h #includes to lots of files
this is apparently a result of no longer including it indirectly via lapdm.h
2011-06-22 23:08:55 +02:00
Harald Welte 7ad100b94e layer23: make LAPDm code mostly independent of 'struct osmocom_ms'
This is one step in the direction of re-using the lapdm code in osmo-bts.
2011-06-21 19:51:01 +02:00
Harald Welte ddb20b8b4e remove osmocom_ms reference from lapdm_init()
... yet another step in making lapdm code independent of osmocom_ms
2011-06-21 19:48:20 +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
Harald Welte 308f9e506e layer23: update to new GSMTAP API in libosmocore >= 0.3.1 2011-05-22 12:36:55 +02:00
Pablo Neira Ayuso a1d1680245 src: use namespace prefix osmo_* for utils
Summary of changes:

s/bcd2char/osmo_bcd2char/g
s/char2bcd/osmo_char2bcd/g
s/hexparse/osmo_hexparse/g
s/hexdump/osmo_hexdump/g
s/hexdump_nospc/osmo_hexdump_nospc/g
s/ubit_dump/osmo_ubit_dump/g
s/static_assert/osmo_static_assert/g
2011-05-15 17:33:26 +02:00
Pablo Neira Ayuso 404f634406 src: use namespace prefix osmo_signal*
Summary of changes:

s/signal_cbfn/osmo_signal_cbfn/g
s/register_signal_handler/osmo_signal_register_handler/g
s/unregister_signal_handler/osmo_signal_unregister_handler/g
s/dispatch_signal/osmo_signal_dispatch/g
2011-05-15 14:39:39 +02:00
Pablo Neira Ayuso ffcc29b5fb src: use namespace prefix osmo_fd* and osmo_select*
Summary of changes:

s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
2011-05-15 14:39:33 +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
Nico Golde 9ddeae9d42 [sim] Fixed path handling in sim client and mobile app. 2011-05-02 15:55:36 +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
Dario Lombardo aa2f2fdfa1 [PATCH] Added runtime selection of gps device. 2011-03-09 16:27:20 +00:00
Harald Welte cde3f7d2c6 mobile: Store N.ba files in same directory as config file
This should remove the last dependency to hard-coded system-wide /etc/osmocom
2011-03-02 11:00:59 +01:00
Harald Welte 4be57b9afd mobile: Use config file in ~/.osmocom/bb/mobile.cfg
We don't need root permission and a system-wide config file in /etc/osmocom

Based on a patch by Pierre Pronchery <khorben@defora.org>
2011-03-02 10:35:39 +01:00
Dario Lombardo b7a4d8d912 Added gpsd support. 2011-02-16 15:15:12 +01:00
Dario Lombardo 26ff2ee880 Renamed gps_* functions to osmo_gps_* functions to avoid overlap with libgps functions. 2011-02-16 15:15:07 +01:00
Andreas.Eversberg 411c8f35dd [layer23] Enable half rate support in support.c 2010-12-28 12:22:39 +00:00
Andreas.Eversberg 93c64102e1 [layer23] Timer 3126 must be stopped even if starting time is given 2010-12-28 12:21:18 +00:00
Andreas.Eversberg 7e29ca7006 [layer23] VTY uses CAPITAL letters for all optional parameter names
This makes it easier to understand the VTY help. Every parameter name
is shown in capital letters, every keyword is shown in lower case.
2010-11-20 08:58:44 +00:00
Andreas.Eversberg 8dbf60f581 [layer23] VTY supports "show this" to show current MS node only 2010-11-20 08:34:31 +00:00
Andreas.Eversberg f72baf40d5 [layer23] Adding LAC and TMSI (both optional) to test card (rplmn) 2010-11-20 08:32:32 +00:00
Andreas.Eversberg 633b611dc1 [layer23] Adding LAI to debug output of LOCATION UPDATING REQEST 2010-11-20 08:30:45 +00:00
Andreas.Eversberg ee4fe18cda [layer23] Bugfix: Exit, if init function fails 2010-11-20 08:19:38 +00:00
Andreas.Eversberg 3a8e47430e [layer23/mobile] Better overview of "show ms" VTY command
Combined "sh ms" and "sh states" to a more detailed "sh ms". The
look-and-feel is more router like now.
2010-11-14 15:15:38 +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
Sylvain Munaut da738824a0 layer23/mobile: Enable half_v1 support
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-11-07 10:34:10 +01:00
Andreas.Eversberg 2ac17ed9fa [layer23] Call application sends CC Capability on incoming call
It is required to make DTMF work on incoming calls also.
2010-11-07 10:48:12 +00:00
Steve Markgraf bd0266d0d8 layer23/mobile: Fix 'implicit declaration' warning for mncc_answer()
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2010-11-06 14:45:39 +01:00
Andreas.Eversberg a0246e07ff layer23: Use the new rach_req format in l1ctl and update l23 apps to use it
This removes an old hack

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-30 17:32:09 +02:00
Steve Markgraf 8f007baced layer23/mobile: Add configuration option for automatically answering calls
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2010-10-27 20:30:13 +02:00
Steve Markgraf 4dea28252c layer23: typo/cosmetic fixes in cell_log.c and mnccms.c
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2010-10-27 20:26:05 +02:00
Sylvain Munaut e6036a111f layer23/vty_interface: Fix typos, AMR is v3 not v1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-25 20:58:31 +02:00
Andreas.Eversberg 4d211a27b8 [layer23] Moving sysinfo.c and gps.c (.h) to liblayer23
This makes sense, since multiple applications use it.
2010-10-24 13:30:17 +00:00
Andreas.Eversberg fbbb3ac953 [layer23] Fixed conditions for complete set of SYSTEM INFORMATION 2010-10-24 12:55:31 +00:00
Andreas.Eversberg 5e819e682f [layer23] Old SYSTEM INFORMATION 5 and 6 must be removed when entering DM 2010-10-24 12:34:53 +00:00
Andreas.Eversberg 1ac1852ffc [layer23] Moving decoding of SYSTEM INFORMATION to sysinfo.c
This way the decoding can be re-used by other applications.
2010-10-24 12:30:37 +00:00
Andreas.Eversberg e7f6f749c4 [layer23] Fix of GPS states 2010-10-24 12:20:08 +00:00
Andreas.Eversberg 18c621e9f7 [layer23] Don't request a channel, if SYSINFO 3 is not available
SI3 is required in order to request a channel the correct way. If not
yet received, the process crashes due to an arithmetic exception.
2010-10-20 18:16:12 +00:00
Andreas.Eversberg 8be9f76bc4 [layer23] Fix of channel request cause "OTHER or SDCCH" 2010-10-20 18:12:44 +00:00
Andreas.Eversberg f181a04121 [layer23] Completed GPS reading process
This includes "double" values of logitude and latitude, as well as time
stamp, and if the values are valid or not (GPS fix).
2010-10-20 18:09:31 +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 f92f777357 [layer23] Support of receiving STATUS at call control 2010-10-15 19:15:59 +00:00
Andreas.Eversberg adf65e29fd [layer23] DTMF support 2010-10-15 18:54:57 +00:00
Andreas.Eversberg 19807191b6 [layer23] If the mobile sticks to a cell, RXLEV_MIN is ignored 2010-10-15 18:50:25 +00:00