summaryrefslogtreecommitdiffstats
path: root/src/host
AgeCommit message (Collapse)AuthorFilesLines
2019-01-07layer23/sap_interface.c: fix: properly call sap_msg_free()Vadim Yanitskiy1-6/+8
Passing NULL to sap_msg_free() is not only meaningless, but also would result in NULL pointer dereference. We should call it in successful case only, so let's fix this. Change-Id: Icf868c4299e292a17c4b7aad1f9e728ea3653494
2019-01-02trxcon/scheduler: fix RSSI -> RX level conversionVadim Yanitskiy1-1/+11
Due to a mistake, average RSSI value of received bursts was not converted to GSM RX level (range 0..63), so trxcon has been sending incorrect values to the higher layers. Let's fix this, and also prevent possible division by zero. Change-Id: Id4659de899411ec1ba1718fdcb40aec562dbfd65
2018-12-26layer23/sap_interface.c: use LOGP() instead of fprintf()Vadim Yanitskiy1-3/+3
Change-Id: I054be24666fcd5eb8a70cfcac0e7ed566e909b90
2018-12-26layer23/sap_interface.c: use int for rc in sap_open()Vadim Yanitskiy1-1/+1
Change-Id: I683f87ae09393c45377c39317b08c613055ceb16
2018-12-26layer23/sap_interface.c: remove redundant socket_path argumentVadim Yanitskiy3-5/+6
Change-Id: I408b3e1fa40e9b5daf88fa6ed5f3930b83dffe6f
2018-12-26layer23/sap_interface.c: drop unused osmosap_sapsocket()Vadim Yanitskiy2-10/+0
Change-Id: Ie3040c75bb61094b9b601aef9d699db603d292f4
2018-12-26layer23/sap_interface.c: return rc from osmosap_send_apdu()Vadim Yanitskiy1-7/+10
Change-Id: I3965843c4d49e31b1b5156d9ee8439eef6ecaab1
2018-12-26layer23/include/sap_interface.h: use #pragma onceVadim Yanitskiy1-5/+1
Change-Id: I98e407c2b6604438d2495700cb62753ad55369ea
2018-12-26mobile/subscriber.c: consider GSM_SIM_TYPE_SAP tooVadim Yanitskiy2-5/+7
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 Yanitskiy5-10/+10
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-12-26layer23/common/sim.c: don't ignore rc of sim_apdu_send()Vadim Yanitskiy1-3/+5
Change-Id: I8cab7cc72f026947859cc607f65d925803424cf7
2018-12-23mobile: Use new VTY telnet API to allow binding to random portHolger Hans Peter Freyther1-2/+1
Change-Id: I5a6214aec2dcb92495038ea8311c0df22fa8d07b
2018-12-19layer23/mobile: drop dead SAP initialization codeVadim Yanitskiy1-10/+0
SAP connection can be initialized upon request. Change-Id: Ic89089c4850ab2c9252bfd43a05d5271e2e3a160
2018-12-18host/layer23/sap_interface.c: cosmetic: use ARRAY_SIZE()Vadim Yanitskiy1-1/+1
Change-Id: I3a2908bf11300ec681beddb5a54f9a62ca5430ae
2018-12-18host/layer23: don't init SAP interface by defaultVadim Yanitskiy1-4/+0
Almost all layer23 applications, excluding mobile, have nothing to do with SAP interface. Moreover, the current implementation does initialize SAP connection automatically, as soon as the first message is sent. Change-Id: I62cc69c06fa15468a55bb0a9d408267d0745174c
2018-11-29trxcon/l1ctl.c: handle hopping channels from L1CTL_DM_EST_REQVadim Yanitskiy1-21/+62
Change-Id: I8617b5808748bc4df3d7cc9862ed8cf12613f270
2018-11-29trxcon/trx_if.c: add SETFH CTRL command supportVadim Yanitskiy2-0/+46
The idea of SETFH command is to instruct transceiver to enable frequency hopping mode using the following parameters: CMD SETFH <HSN> <MAIO> <CH1> <CH2> [... <CHN>] Note: since the length of a CTRL command is limited to 128 symbols (BTW: why?), the amount of channels is also limited. Change-Id: Id3d44e6a2796f1ce8523a49dedd5d484052a5c7f
2018-11-22trxcon/l1ctl.c: fix deprecated gsm_band_name() usageVadim Yanitskiy1-3/+13
Change-Id: I99bb935b7cd529c885bf10dc209b6016df8095d8
2018-11-21mobile: use VTY bind addr from config, deprecate cmd line optionsVadim Yanitskiy3-20/+19
This change revives the main idea of: Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa to stop ignoring the VTY bind address from the config file. Furthermore, it deprecates (and disables) both 'u' and 'v' command line options, because they are redundant. Change-Id: I99e0ec1717edd29b3be231be86616cc7effe5d95
2018-11-21mobile: abort in case of argv handling errorsVadim Yanitskiy1-3/+10
The process should be aborted if a non-existing command line option or an incorrect parameter value is passed. Change-Id: Ib656ad12f12429ed15dc2a1554901ffa51148ff6
2018-11-21mobile/app_mobile.c: use LOGP() instead of printf()/fprintf()Vadim Yanitskiy1-9/+8
Change-Id: I6af76afbaa34dde5ddfc31a65700030862442dba
2018-11-21mobile/app_mobile.c: drop redundant printf() callVadim Yanitskiy1-1/+0
The VTY requisites are always being printed by libosmovty, there is no need to duplicate this information. Change-Id: I688f66175ea67d4c6a46819bee7d300ad9ce7cc7
2018-11-21Revert "mobile: fix vty bind ip override"Vadim Yanitskiy1-4/+3
This reverts commit c8de8cb1e126a18c0269571fba38310589dd9273 (Change-Id I32517567847fd5c54b1742f18bf409ff81e316fa by Max), because several problems were introduced, in particular: a) Help message of mobile application is broken: "The VTY IP to telnet to. (default (null))", "The VTY port number to telnet to. (default 127.0.0.1)". b) Default VTY bind addres != parsed from the config file. c) The (vty_ip == NULL) is resolved only when an external MNCC handler is used, otherwise NULL is passed to l23_app_init(). Change-Id: Ic63a4eb828ff32d3744886b4f5f6f5019c798620
2018-11-19mobile: fix vty bind ip overrideMax1-3/+4
Previously the vty bind config parameter was always ignored. Fix this by using proper default value from the config unless it's explicitly set via command-line parameter. Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa
2018-11-19Fix build with latest libosmocoreMax1-10/+0
Remove locally defined function which conflicts with the one in libosmocore. Change-Id: I1be1d39f7c93c959ca33f6296ecda71996865cca
2018-11-19l1l2 interface: use LOGP for socket errorsMax2-2/+4
Log via LOGP() like the rest of the file instead of fprintf() for consistency. While at it, also print error cause. Change-Id: Id205bcd9bdb7c3e4b96493d50be8381a6fa80ac6
2018-11-19osmocon: log error cause for socket openingMax1-1/+2
Change-Id: I2f871cb16e5e1033e42863a9e12459057004782c
2018-11-19mobile: log socket path on errorMax1-1/+1
Change-Id: I18eb46743e4c0e4e8f8032883f39fec355f03c78
2018-11-16mobile: use proper type for boolean flagsMax2-11/+11
This makes reading code easier and simplifies further modifications. Change-Id: I7eff2a61495ff167dc19fc9a41882a7a11fbf32d
2018-11-16mobile: add header for MS' MNCC functionsMax4-10/+12
This simplifies adding new functions and re-using them from other parts of the code. Change-Id: Ibad400a99afe052f011f54fc706836b6bf89f4b9
2018-11-08layer23: Avoid mempcy with NULL srcPau Espin Pedrol1-1/+2
Fixes following ASan warning: git/osmocom-bb/src/host/layer23/src/misc/../common/main.c:146:2: runtime error: null pointer passed as argument 2, which is declared to never be null The warning however is harmless since in that case, app_len = 0 and thus size to copy is 0. Change-Id: I009a5b53f1e5be72ce347d64d3a7cb1d95d37ea3
2018-11-05layer23: Fix build against gpsd >= 3.18Pau Espin Pedrol1-2/+13
Change-Id: I0e97d3e8c3688064c959ea60ecef50cfbbc1bcd6
2018-11-05cosmetic: fix trailing whitespacePau Espin Pedrol1-4/+3
Change-Id: I5c1a6d98079ad846d114584a17ba9d80d95e0595
2018-11-05l1ctl_proto.h: use flexible array member for traffic messagesVadim Yanitskiy2-14/+27
Unlike the DATA messages, traffic frames may have different length. Instead of having fixed payload (i.e. TCH frame) length, let's introduce a flexible array member. This would allow one to calculate the frame length using the MSGB API. Change-Id: I119fa36c84e95c3003d57c19e25f8146ed45c3c6
2018-10-27layer23/l1ctl.c: fix: use host byte order for TDMA fnVadim Yanitskiy1-1/+1
Change-Id: Iad00eebf03b38b9c4fc2d7ed66697d23a953d8b2
2018-10-27layer23/common: move SIM APDU caching from l1ctl.cVadim Yanitskiy3-16/+29
L1CTL implementation (i.e. l1ctl.c) is not a good place for the SIM specific stuff. Let's move it to the proper place (i.e. sim.c). As a bonus, this change fixes a possible problem of loosing the cached APDUs if two or more L2&3 applications are using a single LAPDm connection. The APDU buffer is dedicated per MS now. Change-Id: I564c610e45aa3b630ca5d1ec6bc1cace0dc9c566
2018-10-26trxcon: make TRX bind address configurableVadim Yanitskiy1-6/+17
Previously the wildcard address (i.e. '0.0.0.0') was hard-coded as the bind address of TRX interface. Let's make it configurable by introducing a command line option. Note that the '--trx-ip' option was deprecated by '--trx-remote', because it isn't clean whether it is remore or local address. It still can be used, but was removed from help message. Change-Id: Ic2f43632cc57bb6f722eba05219e438f97fecb95
2018-10-26Report socket path on errorsMax3-3/+3
Change-Id: Ib63e1205d7b845c8779eb511635f26bae3a18085
2018-10-20trxcon/scheduler: add PDTCH channel supportVadim Yanitskiy4-4/+214
Change-Id: I1176576f54c1d68e79cc6ac37d61a9033f7018dd
2018-10-03layer23/l1ctl.c: clean up & fix message length checkingVadim Yanitskiy1-21/+44
Almost all handlers for received L1CTL messages are also affected by the bug fixed in I7fe2e00bb45ba07c9bb7438445eededfa09c96f3. In short, they do verify the length of 'msg->l2h' or 'msg->l3h', but not the 'msg->l1h'. Let's fix this, and also add missing checks. Change-Id: I866bb5d97a1cc1b6cb887877bb444b9e3dca977a
2018-10-03layer23/l1ctl.c: avoid confusion between L1CTL / L1 headersVadim Yanitskiy1-7/+7
As we assign the payload following L1CTL header to 'msg->l1h', it makes sense to avoid possible naming confusion. Change-Id: I5d21ca8664b3445f472d3ffde90d0e11805dcb16
2018-10-03layer23/l1ctl.c: fix: verify msg length using l1h, not l2hVadim Yanitskiy1-3/+4
The actual L1CTL header is pointed by 'msg->l1h', not 'l2h'! Since msg->l2h is NULL (because nobody set it), the result of msgb_l2len() would always be bigger than size of L1CTL header, as it is calculated in the following way: return msgb->tail - (uint8_t *)msgb_l2(msgb); So, in case if 'msg->l2h' is NULL, it turns into: return msgb->tail - 0; Change-Id: I7fe2e00bb45ba07c9bb7438445eededfa09c96f3
2018-10-03layer23/l1ctl.c: fix: verify msg length against l1ctl_hdrVadim Yanitskiy1-2/+1
In l1ctl_recv() we actually expect to 'see' the L1CTL header instead of the DL info header. Let's fix this. Change-Id: Ic7d017bef04f3c186565d5dade36959df1019bd8
2018-10-03layer23/l1ctl.c: keep L1 header, drop L1CTL headerVadim Yanitskiy1-16/+5
There is no need to keep the L1CTL header in messages being sent towards the upper layers, but the L1 info header can be used by L2&3 to obtain some information, e.g. TDMA frame number. Change-Id: Id64249f1b7a1c2be578263ba62aa195c452ab7e8
2018-10-03trxcon/scheduler: add dedicated CBCH mode supportVadim Yanitskiy1-0/+4
This change extends sched_trx_chan_nr2pchan_config() with Osmocom specific cbits related to CBCH, so now one can to decode CBCH channels in dedicated mode (see L1CTL_DM_EST_REQ). Change-Id: I9347c45638223cac34f4b48eb736e51a5055a36f
2018-10-03l1ctl_proto.h: extend ccch_mode enum with CBCHVadim Yanitskiy1-1/+2
According to GSM TS 05.02, there are two ways to enable CBCH: a) replace sub-slot number 2 of CCCH+SDCCH/4 (comb. V), b) replace sub-slot number 2 of SDCCH/8 (comb. VII). Unlike SDCCH/8 (case b), CCCH+SDCCH/4 can be allocated on TS0 only, and shall not use frequency hopping. This means that implementing CBCH support on SDCCH/8 would require much more efforts than on combined CCCH+SDCCH/4, as in last case CBCH messages can be received without the need to switch from idle to dedicated mode. This change introduces a new ccch_mode item, which should be used by the higher layers to indicate presence of CBCH channel on C0/TS0, so the PHY would enable decoding of CBCH messages on CCCH+SDCCH/4 (case a) in idle mode. Regarding to CBCH on SDCCH/8 (case b), it makes sense to extend the 'l1ctl_dm_est_req', so it would be handled in dedicated mode on request from the higher layers. Change-Id: Ia94ebf22a2ec439dfe1f31d703b832ae57b48ef2
2018-10-03trxcon/scheduler: add CCCH/SDCCH mframe layouts with CBCHHarald Welte3-0/+238
According to GSM TS 05.02, section 3.3.5, Cell Broadcast Channel (CBCH) is a downlink only channel, which is used to carry the short message service cell broadcast (SMSCB). CBCH is optional, and uses the same physical channel as SDCCH. More precisely, CBCH replaces sub-slot number 2 of SDCCH channels when enabled. This change introduces the CBCH enabled multi-frame layouts, and two separate logical channel types: - GSM_PCHAN_CCCH_SDCCH4_CBCH (lchan TRXC_SDCCH4_CBCH), - GSM_PCHAN_SDCCH8_SACCH8C_CBCH (lchan TRXC_SDCCH8_CBCH). Both logical channels are separately identified using the following Osmocom specific cbits: - TRXC_SDCCH4_CBCH - 0x18 (0b11000), - TRXC_SDCCH8_CBCH - 0x19 (0b11001). The reason of this separation is that we somehow need to distinguish between CBCH on C0/TS0, and CBCH on CX/TS0. Unlike TRXC_SDCCH8_CBCH, TRXC_SDCCH4_CBCH is enabled automatically (TRX_CH_FLAG_AUTO), so CBCH messages can be decoded on C0 while being in idle mode. Change-Id: Iad9905fc3a8a012ff1ada26ff95af384816f9873
2018-10-03trxcon/l1ctl.c: properly handle indicated CCCH modeVadim Yanitskiy1-12/+29
The 'ccch_mode' enum from 'l1ctl_proto.h' to be extended in the near future in order to reflect persistence of CBCH. Thus it should be handled in a switch statement. Change-Id: I75e3b8deac1da296efb178e65ff6992b5c407b80
2018-10-03trxcon/sched_lchan_desc.c: fix wrong chan_nr for PDCHVadim Yanitskiy1-2/+2
According to GSM TS 08.58, chapter 9.3.1, channel number 0x08 describes sub-slot number 0 of SDCCH/8+ACCH. This is definitely wrong. In OsmoBTS we use an Osmocom specific extension for packet switched channels - 0xc0, so let's use it here too. Change-Id: I11925408d6e63baf1eac880839ecd717843fba6a
2018-10-02layer23/app_ccch_scan.c: omit dummy (fill) framesVadim Yanitskiy1-0/+32
In some conditions it's required to maintain continuous burst transmission (e.g. on C0). If there is nothing to transmit at a given moment, either a LAPDm func=UI fill frame, or a "dummy" Paging Request is used. In case of 'ccch_scan' application, they are useless. Let's detect and omit them. Change-Id: I6ccecb1a78bdac3e467bdc14b7a01afbe17aa53c