summaryrefslogtreecommitdiffstats
path: root/src/host
AgeCommit message (Collapse)AuthorFilesLines
2019-10-17Fix common misspellings and typosMartin Hauke30-108/+108
Change-Id: I962b42871693f33b1054d43d195817e9cd84bb64
2019-10-05host/trxcon: add optional GSMTAP frame logging supportVadim Yanitskiy7-9/+150
This feature may be useful for our TTCN-3 testing infrastructure. By default it's disabled, and can be enabled using command line arguments of the main binary: ./trxcon -g 127.0.0.1 ... Change-Id: Iab4128fee5f18d816830fdca6c5ebebaf7451902
2019-09-30trxcon/scheduler: fix handling of PTCCH logical channelVadim Yanitskiy2-3/+12
According to 3GPP TS 45.010, section 5.6.2, for packet-switched channels the BTS shall monitor the delay of the Access Bursts sent by the MS on PTCCH and respond with timing advance values for all MS performing the procedure on that PDCH. According to 3GPP TS 45.002, section 3.3.4.2, PTCCH (Packet Timing advance control channel) is a packet dedicated channel, that is used for continuous Timing Advance control (mentioned above). There are two sub-types of that logical channel: - PTCCH/U (Uplink): used to transmit random Access Bursts to allow estimation of the Timing Advance for one MS in packet transfer mode. - PTCCH/D (Downlink): used by the network to transmit Timing Advance updates for several MS. As per 3GPP TS 45.003, section 5.2, the coding scheme used for PTCCH/U is the same as for PRACH as specified in subclause 5.3, while the coding scheme used for PTCCH/D is the same as for CS-1 as specified in subclause 5.1.1. The way we used to handle both PTCCH/U and PTCCH/D is absolutely wrong - it has nothing to do with xCCH coding. Instead, we need to use rx_pdtch_fn() for Downlink and tx_rach_fn() for Uplink. Also, since we only have a shared RSL channel number for PDCH (Osmocom-specific RSL_CHAN_OSMO_PDCH), there should be a way to distinguish both PDTCH and PTCCH logical channels. Let's introduce TRX_CH_LID_PTCCH for that. Change-Id: I2d1e9b8a66f027047f8d7bdc3f82ff9d8ebcc25e
2019-09-30trxcon/scheduler: fix comment in description of PDTCHVadim Yanitskiy1-1/+1
Change-Id: Ifd4197b64e89ae6da93ef32189f437a6e297b03f
2019-08-09fb_tools/bdf_to_c.py: make it compatible with python3Alexander Couzens1-33/+33
This would break python2 compatibility. Change-Id: Iaa20dd0aafa20e36186cf8dfe4d0ac9ab638f235
2019-08-05Remove undefined param passed to logging_vty_add_cmdsPau Espin Pedrol1-1/+1
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However, definition in C file doesn't contain "(void)", which means number of parameters is undefined and thus compiler doesn't complain. Let's remove parameters from all callers before enforcing "(void)" on it. Change-Id: I25baaa30b097dad2fae507c5321778f43e863611 Related: OS#4138
2019-07-21gsm411_sms.c: Handle negative return of gsm340_gen_oa()Harald Welte1-0/+3
Change-Id: I36f56e1fbd72d9b31350dc2f8a53e763f79f4c08 Closes: CID#198533
2019-07-21virt_phy: Fix hexdump of L1CTL SIM REQ in l1ctl_rx_sim_req()Harald Welte1-1/+1
Change-Id: I74e07e2c97bfe5d6e9c6e848ebce58ced1b197aa Closes: CID#198538
2019-07-21mobile/gsm480_ss.c: gsm480_tx_release_compl(): fix cause IE encodingVadim Yanitskiy1-2/+7
According to GSM TS 04.08, section 10.5.4.11, location and coding standard are encoded before the cause value, not vice-versa! Also, coding standards other than "1 1 - Standard defined for the GSM PLMNs" shall not be used if the cause can be represented with the GSM standardized coding. Change-Id: Ic6abcfb9a9589f5b0c9c40def863f15ae04d0bdd
2019-07-21virtphy: Handle strtok() returning NULL on first callHarald Welte1-0/+2
Change-Id: I37bfb91cf75982bfa2f75bd62d0c13859268cd93 Closes: CID#198565
2019-07-21osmocon: Check write() return codeHarald Welte1-0/+2
Change-Id: I61d8f104a4d2558fd5b6fb34c7f2fd6c13354c12 Closes: CID#198567
2019-07-21osmocon: Add missing check for fstat() return valueHarald Welte1-0/+5
Change-Id: Ibef6ee00eb41e16d2ef52931f8c22562090cd1ee Closes: CID#198570
2019-07-21mobile: Fix encoding of cause in gsm480_tx_release_compl()Harald Welte1-4/+4
Change-Id: Iba2ace7d82be5677d28b25f60ab0312fed76f5e5 Closes: CID#198577, CID#198576, CID#198575
2019-07-21osmocon: Fix file descriptor + mem leak in error pathHarald Welte1-0/+3
Change-Id: I42ceed662889084783dc89f4ca39c3852428d108 Closes: CID#198539
2019-07-21gsm322: Fix resource leak in gsm322_init() while reading BAHarald Welte1-1/+3
Change-Id: Id42102ab8581e247f495fb7e05dc62a6743d28c5 Closes: CID#198546
2019-07-21osmocon: Fix fd leak in error path of read_file()Harald Welte1-0/+1
Change-Id: Iaae407658df184277f6e6e07d6a48d8b5c75587b Closes: CID#198552
2019-07-21osmocon: Fix out-of-bounds for partial reads in un_tool_read()Harald Welte1-2/+2
"uint8_t buf[4096]; ... &buf + 1" renders an offset of 4096, and not 1! Change-Id: Ie1407371fe949c3d5746b9fdc32ececc9443692b Closes: CID#198580
2019-07-21virtphy: Fix array out of bounds access in getL1ctlPrimName()Harald Welte1-1/+1
Closes: CID#198573 Change-Id: I6504a7ffcf961d3162e6ab2ec8f5f2016ef12cde
2019-06-30trxcon/scheduer: fix: properly check rc of gsm0503_pdtch_encode()Vadim Yanitskiy1-1/+1
The gsm0503_pdtch_encode() returns negative number on error, and the amount of encoded bits in case of success. Change-Id: I7d75141142922909330c5e86be8734bb06cd57a4
2019-06-30trxcon/scheduler: enrich GSM 05.03 encoding error messagesVadim Yanitskiy5-6/+16
Change-Id: I35a7c5df4fc0ed2195ba721f92812874011459d9
2019-06-24trxcon/scheduler: fix bit shift in BSIC / TDMA FN calculationEric Wild1-1/+1
Ubsan is unhappy about shifts into the sign bit of our implicitly promoted value. Change-Id: I4e72db1143a68064ba83668414dc3d60c0e1ad78
2019-06-02trxcon/l1ctl.c: properly handle handover RACH requestVadim Yanitskiy3-15/+20
During the handover the MS needs to release the existing dedicated channel(s), establish the new one(s) as indicated by the network, and then, depending on the synchronisation state, send one or more HANDOVER ACCESS messages carried by Access Bursts. In order to implement this, trxcon needs to be able to transmit Access Bursts on any TDMA timeslot regardless of the logical channel type and the associated handler, i.e. != TRXC_RACH. The controlling side on L1CTL (layer23 or TTCN-3) needs to send one or more L1CTL_RACH_REQ message(s) with properly populated UL info header. Otherwise a regular RACH on TS0 is assumed. Change-Id: Ia967820a536c99966ba2c60b63d2ea9edb093f46
2019-06-02trxcon/scheduler: fix: do not ignore SACCH prims with odd lengthVadim Yanitskiy1-4/+4
Before this patch, prim_dequeue_sacch() used to ignore SACCH primitives with odd length (e.g. 21, when sender forgot to push 2 octets of L1 SACCH header), so neither they were transmitted, nor rejected. As a result, they would stay in the Tx queue until a dedicated connection is released. The only way to notice such problem was looking at the constantly growing talloc's report. Instead of ignoring the primitives with odd length and keeping them in the queue, let's pass them to a logical channel handler, so they would be dequeued and rejected with a proper logging event. Also, to simplify further debugging, let's print the final decision of SACCH prioritization: whether it's a Measurement Report or not. Change-Id: I3149fa518439470b397953306209eb859c83450a
2019-05-31trxcon/sched_mframe.c: mark all stolen CBCH UL slots as TRXC_IDLEVadim Yanitskiy1-4/+4
According to 3GPP TS 05.02, section 6.4.1, CBCH replaces SDCCH number 2 in both V (BCCH+CCCH+SDCCH/4+SACCH/4) and VII (SDCCH/8+SACCH/8) logical channel combinations. Unfortunately it is not clear whether we can use stolen UL slots for RACH or not. For now, we should mark all of them as IDLE. Somehow TRXC_SDCCH4_2 slots were left in the definition of combination V (combined CCCH+BCCH). This is not critical, but may be looking confusing. Let's fix this. Change-Id: Id30f2fac3274de3edff4ae59f77d9c9cf8059155
2019-05-31trxcon/trx_if.c: Dropping UL bursts is a noticeable eventHarald Welte1-2/+3
Therefore we should use LOGL_ERROR instead of LOGL_DEBUG. Change-Id: If5084feb9e847d212530b1a5985390405d91008b
2019-05-31trxcon: Suppress POWERON to TRX if we're already powered on.Harald Welte3-3/+18
The existing logic unconditionally wants to send a POWERON command on TRXC whenever L1CTL_FBSB_REQ is received. That may cause some problems when sending subsequent L1CTL_FBSB_REQ, e.g. due to signal loss. Sending POWEROFF when transceiver is not powered on is normal though. This can happen if trxcon is restarted while fake_trx was running. The existing FSM state could unfortunately not been used, as it's a mixture between the TRX connection state and the command/response state. The current solution is just a work around. We definitely need to introduce separate state machines for transceiver and its TRXC interface. Change-Id: I834e8897b95a2490811319697fc7cab6076db480
2019-05-30trxcon/scheduler: move PRIM_IS[_EXT]_RACH macros to sched_trx.hVadim Yanitskiy2-9/+13
Both PRIM_IS_RACH() and PRIM_IS_EXT_RACH() macros to be used for handover RACH detection in the follow up changes, thus we need have them widely available. Let's also give them better names: PRIM_IS_EXT_RACH -> PRIM_IS_RACH11 PRIM_IS_RACH -> PRIM_IS_RACH8 and introduce a new generic one for checking whether a given primitive is RACH in general (either 8-bit or 11-bit) or not. Change-Id: Ibc39c57fda000647be1829786f6423dcf3f435cd
2019-05-29trxcon/l1ctl.c: on L1CTL_DM_EST_REQ, determine pchan_config firstVadim Yanitskiy1-8/+8
It makes sense to do this first, before tuning to a different ARFCN and changing the training sequence. Otherwise, if no multi-frame configuration is found, trxcon would switch to a different channel and then remain inactive there. Change-Id: I274588ce3a9c49372b5da0629930afece46f799c
2019-05-28trxcon/l1ctl.c: use #define for RSL_CHAN_RACHVadim Yanitskiy1-1/+2
Change-Id: Ifdb1703217c7540344cf6772efe812c8a786a0c2
2019-05-28trxcon/sched_mframe.c: do not hard-code lchan combinationsVadim Yanitskiy1-19/+82
Having magic pre-calculated hex-masks gives one quite high chances to shoot oneself in the foot, and decreases readability in general. Let's do this pre-calculation during the compilation process, so it's much easier to read, extend and spot potential bugs. Change-Id: If945b3654e35c83fc0220fdd6d99c1c7a0503386
2019-05-28trxcon/sched_lchan_desc.c: fix missing TRX_CH_FLAG_AUTO flagVadim Yanitskiy1-0/+1
In I2fc61e1cdca4690a34e2861b9ee3b7c64ea64843 I introduced a regression. TRXC_SDCCH4_CBCH should have TRX_CH_FLAG_AUTO, because it's a part of GSM_PCHAN_CCCH_SDCCH4_CBCH multi-frame layout. If the controlling side on the other end of the L1CTL link requests this particular multi-frame layout, CBCH channel is expected to be active. Change-Id: I3ed942106a03220417b5cb9176107af057120fbe
2019-05-28virt_phy: Fix typo in log messageHarald Welte1-1/+1
Change-Id: I9291957ef5d7033d46060d07f2aa0a3880612e1a
2019-05-28layer23: fix tons of compiler warnings, mostly OSMO_DEPRECATED relatedHarald Welte7-26/+36
Change-Id: I03918bd864c711b377a795186123c85bb6f4dc4a
2019-05-28trxcon/scheduler: refactor description of TRXC_* lchansVadim Yanitskiy2-249/+476
Let's avoid fancy alignment in the description of logical channels for the benefits of having better readability, the ability to add more comments and fields without making it look ugly. Also, let's get rid of field 'chan' of 'trx_lchan_desc' structure since it's not used anywhere, and not actually needed because the position of each lchan description is defined by its TRXC_* type. As a bonus, let's add a human readable description to each lchan definition, so it can be printed in the VTY some day. Change-Id: I2fc61e1cdca4690a34e2861b9ee3b7c64ea64843
2019-05-28trxcon/sched_trx.c: add missing branch for GSM_PCHAN_PDCHVadim Yanitskiy1-0/+2
PDCH channel support was introduced quite a while ago, but there was no way to activate it via L1CTL so far. Let's fix this. Change-Id: I3b66cab26108ab999a7fe969365ab57dc661399c
2019-05-27trxcon: Use RSL channel mode #defines from libosmogsmHarald Welte2-15/+17
Wherever possible, use #defines from libosmogsm as opposed to magic numbers. Using magic numbers in several places has the danger of different programs/repositories having different views on what those values mean. Change-Id: I7ab4958801b3422973b67ff0452b90afa8a3f501 Related: OS#4027 Depends: libosmocore Change-Id I93e557358cf1c1b622f77f906959df7ca6d5cb12
2019-05-27trxcon: Fix CBCH related RSL channel numbersHarald Welte2-4/+4
OsmoBTS, BSC and TTCN3 used cbits == 0x18 for dynamic PDCH, while trxcon wanted to use 0x18 for CBCH on SDCCH/4. Let's fix this and bring everyone in agreement. Related: OS#4027 Change-Id: Ia9a415628c659cbc2dd5dc65b875b7f935d6e211
2019-05-23common/sap_fsm.c: fix missing pointer dereferenceHarald Welte1-1/+1
sap_fsm.c: In function ‘sap_negotiate_msg_size’: sap_fsm.c:103:15: warning: passing argument 1 of ‘__bswap_16’ makes integer from pointer without a cast [-Wint-conversion]: size = ntohs((uint16_t *) param->value); ^~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Ie58af6162c67ae377809b42daa897ca3f3d72af1
2019-05-22layer23: Fix 'make distcheck'Harald Welte6-6/+65
Change-Id: Ic48e240ee1484aaa793af23c62a24d2949900b86
2019-05-22bcch_scan: Fix compiler warning about undefined functionsHarald Welte3-1/+10
Change-Id: I435ef2032b9cefe844c37f395d9087be6af8934a
2019-05-14common/sim.c: add missing break to sim_apdu_resp()Vadim Yanitskiy1-0/+1
Change-Id: Id5c325ffcfea8175bc5d5499a0904c0984e00349 Fixes: OS#198542
2019-05-09trxcon/trx_if.c: use ssize_t for return value of read()Vadim Yanitskiy1-13/+14
Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
2019-05-09trxcon/trx_if.c: print error message if read() call failsVadim Yanitskiy1-2/+6
Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
2019-05-09trxcon/trx_if.c: use read() call instead of recv()Vadim Yanitskiy1-2/+2
According to the man page of recv(), the only difference of this call from read() is the presence of flags. With a zero flags argument, recv() is generally equivalent to read(). Change-Id: I6d43bbf8d52c5fbb8ee0592b7d1c1dfd2dd1548e
2019-05-09trxcon/l1ctl.c: init DL info header in l1ctl_tx_rach_conf()Vadim Yanitskiy1-0/+2
Since we only set both ARFCN and TDMA frame number of the DL info header, other fields remain uninitialized. Let's memset() them. Change-Id: Ib39c333f1724fefa5d8bd8a2315b77a5612f7fa9
2019-05-09trxcon/l1ctl.c: pass band_arfcn to l1ctl_tx_rach_conf()Vadim Yanitskiy3-5/+6
This would allow to abstract both L1CTL and TRX interfaces from each other in the upcoming refactoring. Change-Id: I74a23c73b03bad822272b9cfe76c2501666912b7
2019-05-03mobile/gsm48_mm.c: use proper types for gsm48_rr_hdrVadim Yanitskiy1-5/+5
Change-Id: I29ed122b8956260b9f847cc0e3e81a28d6762632
2019-05-03mobile/gsm48_rr.h: mark gsm48_rr_hdr struct as packedVadim Yanitskiy1-1/+1
In both gsm48_mm.c and gsm48_rr.c we put / push 'gsm48_rr_hdr' structure into the message buffers, so then it's retrieved by the message receivers. The AddressSanitizer complains about unaligned pointer access and potentially unexpected behaviour. Change-Id: I8aa2c0074b405afd0e76044ef076b6819fe1083b
2019-05-03mobile/gsm322.c: fix heap-use-after-free in gsm322_unselect_cell()Vadim Yanitskiy1-0/+2
In gsm322_l1_signal(), if S_L1CTL_FBSB_ERR is received, we free stored System Information of the current cell, but cs->si may still point to it. Let's set it to NULL. Found with AddressSanitizer: DL1C ERROR l1ctl.c:96 FBSB RESP: result=255 DCS INFO gsm322.c:2995 Channel sync error, try again DCS INFO gsm322.c:467 Sync to ARFCN=860(DCS) rxlev=-106 DRR INFO gsm48_rr.c:665 MON: no cell info DRR INFO gsm48_rr.c:665 MON: no cell info DRR INFO gsm48_rr.c:665 MON: no cell info DRR INFO gsm48_rr.c:665 MON: no cell info DL1C ERROR l1ctl.c:96 FBSB RESP: result=255 DCS INFO gsm322.c:3008 Channel sync error. DCS DEBUG gsm322.c:3013 free sysinfo ARFCN=860(DCS) DCS INFO gsm322.c:3020 Unselect cell due to sync error! DCS INFO gsm322.c:509 Unselecting serving cell. ================================================================= ==6014==ERROR: AddressSanitizer: heap-use-after-free on address 0x61b0000000e6 at pc 0x00000050d6dd bp 0x7fff7f84aa60 sp 0x7fff7f84aa58 Change-Id: I9cc526c18d69695d810de98703579818408de011
2019-04-27lua: Add a sentinel for the fd function tableHolger Hans Peter Freyther1-0/+1
Change-Id: I4fe2fd6584a453a951361e1b67fb986583b176be