aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/rsl.c
AgeCommit message (Collapse)AuthorFilesLines
2018-11-26bts_model: Allow TS connect to be processed asynchronouslyPau Espin Pedrol1-10/+22
This commit doesn't change internal logic of any model, only the API to be able to return result of connect TS asyncrhonously since some models (like osmo-bts-trx) require some time to process the result. This way PDCH ACT/DEACT (N)ACK can be sent once the result of this long process is known. For instance, nowadays in osmo-bts-trx we PDCH (DE)ACT ACK before getting the result from SETSLOT on the TRX iface. With this new API, bts_model_ts_connect doesn't return any value synchronously. Instead, it is expected to always end up calling cb_ts_connected with the return code from the TS activation process. 0 is considered a successs, while any other value is considered an error. Change-Id: Ie073a4397dd2f1a691968d12b15b8b42f1e1b0cf
2018-11-26cosmetic: fix whitespacePau Espin Pedrol1-1/+1
Change-Id: Iaa4552844db33fe69da5ed7028dbfa0100c33900
2018-11-23rsl: Avoid sending ipa PDCH DEACT NACK followed by ACKPau Espin Pedrol1-2/+1
It was spotted during osmo-gsm-tester test dynts:trx-sysmocell5000+mod-bts0-dynts67-ipa+cfg-codec-fr-any that osmo-bts-trx was answering to PDCH DEACT from BSC first with a NACK followed immediatelly after by an ACK. That happens after the test does a GPRS pdp ctx act successfuly and then deactivates the ctx and the 2 MS try to place a call between them (and thus channels need to be moved to TCH/F). Most probably the if condition where the lines for this commit are modified need to be fine-grained. Patch before this one should help to understand the steates/situation in this scenario, and then a follow-up patch can be created to improve the logic. Change-Id: I91c65da6b6b7094f32187d3b083153a87c3219fd
2018-11-23rsl: Log lchan state during dynts PDCH->TCHPau Espin Pedrol1-2/+3
Change-Id: Iee5ac0550afda71fce67b0340749c111b364bb4f
2018-10-10rsl_rx_chan-activ: Improve logging informationPau Espin Pedrol1-2/+3
Change-Id: I9b9a666e195ea729503ecd707e1582268c190e09
2018-09-19common/rsl.c: tweak log message in lapdm_rll_tx_cb()Vadim Yanitskiy1-2/+3
During the investigation of OS#3559, it was discovered that the log message, which warns that an RSL message was dropped due to inactive logical channel, has incorrect log level - LOGL_INFO. This is not informative kind of message, so let's increase the log level, and additionally let's print the hexdump of message and it's length. Change-Id: I26eac5e4466c493ffe08dbb89de20f5e1c2bb85d
2018-09-11log: add error log for RSL Chan Mode ModifKeith Whyte1-1/+4
Add log context to chan_mode error in rsl_rx_mode_modif(). Tweaked-by: neels Change-Id: I945cf1ca8660ad5daf097edab1833bbc74b6185f
2018-09-11fix RSL Chan Mode Modif for dyn TSNeels Hofmeyr1-1/+1
Fix the chan mode checking for RSL Chan Mode Modif: do not reject all modes on dyn TS. In rsl_rx_mode_modif(), bts_supports_cm() should never be fed with dynamic pchan kinds (e.g. GSM_PCHAN_TCH_F_TCH_H_PDCH). Feed instead the return value of ts_pchan() that is to say, the actual pchan type (e.g. GSM_PCHAN_TCH_F). Change-Id: I7f0c835b25289931bccf96e982ea5564c8be4192
2018-09-09CBCH: Fix rejecting SMS-CB related RSL messagesHarald Welte1-2/+6
Normally, the "Common Channel" related RSL messages should actually contain such a common channel. However, since cell broadcast is implemented inside what's essentially a downlink SDCCH, we should add some explicit exceptions. Before this patch, any RSL SMS BC CMD would have been discarded and an RSL Error Indiciation returned. Change-Id: I2f7f1dd43505cc27cd33489d8b0e8c981cd93880 Closes: OS#3533
2018-08-20measurement: make sure state is reset on chan act.Philipp Maier1-1/+1
At the moment only lchan_meas_reset is reset on channel activation. All other states are not reset. This may lead to irretations in the first measurement interval if there are still leftover messages from a previous connection. Lets ensure everything is reset to zero by zeroing out the whole .meas struct in struct lchan. - Add a centralized function that does the reset - Call that function from rsl_tx_chan_act_ack() in rsl.c Change-Id: I880ae3030df6dcd60c32b7144c3430528429bdea Related: OS#2975 Related: OS#2987
2018-07-25preserve lchan-specific SI overrides on SACCH FILLStefan Sperling1-4/+10
During SACCH FILL processing, update lchan SI values only for lchans which follow BTS-global default values, keeping lchan-specific overrides in place. Change-Id: I515bbd9983fa894507386b241863a9aa4d279497 Fixes: eee7247ebe0d0a54a54b53b739bdd434dfceb511 Related: OS#3173
2018-07-24update sysinfo copies in all lchans upon SACCH FILLStefan Sperling1-0/+32
When a SACCH FILL is received, loop over all lchans and update their copies of system information data. This change makes BTS_Tests.TC_sacch_multi_chg pass. Change-Id: I3e63eeb5fcf320fb029de16e4d327e153cc34567 Related: OS#3173
2018-07-06rsl: Use value_string to print encryption algo namePau Espin Pedrol1-4/+5
Change-Id: I8303364270e73718e57f8efc2f375817b9496ffc
2018-06-29Add min/max/std-dev measurement reporting for TOA256Harald Welte1-8/+22
This patch adds extended processing of the high-resolution TOA256 measurement values. It adds reporting of the following values for each RSL MEAS REP for uplink measurements: * minimum TOA256 value during reporting period * maximum TOA256 value during reporting period * standard deviation of TOA256 value during reporting period Change-Id: Iea4a4781481f77c6163d82dcd71a844a5be87bf2
2018-06-09Send DELETE_IND when dropping Imm Assign pending messagePau Espin Pedrol1-1/+1
This way we give the opportunity to the BSC to release the channel quicker, otherwise it has to wait until T3101 expires. Same procedure is already done in rsl.c rsl_rx_imm_ass() when we return an error (hard limit AGCH queue len reached) from bts_agch_enqueue(). Related: OS#2990 Change-Id: Id9927c0789054ce3ecc7b30380585a1ffe05db5a
2018-05-25rtp: make port range configurable, assign correct port numbersPhilipp Maier1-2/+24
The current implementation does not allow the user to specify a port range in which the BTS is allowed to allocate a local RTP port. Also the ports the BTS picks do not match the policy described in RFC3550. An RTP Port must be at an even port number and the matching RTCP port must be at the following (odd) port number. The BTS currently picks random port numbers for both. - Add a VTY command to specify a port range in which the BTS may assign local ports. - Pick ports as described in RFC3550. Change-Id: Id75f1dfaf898ed8750d28b1c4840e188f4cfdc87 Related: OS#2825 OS#2635
2018-05-09rsl: If CHAN ACT or MODE MODIF fails, send respective NACKHarald Welte1-4/+4
The existign code only sent an ERROR REPORT, but it failed to actually send a proper NACK to the related request. This is confusing, as the operation should always be ACKed or NACKed, and not simply result in no response. Change-Id: Ic374a8e5e239ffe37082a54cdb94cb6ac9723e83 Closes: OS#3254
2018-05-09rsl: Properly NACK CHAN_ACKT / MODE_MODIFYHarald Welte1-13/+17
Whenever we encounter an error condition during processing of RSL CHAN ACT or RSL MODE MODIFY, it's insufficient to simply send an RSL ERROR INDICATION, but we also must send a proper NACK back to the BSC. Change-Id: I4dd7ff2fd2cdbc6e892cd329c826ac1bc3b16bb9
2018-05-09rsl: Make channel activation fail if encryption algorithm not supportedHarald Welte1-1/+1
The code actually always *wanted* to make lchan activation fail in case we don't support the algorithm, but it failed ot do so. The problem is encr_info2lchan() which uses bts_supports_cipher() to determine if the cipher is supported. However, if bts_supports_cipher() returns 0 (not supported), it uses this value as return value of encr_info2lchan() where '0' means success (standard osmocom convention). This results in channel activation proceeding, which it shouldn't. Change-Id: I46275b8fc2a1a74f68b4cc60e0f64ba226b108cd Related: OS#3254
2018-05-09rsl: log errors when parsing of encryption information failsHarald Welte1-2/+10
... also log a DEBUG message whenever we change the lchan->encr Related: OS#3254 Change-Id: Icda7722eef319f343178b0bb8f79362026948199
2018-05-08add/improve various logging around dyn tsNeels Hofmeyr1-8/+16
This logging turned up while I was debugging dynamic timeslots: - OML Set Channel Attributes logging. - a specific dyn TS pchan error. - show pchan and lchan types on CHAN ACT ACK and REL ACK logging. - on RSL message Rx, log the current pchan kind in detail, using gsm_ts_and_pchan_name(). This logs the underlying pchan as well as the current pchan mode a dyn TS is in. - move 2 dyn TS logging from DL1C to DRSL, where all the other dyn ts logging is. Change-Id: Ia89c134060e85f7065afd5642d1c541c65dd25ea
2018-05-08ip.access dyn ts: properly NACK a PDCH ACT on a still active lchanNeels Hofmeyr1-0/+7
Fixes: BTS_Tests.TC_dyn_ipa_pdch_tchf_act_pdch_act_nack Change-Id: I12816ef9953467decd9f745217135702a544c8fc
2018-05-08fix RSL Chan Activ Nack messagesNeels Hofmeyr1-6/+4
In early rsl_rx_chan_activ(), do not use rsl_tx_chan_act_acknack() to trigger sending a NACK, instead use rsl_tx_chan_act_nack() directly. Rationale: the previously used rsl_tx_chan_act_acknack() may decide to omit the NACK, particularly based on the lchan->rel_act_kind. lchan->rel_act_kind indicates whether the Chan Release or Activation was explicitly requested via RSL, and thus whether an ACK/NACK should go back to RSL or not. This gets set only late in rsl_rx_chan_activ(). We cannot set it on top, because we need to first establish whether the Chan Activ is permitted or not. In case of early rejection of the Chan Activ, we do not want to modify the lchan state, but merely reply with a NACK, unconditionally. Before this patch, NACKs that rsl_rx_chan_activ() wants to trigger would possibly be not be sent out on RSL, because lchan->rel_act_kind is not explicitly initialized until later. Fixes: BTS_Tests.TC_dyn_ipa_pdch_act_tchf_act_nack Change-Id: Ic981f768cc024f0acd3d7ae55846cfbc7bc089ce
2018-05-08ignore RSL RF CHAN REL for inactive lchansNeels Hofmeyr1-9/+29
When an RF CHANnel RELease request is received on an already released lchan, there is no "REL NACK" message or similar, we just ACK the release. When ACKing the release, make sure to reflect the same chan_nr that the release was asked for, since the lchan state may actually reflect a different chan_nr. Factor the actual Rel Ack message sending out of rsl_tx_rf_rel_ack(), which makes all sorts of decisions around normal Rel Ack: add static tx_rf_rel_ack(), with chan_nr argument instead of deriving chan_nr from the lchan. Use this to directly ACK an unusual Chan Rel with the chan_nr that came in with the request. Fixes: BTS_Tests.TC_dyn_osmo_pdch_unsol_deact (after I6b790e866ce4e66d9385b286b727ae41a83d3e67) Change-Id: Iceaa2e87874ced42d664a2a0b01a1c59e46a19b3
2018-05-05dyn TS: clear TCH state upon reconnecting as PDCHNeels Hofmeyr1-0/+26
For ip.access style TCH/F_PDCH, this fixes switch-back to PDCH in case the TCH use employed encryption. For Osmocom style TCH/F_TCH/H_PDCH, do the same, purely out of sanity. Roughly the same should already be happening during PDCH Chan Activ, but make sure to clear all these fields, so they are cleared even if IEs are missing. From both dyn TS code paths, call new clear_lchan_for_pdch_activ(), which clears the same fields that are normally overwritten by an RSL Chan Activ. Related: OS#3238 Change-Id: I8451039683b54bee910c97c5a3e6873e0ff1b160
2018-05-05dyn TS: rx_rf_chan_rel: properly mark PDCH rel when no PCU, clarifyNeels Hofmeyr1-4/+7
When the PCU is not connected, we immediately call rsl_tx_rf_rel_ack() because we don't need to wait for a PDCH deactivation. Fix: properly mark rel_act_kind = LCHAN_REL_ACT_PCU to invoke identical behavior as when the PCU were involved. (When the PCU is connected, a PDCH release on an Osmocom style dyn TS causes an actual release of the PDCH TS, and then triggers an rsl_tx_rf_rel_ack() with rel_act_kind == LCHAN_REL_ACT_PCU.) Clarify the code flow: rc == 1 is the special case of no PCU being connected, so have that in a separate if{}. Change-Id: I654b963815b32fcbce050c2e15f3190c97bc259f
2018-05-05dyn TS: fix TCH/F_TCH/H_PDCH: properly record release of PDCH TSNeels Hofmeyr1-0/+2
When a release of PDCH is complete, actually set the dyn.pchan_is to NONE. Failure to do so currently caused errors on activation of an Osmocom style dyn TS as TCH, in the shape of: rsl.c:636 (bts=0,trx=0,ts=2,ss=0) Tx RF CHAN REL ACK rsl.c:164 (bts=0,trx=0,ts=2,pchan=TCH/F_TCH/H_PDCH switching PDCH -> NONE) RSL rx DCHAN: mismatching chan_nr=0x12 rsl.c:2611 Rx RSL CHAN_ACTIV for unknown lchan rsl.c:710 0x12: Sending Channel Activated NACK: cause = 0x64 The Tx RF CHAN REL ACK shows that we're through with PDCH release, but the following line showing "chan=TCH/F_TCH/H_PDCH switching PDCH -> NONE" shows that the state still reflects active switching. Thus the DCHAN code decides that the chan_nr = 0x12 reflecting a TCH/H on TS 2 is a mismatch and NACKs the TCH activation. (For ip.access style TCH/F_PDCH, the ts->flags are cleared in ipacc_dyn_pdch_complete()). Related: OS#3235 Change-Id: Ic06c8f0fe82ae8a06afa5defd93a685010687965
2018-05-05cosmetic: dyn TS: clarify rsl_tx_rf_rel_ack() with a switchNeels Hofmeyr1-9/+41
Use a switch statement and ample comments to clarify what is done and why. Cosmetically prepares for Ic06c8f0fe82ae8a06afa5defd93a685010687965. Related: OS#3235 Change-Id: I8a9953b011a4516972aae468754494f57ebc0a3f
2018-04-05rsl_tx_dyn_pdch_ack: Add missing FRAME_NR information elementHarald Welte1-4/+7
It seems that the IPA PDCH ACT ACK contains not only the channel number, but also the frame number. Let's make sure we're as close as possible to other implementations to ensure maximum interoperability. Change-Id: Ibe7988e9ef374e8c7d9429777fb32322d90c2024
2018-04-05fox chan_nr_is_dchan() for RSL_CHAN_OSMO_PDCHHarald Welte1-2/+2
When writing chan_nr_is_dchan() in Change-Id: I43a78bec63aeb36dd67043d237b27fe880209349, I apparently only looked at TS 48.058 without considering the osmocom extension to it for PDCH activation. The result is complete breakage for "osmocom style dynamic PDCH" support. This patch fixes the mistake by making the compare more specific. Change-Id: I18e0774fdd48966bc95261e715f798464b8b681f Related: OS#3131, OS#1853
2018-03-17Get rid of 'struct gsm_bts_role_bts'Harald Welte1-8/+7
gsm_bts_role_bts was introduced at a time when we still shared gsm_data_shared.[ch] between BSC and BTS, and where we then subsequently needed a BTS-private structure. Since that sharing was abandoned quite some time ago, we can merge gsm_bts_role_bts into gsm_bts and do away with the bts/btsb dualism in a lot of the code. Change-Id: I4fdd601ea873d9697f89a748cc77bcf7c978fa3e
2018-03-11cosmetic: Document some SI scheduling related function APIHarald Welte1-1/+16
Change-Id: I7e61639349deda28846810c4f52dbea78dccda38
2018-03-03rsl: remove unused variablePhilipp Maier1-1/+0
The variable btsb in rsl_rx_mode_modif() is set but not used. - remove btsb Change-Id: Ic07edfa04c2184bff4a043e96e69c07df38607e4
2018-03-03ipac: fix log outputPhilipp Maier1-12/+10
The current log output logs connect_ip connect_port speech mode and payload type over multiple lines and without logging context (lchan name). Also the logging level incorrectly set. - shrink log output into one line. - add context (lchan name) - encode ip/port into human readable form Change-Id: I61044edc0672b268aeebf48b59a772887703399f Closes: OS#3001
2018-02-27Add high-accuracy ToA value to Uplink Measurement ReportsHarald Welte1-0/+12
Normal Abis RSL MEasurement Results contain only the "MS Timing Offset IE" in units of full symbols. In some use cases it is important to have higher-accuracy timing information exposed to the BSC. We do this by adding the average timing offset value during the last measurement interval in 1/256th symbol accuracy to the "Supplementary MEasuremen Information" part of the TS 48.058 9.3.25 Uplink Measurements IE. In order to avoid any compatibility issues, this feature is only enabled if the new vty config command "supp-meas-info toa256" at the bts node is enabled. Change-Id: Ie85e53b47d4041cc4e6d7b78406ae8b79b2d9397
2018-02-25RSL IPA DLCX: Avoid another null-pointer dereferenceHarald Welte1-6/+5
In case a DLCX _with conn-id_ is issued without any CRCX before, we ran into a NULL pointer dereference in adding the connection statistics. Let's handle this gracefully and simply return empty statistics. Change-Id: If8b71266c847b90cdc51695b9f47b527c51bd70c Closes: OS#2996
2018-02-25RSL: Fix encoding of ConnectionID in IPA_DLCX_ACKHarald Welte1-1/+1
Change-Id: Ifdea747e78f191902870af53692f7a70fa7ece93 Closes: OS#2999
2018-02-25RSL IPA DLCX: Avoid null-pointer dereferenceHarald Welte1-5/+7
In case a DLCX is issued without any CRCX before, let's handle this gracefully and simply ack the DLCX anyway. Change-Id: I7c5bedccfc5a7cf552a9ce3a2dc712081c7ce177 Closes: OS#2996
2018-02-24rsl: Improve ERROR REPORTingHarald Welte1-44/+81
Let's make sure all useful optional IEs of the RSL ERROR REPort aare present Change-Id: I5ecb98f8c72f472ac23c1e4e0f606b75e2cf032c
2018-02-24BTS: add rate_ctr about CCCH (paging, agch, pch)Harald Welte1-0/+3
Change-Id: Id6c833746150a3c2e32b00ea6604669f16b84bc4
2018-02-24RSL: Send ERROR REPORT on too short/truncated messages + wrong discriminatorHarald Welte1-0/+6
Change-Id: I6a0e63999f39592474064e2f05df450aec8e37fe
2018-02-24RSL: Implement DELETE INDICATION on AGCH overflowHarald Welte1-0/+17
This patch adds generation of a DELETE INDICATION when the BTS AGCH queue overflows due to too many IMMEDIATE ASSIGN CMDs, as required by the specs. The AGCH queue length in OsmoBTS so far is at 1000 entries, which I consider way too high. But that is for another patch. Change-Id: Ied3306e85cbdc6f3476b10dc4bb0463cd728b274 Related: OS#2990
2018-02-23Revert "measurement: fix measurement computation"Harald Welte1-2/+1
This reverts commit d5fdcfe6d95f52fb76c4f4201969347a062fc9fd, which introduces a new function lchan_meas_update_ordered_TA whose functionality I still haven't yet managed to fully understand. It appears to be adjusting the requested timing advance (lchan->rqd_ta) but outside osmo-bts-trx/loops.c code. This is odd, as rqd_ta is a state variable of that loops.c code. So for one part, it is a failure of encapsulation. The TA loop code should be self-contained, particularly as it is only used for omso-bts-trx, and not for the other BTS models. The new lchan_meas_update_ordered_TA() function is used from common code, applicable to all BTS models. The resulting interaction between loops.c code and this new (now reverted) function cause the TA value to only ever grow, despite the MS never moving at all. Change-Id: I5a5adac6f18f94a5b51758a5ace8ef6ddfd23e80 Related: OS#2989
2018-02-22bts: use feature list instead of speech codec tablePhilipp Maier1-1/+1
osmo-bts has a table of pchan/channel mode combinations for every bts. This table models the codec capabilitys of the BTS hardware. However, having the speech codec apabilities modeled inside the BTS feature list would be much more comfortable and since the feature list is communicated back to the BSC we would get the codec capabilities inside the BSC domain as well. - remove the pchan/channel mode tables - set speech codec variants for each BTS type - fix bts_supports_cm so that it queries the feature list Change-Id: I977dc729ba856631245aedf76afd48eac92166f7
2018-02-21RSL: Ensure we don't accept DCHAN messages for CCHANHarald Welte1-0/+22
If the Channel Number IE points to a common channel, we cannot accept such messages in code paths that only process dedicated channels, such as RLL/DCHAN/IPA. Related: OS#2972, OS#2971 Change-Id: I43a78bec63aeb36dd67043d237b27fe880209349
2018-02-21RSL: Properly reject RSL CHAN_NR IE for incompatible PCHANHarald Welte1-34/+78
If we receive a message for a dedicated channel, whose channel number structure doesn't match with the physical channel (timeslot) type, we must properly reject this. For RSL CHAN ACT it means sending a NACK, and for all other cases it means sending an RSL ERROR REPORT. Related: OS#2972, OS#2971 Change-Id: Iebd2571726d1284a7431b3f9b23ad3185e832ed1
2018-02-19rsl: do not allow MODE MODIFY request with unsupp. codec/ratePhilipp Maier1-0/+6
When the BSC sends a MODE MODIFY request with an unsupported codec, the BTS must respond with a negative acknowledge. Currently the codec parameter is not checked at all, which may lead into malfunction or crash of the BTS. - Introduce a mechanism to check the codec/rate against a table that is set up in the phy specific code. - Add tables with supported codec/rate combinations for octphy, sysmobts, and trx. Change-Id: Id9b222b7ab19ece90591718bc562b3a8c5e02023 Related: SYS#3212
2018-01-26fix nullpointer deref in rsl_tx_mode_modif_nack()Philipp Maier1-0/+1
The function rsl_tx_mode_modif_nack() uses abis_bts_rsl_sendmsg(). This function relys on msg->trx to be set (see abis.c). However, rsl_tx_mode_modif_nack() creates the message buffer, but does not set msg->trx. - Make sure that msg->trx is set properly Change-Id: Ib5990db11df1b25dc5d321193731426b11f8005a
2018-01-26rsl: fix double-free in rsl_rx_mode_modif()Philipp Maier1-1/+0
When the RSL_IE_CHAN_MODE is is missing, then the message buffer is freed and the channel mode modify is nacked using return rsl_tx_mode_modif_nack() The function rsl_tx_mode_modif_nack uses abis_bts_rsl_sendmsg() which returns 0 on success. This eventually leads into a double- free in rsl_rx_dchan() which frees the message buffer on all return codes except 1. - Remove the excess msgb_free() in the error handling path. Change-Id: I946a927ba35aa115520b1248eefccd91832f69f6
2017-12-11Fix malformed Resource Indication packetPau Espin Pedrol1-0/+1
Wireshark was showing a Malformed packet alert, and further ivnestigation showed that "Resource Information" TLV was missing in the packet. See GSM 08.58 sections 8.6.1 and 9.3.21 for more information. Indicating interference level is not yet implemented, but at least now we avoid sending a malformed packet. Patch has been validated against a running setup with wireshark in my local PC. Related: OS#2735 Change-Id: Ie97170811aaf8a089febfa20380ab48ea174056a