summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/subscriber.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-23layer23: fix tons of compiler warnings, mostly OSMO_DEPRECATED relatedHarald Welte1-3/+3
Change-Id: I03918bd864c711b377a795186123c85bb6f4dc4a
2019-01-15layer23/sap_interface.c: reimplement (BT)SAP interfaceVadim Yanitskiy1-0/+49
The (BT)SAP (Bluetooth SIM Access Profile) is a part of Bluetooth specifications, that defines the protocol and procedures that shall be used to access a smart card (usually GSM SIM) via a Bluetooth link. The profile defines two roles: - Server - the side that has direct access to a smart card. It acts as a SIM card reader, which assists the Client in accessing and controlling the smart card. - Client - the side that accesses and controls the smart card inside the Server through the connection with Server. Typical examples of a Server are a simple SIM card holder or a portable phone in the car environment. A typical example of a Client is a car phone, which uses a subscription module in the Server for a connection to the cellular network. OsmocomBB implements the Client role providing abstract SAP interface API to the higher layers. Instead of Bluetooth, a UNIX socket is used to communicate with a Server. The previous implementation of (BT)SAP interface was incomplete and hard to maintain. This change (re)implements it almost from scratch on top of the Osmocom FSM framework. Besides that, the most significant changes are: - The implementation is separated into three parts: - sap_interface.{c|h} - public SAP interface API, - sap_proto.{c|h} - SAP protocol definition, - sap_fsm.{c|h} - SAP FSM implementation. - Both 'sap_message' and 'sap_param' structures follow the SAP message format definition according to 5.1 and 5.2. - The message parsing is done more carefully in order to prevent buffer overflow and NULL-pointer dereference. - Introduced public API for getting / adding message parameters, and checking the ResultCode. - Introduced public API for opening / closing a connection with the server, powering on / off and resetting the SIM card, sending ATR and APDU. - Introduced a call-back for handling the response message. - Card reader state is also a part of the public API. The new implementation was tested against softsim [1]. The only limitation is Server-initiated Release, that allows the Server to 'ask' a Client to release connection as soon as communication with the smart card is finished. This is not implemented (yet), and leads to immediate release. [1] https://git.osmocom.org/softsim/ Change-Id: I77bb108615bb2c94c441568f195b04e0a5421643
2018-12-26layer23/sap_interface.c: remove redundant socket_path argumentVadim Yanitskiy1-1/+1
Change-Id: I408b3e1fa40e9b5daf88fa6ed5f3930b83dffe6f
2018-12-26mobile/subscriber.c: consider GSM_SIM_TYPE_SAP tooVadim Yanitskiy1-5/+4
There are several SIM card interfaces, two of which: - GSM_SIM_TYPE_L1PHY (using built-in SIM reader of the L1 PHY), - GSM_SIM_TYPE_SAP (using remote reader via (BT)SAP protocol), can actually deal with a physical SIM card. But, for some reason, only GSM_SIM_TYPE_L1PHY was considered as such. Let's also get along with GSM_SIM_TYPE_SAP for the following procedures: - PIN management and verification, - FPLMN / LOCI updating, - A3 authentication. Change-Id: I4b3080fa7a5332467a449a314ba3cc3a07a9b7df
2018-12-26host/layer23: rename GSM_SIM_TYPE_READER to GSM_SIM_TYPE_L1PHYVadim Yanitskiy1-5/+5
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: Replace all instances of strncpy() by osmo_strlcpyHarald Welte1-1/+1
This gives us working/safe zero termination without overflowing the destination string size. Change-Id: Ica6098ceba2bd01ce3b216085442cc5eed0ca507
2018-06-01mobile: Make time spent in c7 configurableHolger Hans Peter Freyther1-1/+1
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-11-08host/mobile: use osmocom_ms as talloc contextVadim Yanitskiy1-5/+3
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
2016-01-18host/mobile: Improved SAP interface integrationЯницкий Ва дим1-0/+53
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>
2014-06-15mobile: Use osmocom auth API instead of direct callsMax1-18/+15
Submitted-by: Max <max.suraev@fairwaves.co> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-08misc: Fix typosDario Lombardo1-1/+1
2013-01-07mobile: Allow test card to be maked as already attachedAndreas Eversberg1-2/+8
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.
2012-10-30Fixed decoding of hexadecimal LAI componentsAndreas Eversberg1-6/+9
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-02-14mobile: Add vty option to force rekeying for every new channelTim Ehlers1-0/+8
Written-by: Tim Ehlers <osmocom@ehlers.info> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13host/mobile: Mobile will use SMS Service Center Address from SIMAndreas Eversberg1-14/+51
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-07-17[layer23/mobile] Improvement and fixes of idle mode processAndreas Eversberg1-9/+30
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[layer23] Detach SIM, if reading failsAndreas Eversberg1-0/+8
This way the mobility management and cell selection process continues as if no SIM has been inserted.
2011-05-02[sim] Fixed path handling in sim client and mobile app.Nico Golde1-1/+1
2011-04-26src: use new libosmogsm and include/osmocom/[gsm|core] path to headersPablo Neira Ayuso1-2/+2
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-4/+10
2010-09-26[layer23] VTY command for changing LAI on SIM cardAndreas.Eversberg1-0/+4
This speed up network selection process, because no manual network search is required to change a network.
2010-09-19[layer23] Fixed and improved subscriber (SIM) dump of VTYAndreas.Eversberg1-11/+19
For a detailed SIM infos: enable show subscriber
2010-09-19[layer23] Fixed and completed SIM's PIN handlingAndreas.Eversberg1-14/+58
Use VTY to handle PIN: enable sim pin 1 xxxx sim change-pin 1 xxxx yyyy sim disable-pin 1 xxxx sim enable-pin 1 xxxx sim unlock-pin 1 uuuuuuuu yyyy 1 = mobile station "1" xxxx = current PIN yyyy = new PIN uuuuuuuu = unlock key (PuK)
2010-09-18[layer23] SIM client completionAndreas.Eversberg1-10/+22
The SIM client is now complete. Because it usefull for multiple applications, i moved it to the layer23/src/common directory. The SIM reader works together with mobile process. Fixes were made. Thanx to all for testing, finding bugs, and making it work as it is supposed to do. The current version uses special L1CTL messages to send and receive APDUs. This will change in the future, when BTSAP interface is completed. Please note that this client will not work until the layer1 SIM reader fixes and extensions are committed.
2010-09-17layer23/mobile: Fix space/tab indenting in subscriber.cSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-17[layer23] Added XOR and COMP128 encryption to test SIMAndreas.Eversberg1-7/+39
To define/change a key for the test SIM, use the following sequence: conf t ms 1 test-sim ki comp128 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx end write or use: ki xor xx xx xx xx xx xx xx xx xx xx xx xx
2010-08-29[layer23] Fixed security issueAndreas.Eversberg1-3/+4
Authentication must not be performed using SIM client, if different IMSI is used, to protect identity of caller.
2010-08-29[layer23] Fix of corrupt MM event messagesAndreas.Eversberg1-2/+4
2010-08-28[layer23] Layer 3 now uses SIM client to request and update SIM dataAndreas.Eversberg1-42/+788
The SIM reader can be selected via VTY, but because it is not yet implemented in layer1, nothing happens when selecting it.
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/+323
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>