summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/settings.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-26host/layer23: rename GSM_SIM_TYPE_READER to GSM_SIM_TYPE_L1PHYVadim Yanitskiy1-1/+1
Since we have two ways to interact with a physical SIM: - using built-in SIM reader of the L1 PHY (via L1CTL), - using remote reader via (BT)SAP protocol, name 'GSM_SIM_TYPE_READER' looks quite confusing. Let's rename it in order to explicitly indicate the role of L1 PHY. Change-Id: I0f83f365ed50cfd658fdd3a9d6866ed76c8c4009
2018-08-11layer23: Fix possible buffer overflow writing NUL beyond end of stringHarald Welte1-1/+1
settings.c: In function ‘gsm_random_imei’: settings.c:188:26: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=] sprintf(rand + 8, "%07ld", random() % 10000000); ^ settings.c:188:2: note: ‘sprintf’ output between 8 and 9 bytes into a destination of size 8 sprintf(rand + 8, "%07ld", random() % 10000000); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Id949487111235cd4af5ff068f1dce2f4b0801480
2018-08-11layer23: Use osmo_strlcpy() to avoid non-terminated stringsHarald Welte1-1/+1
settings.c:191:2: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 15 -Wstringop-truncation] strncpy(set->imeisv, set->imei, 15); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CC subscriber.o CC support.o CC transaction.o CC vty_interface.o CC voice.o CC mncc_sock.o CC primitives.o mncc_sock.c: In function ‘osmo_unixsock_listen’: mncc_sock.c:318:2: warning: ‘strncpy’ specified bound 108 equals destination size [-Wstringop-truncation] strncpy(local.sun_path, path, sizeof(local.sun_path)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CC script_lua.o vty_interface.c: In function ‘cfg_gps_device’: vty_interface.c:1144:2: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] strncpy(g.device, argv[0], sizeof(g.device)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AR libmobile.a Change-Id: Id52978f3bf7a8abea62237d7c32f8f87e1bb34a1
2018-07-23Move from libc random() to osmo_get_rand_id (2nd attempt)Holger Hans Peter Freyther1-2/+3
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-17Revert "Move from libc random() to osmo_get_rand_id"Vadim Yanitskiy1-8/+2
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 6d49b049ee304f1ea0e4801df61e69713b01f0f8. Change-Id: I7b2a8a5c63cf64360a824926a2219fd7e419b1bb
2018-07-11Move from libc random() to osmo_get_rand_idHolger Hans Peter Freyther1-2/+8
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-06-04mobile/sms: Make it optional to store the SMS on diskHolger Hans Peter Freyther1-0/+2
Disable storing the SMS on disk. This is useful when scripting mobile. Keep the default of attempting to store it to disk. Change-Id: I6353447343d98ebaa5e12ab63f995750f81c8500
2018-06-01mobile: Make time spent in c7 configurableHolger Hans Peter Freyther1-0/+2
When no cell was found during the PLMN search the camp on any cell state will be entered. LUs are prevented in this state and it will be left after the start_any_timer has timedout. Even if camping on the home network the state will not be left before the expiry of the timer. For systematic tests this is producing a too high upper bound. Make it configurable so we can succeed with a UL more quickly. Change-Id: I25bc985cd4360d5e37d05a7b16b39eefb75ce20f
2017-12-03mobile: Add initial support for scripting supportHolger Hans Peter Freyther1-0/+3
Right now the script will be executed once it is loaded. Make sure to write it into the config file last. Expose various log commands for logging. Jump through some hoops and get the filename and line number from lua. Change-Id: I456f6b6b5e1a14ed6c8cb0dcc5140093d3c61ef6
2012-11-22Rename various "rxlev" variable to "rxlev_dbm" and correct their signessAndreas Eversberg1-1/+1
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-01-02layer23/mobile: Enable SIM reader by defaultAndreas Eversberg1-2/+1
If there is no SIM card in the reader, the SIM process would automatically proceed without SIM anyway.
2011-11-13host/mobile: Whitespace fixes, no functional changesSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-17[layer23/mobile] Improvement and fixes of idle mode processAndreas Eversberg1-0/+3
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-05-29[layer23] Adding Quadband support and GSM 4x0 supportAndreas.Eversberg1-0/+41
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-04-26src: use new libosmogsm and include/osmocom/[gsm|core] path to headersPablo Neira Ayuso1-1/+1
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>
2010-11-20[layer23] Adding LAC and TMSI (both optional) to test card (rplmn)Andreas.Eversberg1-0/+2
2010-11-13[layer23] Added support for multiple MS instancesAndreas.Eversberg1-1/+11
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-10-15[layer23] DTMF supportAndreas.Eversberg1-0/+3
2010-10-14[layer23] Adding abbreviated dialing to VTYAndreas.Eversberg1-0/+17
It is possible to store phone numbers with abbreviations now. Dialing these abbreviation makes testing of mobile originated calls much easier too.
2010-10-12[layer23] Implementation of signal loss criteria as defined in TS 05.08Andreas.Eversberg1-0/+1
There are two criterions for lossing a signal, idle mode and dedicated mode. A counter counts down when a frame is dropped, and counts up when a valid frame is received on certain channel. The loss criterion is reached, if the counter reaches 0. The values added to / removed from the counter and the limits depend on the process.
2010-10-03[layer23] Rework of "support"-features, features can be disabled nowAndreas.Eversberg1-4/+23
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-01[layer23] Minimum RX-level is now a configuratio optionAndreas.Eversberg1-0/+2
The default (if config not yet created/updated), is still taken from settings.c.
2010-09-26[layer23] Speech codec selection and negotiation with networkAndreas.Eversberg1-0/+4
2010-07-27layer23: Split [2/2] -> The header filesSylvain Munaut1-3/+3
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-27layer23: Split [1/2] -> The source codeSylvain Munaut1-0/+87
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>