Commit Graph

76 Commits

Author SHA1 Message Date
Max 322cfc4942 Add helper to get BCC from BSIC
Change-Id: Ib539a8739d53ab60d8fadffcef38152b82a28498
Related: OS#1854
2018-02-07 20:45:22 +01:00
Pau Espin ef8cdfbacb oml.c: Fix use of htons instead of ntohs
In oml_ipa_mo_set_attr_cell, as well as we do in other set functions in
the same file, we want to store a parsed value from a TLV received on
the network into a host local structure. We hence need to use ntohs
instead of htons.

Change-Id: Icbf65f8a4b871b0fa2e84ad6cd2188d4e34f704b
2018-01-08 15:45:49 +00:00
Max 36fa0bd079 Fix race condition in attribute reporting
Previously it could be possible that the attribute request comes from
BSC before the TRX is properly initialized which would lead to SIGABRT
caused by OSMO_ASSERT() in PHY instantiation. Workaround this by
explicitly checking for TRX availability before handling TRX-specific
attributes.

This only happens with osmo-bts-trx and is hard to reproduce. Ideal fix
would be to defer attribute response until we have TRX connected but
that would make corresponding code more complex because we'll need to
save the attribute request and properly hook response routine into TRX
connection handler. Alternatively we can postpone osmo-bts-trx
connection to BSC until TRX is available: it's not very useful without
it anyway.

Change-Id: Id36885e507c4a3203b5662c0fde12c5206174d82
Fixes: OS#2560
2017-10-23 18:12:45 +00:00
Max ae134f896a OML: print actual type of report sent to BSC
We re-use the same facility to send different data so it's better to
print actual cause value to avoid confusion.

Change-Id: I9413ecf57eaa6fc661f1a57ccdaa2f04c50ea43b
2017-09-11 07:50:18 +00:00
Max 01e84be54f OML: use fom_hdr while handling attr. request
Use Obj. Class and TRX# from abis_om_fom_hdr of incoming request instead
of BTS' MO to properly distinguish between BTS-level and TRX-level
attributes.

Change-Id: I8b5a5ab8bd07daf2500b66dec428b89b7f8cd852
Related: OS#2317
2017-08-22 13:29:25 +00:00
Max 94bdcfd803 OML: move BTS number check into separate function
* move code which checks for BTS number (obtained via OML) validity into
  separate function
* adjust log messages to match the check
* add spec reference and comments

Change-Id: Id5714fbed910696d30e18d1f20f4c9fced4b9230
Related: OS#2317
2017-06-22 10:51:12 +00:00
Harald Welte f4544573f8 OML Add osmocom-specific way to deactivate radio link timeout
In some situations (e.g. when trying to do measurements/testing on the
BTS receiver / uplink) it is useful to have a way to disable the radio
link timeout and keep any channel open until deactivated, irrespective
of whether (valid) data is received or not.

This adds a related feature that can be activated by using an
osmocom-specific value of 0xff for the TS 12.21 Connection Failure
Criterion (9.4.14).

Change-Id: I736f21f6528db5c16fa80cdb905af20673797be5
2017-06-18 10:00:43 +00:00
Max de9357251c Set and report BTS features
Set (possibly incomplete) list of BTS model-specific features and report
them in response to attribute request via OML.

Change-Id: I5f8a6681c3562ec261441e84dde6e085b516d92f
Related: OS#1614
2017-06-15 12:55:16 +00:00
Max b7793ed8fd Extend Get Attribute responder
* detect if attributes are requested for BTS or TRX and act accordingly
* report TRX phy version

Change-Id: I9f72305bbf1ab74745bffac1bee9f539f5a6de32
Related: OS#1614
2017-06-15 12:55:16 +00:00
Max e91cd2b088 OML: fix Coverity-reported issues
* CID 169803:  Null pointer dereferences
* CID 169802:  Incorrect expression

Change-Id: Ib3f91be97c8bf81a87681814bf81d3a5a9950e54
Related: OS#1614
2017-05-29 21:13:45 +00:00
Harald Welte 05ba5c2a10 Consistently check for minimum attribute/TLV length in RSL and OML
Make more use of TLVP_PRES_LEN() instead of plain TLVP_PRESENT() and
implicitly assuming a certain length of the information element.

What this obviously doesn't introduce is some kind of error
generation/reporting in case the minimum length is not fulfilled.  An IE
that's too small is silently ignored by TLVP_PRES_LEN() and treated as
if the IE wouldn't exist in the first place.

Change-Id: If5c4eee65711c49bc8ba4675221b1d5fd16198e9
2017-05-29 19:55:30 +00:00
Max 72993079ed Implement basic Get Attribute responder
Add 3GPP TS 52.021 §8.11.2 Get Attribute Response handling:
* report OsmoBTS version
* report sysmoBTS sub-model
* report OsmoBTS variant

Requires I7ecb0c4339530d3a8354a2f94b34063dda87e030 in OpenBSC.

Change-Id: I09f95ed995fab5def9dc6e8cc201012fba4db28d
Related: OS#1614
2017-05-27 07:55:41 +00:00
Max 9d5ec1af74 Signal to BSC when PCU disconnects
While at it - do not serialize NULL as a string when delivering OML
Failure Report.

Change-Id: I41a731bd719aee0bbb98d3236405fb3a7f3ddec0
Related: OS#1615
2017-05-08 08:31:52 +00:00
Ivan Kluchnikov 64d16028eb oml: Fix incorrect usage of const variable abis_nm_att_tlvdef_ipa
This bug was introduced during moving oml definitions from osmo-bts to libosmocore
in libosmocore 0bee65c0d89f81a4b90aa3d484016d9ba680dd46 and
osmo-bts 2cf6b73a4278627331bdbbb4addf1a8bc1d964ce:

The type of abis_nm_att_tlvdef_ipa was changed from struct tlv_definition to
const struct tlv_definition, so:
 * create static abis_nm_att_tlvdef_ipa_local variable for oml attribute
   definitions
 * copy abis_nm_att_tlvdef_ipa to abis_nm_att_tlvdef_ipa_local
 * merge abis_nm_att_tlvdef with abis_nm_att_tlvdef_ipa_local
 * use abis_nm_att_tlvdef_ipa_local in oml_tlv_parse function

Change-Id: Ia9f3c94ab247adeecb26a01c3ccd6f3a8c17ba1c
2017-02-20 13:28:38 +00:00
Max 871e0bec7e OML: internalize failure reporting
* make oml_tx_failure_event_rep() static and use osmo_signal_dispatch()
  wrapped into oml_fail_rep() to trigger event reports outside of oml.c
  instead of directly calling into OML layer
* remove unnecessary formatting from text messages

Related: OS#1615
Change-Id: I738555c547926e97b325ab53763c0076c42309bc
2017-01-25 13:24:52 +01:00
Max de6d25e21d Remove obsolete define TLVP_PRES_LEN
The libosmocore version required by configure.ac already has
TLVP_PRES_LEN anyway.

Change-Id: I3e33d9d1a6160ea17ab0a875c65a98129e3d19c1
2017-01-10 17:18:05 +01:00
Philipp Maier 962b33ea9d OML: fix possible segfault: add NULL check in oml_ipa_set_attr()
oml_ipa_set_attr() is using gsm_objclass2mo() to determine the
*mo object. However, it is possible that gsm_objclass2mo() returns a
null-pointer. The code following up is using *mo without checking.
Reject instead of dereferencing a NULL *mo.

Fixes: coverity scan CID#159533
Change-Id: Ia2cc9bc504c46ca3843c43d712cd8649bfae9526
2017-01-10 14:14:51 +00:00
Max ec11a85929 Alarm on various errors
Send OML Failure Report for unsupported BTS attributes and other errors.

Change-Id: Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e
Related: OS#1615
2017-01-08 11:09:58 +00:00
Max c038cb7903 Add Abis OML failure event reporting
Send 3GPP TS 12.21 § 8.8.2 Abis/OML failure event report.

Change-Id: Ib1170edca2207752984a554d7a6a57c224f6d5f5
Related: OS#1615
2017-01-08 11:03:39 +00:00
Max 2cf6b73a42 Move code to libosmocore
With libosmocore commits I9c3bc15662949654e7bba6aad5488c69ee7d0c45 and
Ieaaaed19da9c069fe451faa53d24c5b84d7d5615 functions to copy and merge
parsed TLV were added as well as abis_nm_att_tlvdef_ipa TLV definition
with related enums. Hence we can remove it from here.

Change-Id: Ia4980062ea88ffe9019b201f84e92e006ae3c2e3
2017-01-06 12:24:42 +01:00
Max ebb483b69a Replace magic number with define
SDCCH occupy lchan 0..3 in combined configuration so for CCCH we've
always used lchan[4] - replace it with CCCH_LCHAN define and add
comment.

Change-Id: Ic5d742c292d638f119c6b4672120c1950adeb7f0
2016-10-18 08:08:25 +00:00
Neels Hofmeyr 21ffe07894 dyn TS: common TCH/F_TCH/H_PDCH implementation
common/l1sap: For dyn TS, the BSC will issue RSL Chan Activ requests with a
non-standard chan_nr. While the rest of the code now understands that, the L1
phy will not. Translate to standard PDCH (== TCH/F).

common/oml: use dyn TS' current pchan mode for lchans config.

common/pcu_sock: detect desired PDCH mode of dyn TS.

common/rsl: implement reconnection chain of a TS for changing its pchan:

* rsl_rx_chan_activ():
** Add dyn_pchan_from_chan_nr() to derive the requested pchan from the RSL
   chan_nr IE.
** Notice the need for a pchan change and invoke dyn_ts_l1_reconnect() (s.b.)
** Make Chan Mode IE presence optional, because the non-standard PDCH
   activation message is simpler and does not require it.
** Do PDCH activation via PCU.

* Add dyn_ts_l1_reconnect(): store state and disconnect the L1 channel;
  then wait for cb_ts_disconnected().

* Add osmo_dyn_ts_disconnected() to cb_ts_disconnected():
  verify state and connect with the new pchan type; then wait for
  cb_ts_connected().

* Add osmo_dyn_ts_connected() to cb_ts_connected(), which re-issues
  the cached chan activation message from before disconnecting the L1 channel.

* Also send an rf chan rel/act ack for dyn TS upon PDCH de/act via PCU.

* Add dyn_ts_pdch_release(): on channel release of a dyn TS in PDCH mode,
  release via the PCU. Call from rsl_rx_rd_chan_rel().

Change-Id: I463bb6b4e57674f091c3badba9257374961c52c7
2016-07-25 22:13:44 +02:00
Neels Hofmeyr c9582ac2d7 prepare dyn TS: split/replace conf_lchans_for_pchan()
Move the actual switch from static conf_lchans_for_pchan() into new 'public'
function conf_lchans_as_pchan(), adding an explicit pchan argument. This allows
passing a non-trivial pchan, for dynamic TS.

conf_lchans_as_pchan() now takes a pchan argument, so distinguish the naming
and drop the 'for_pchan' from conf_lchans_for_pchan(), which takes only a ts
argument.

Change-Id: I8e458501fff5503c243512aeb3469c12b1f2bbc4
2016-07-25 15:22:06 +00:00
Neels Hofmeyr 334df9441a cosmetic: clarify TCH/F_PDCH related naming and comments
We're about to introduce a new kind of dynamic channel, which will also use
parts of the ip.access mode dyn PDCH code paths. Make sure the general parts
have general names and mark ip.access specific parts as such.

Rename dyn_pdch_ts_[dis]connected() to cb_ts_[dis]connected().
Rename dyn_pdch_complete to ipacc_dyn_pdch_complete().
From cb_ts_[dis]connected(), factor out the current code into static
functions ipacc_dyn_pdch_[dis]connected() -- this will make sense once the
new dynamic kind is added to cb_ts_[dis]connected().

Change-Id: I7da5b7cb7b48572671f50e0dec97d9eec3083df1
2016-07-25 16:38:18 +02:00
Neels Hofmeyr e6cc04827a dyn PDCH: conf_lchans_for_pchan(): handle TCH/F_PDCH
Depending on the PDCH active flag, handle a TCH/F_PDCH like TCH/F or PDCH.

Change-Id: Ifc5561f8e2db172bb692ba26bdeae2fd675d6ec5
2016-06-17 15:50:47 +00:00
Neels Hofmeyr 65efa691f8 oml, Set Chan Attr: treat unknown PCHAN types as error
Change-Id: Id79585993df15362ba0e1271d03302597182ceff
2016-06-17 01:31:03 +00:00
Harald Welte 2ed116efec Revert "oml: temporary debug hack"
This reverts commit c623c4e589.

That's a commit from 2012, and it was never needed ever since.
2016-02-03 18:45:39 +01:00
Harald Welte 3ca59512d2 OML: Ignore T200 settings by BSC for now
It seems that once we start to respect the T200 values as specified by
the BSC, we run into all kinds of issues with LAPDm re-transmissions,
REJ frames, unexpected supervisory frames and the like.

The libosmogsm LAPDm T200 defaults of 1s/2s are proven to "work" (i.e.
not expose the above behavior), so let's revert to them until the root
cause of this problem is determined.
2016-01-25 20:46:56 +01:00
Harald Welte 111a02f214 lapdm: Add DEBUGP statement about T200 values being set for lchan 2016-01-25 20:46:53 +01:00
Harald Welte 0d19e48487 Fix T200 default values
The T200 default values should be in milli-seconds (as the variable name
indicates).  They are not expected to be divided by the TS 12.21 OML
dividers for T200.

This change doesn't really make a difference with OpenBSC, as the BSC
always sets its own T200 values via OML, overwriting the defaults here.
2016-01-25 20:46:51 +01:00
Andreas Eversberg 69fc57b028 ABIS: Support for multiple RSL connections 2016-01-22 09:09:02 +01:00
Harald Welte 3d431bb4eb Fix T200 default values
t200_ms is an unsigned int [7] array, while the oml_default_t200_ms was
an uint8_t[7] array, which we memcpy() to the former as default
initializer.  Fix this by turning oml_default_t200_ms into unsigned int,
too.
2016-01-17 21:10:09 +01:00
Harald Welte e9f12acbeb LAPDm: Use T200 settings from OML rather than libosmocore defaults 2016-01-16 16:25:52 +01:00
Andreas Eversberg 75f105bbb5 Fix: Retrieve ARFCN (from OML) for TRX other than C0 2015-09-22 16:41:24 +02:00
Harald Welte b15d2c9d2f Initial CBCH support
This should handle OML channel combinations with CBCH and activate the
CBCH SAPI towards the DSP correspondingly.  What is still missing is
sending any actual information over the CBCH in respons to the
PH-RTS.ind coming up from L1.
2014-12-30 00:28:31 +01:00
Harald Welte ac76388c77 TLVP_PRES_LEN is now in libosmocore, avoid redefining it 2014-08-18 20:48:56 +02:00
Harald Welte bc82b0189a replace oml_{osmo,ipa}_magic[] with abis_nm_{osmo,ipa}_magic
the latter is now in libosmogsm.
2014-08-18 20:48:56 +02:00
Holger Hans Peter Freyther 0655cac6f1 sysmobts: Verify the structure of IPA and OML messages
Extend the router to verify that the message received is
properly encoded. The code can deal with the basic structure
of ETSI OML and vendor specific messages for ip.access and
the osmocom project.
2014-07-31 16:58:26 +02:00
Jacob Erlbeck 57a4d121c4 oml: Pass all valid state change requests to the model
Currently ADM state change request that tries to set the
administrative state to the current value are immediately ACK'ed.
Beside the caching problem, this could lead the protocol
inconsistencies if two such requests are sent one after the other and
the second arrives before the procedure of the first has finished.

This patch removes the shortcut in oml_rx_chg_adm_state() which
immediately called oml_mo_statechg_ack(mo).

Ticket: OW#1132
Sponsored-by: On-Waves ehf
2014-04-03 12:46:03 +02:00
Holger Hans Peter Freyther a276b98236 oml: Indicate the kind of object passed as the void*
These routines do not pass the gsm_abis_mo and parsing the FOM
header of the msg does not seem to be a good idea either. Pass
in the OML object so that the model code can determine what the
void pointer is.
2014-03-26 18:01:55 +01:00
Andreas Eversberg 8ade45e795 handover: Set basic values for handover, remember the activation reason
Introduce the handover.h/handover.c and initialize handover parameters
in OML and remember the activation through RSL.
2014-03-10 13:38:07 +01:00
Harald Welte 8196de46ad common/oml.c: Send OML NACK if bts_model_check_oml() returns negative
This way, bts_model_check_oml() can return a negated NM_NACK_* constant
which will then be sent as cause value in the corresponding
SET_ATTR_NACK back to the BSC.
2014-01-21 23:38:59 +01:00
Jacob Erlbeck 08571b1588 sysmobts: Do a RF mute when Radio Carrier is locked
Currently a Change Administrative State Request is just applied
unconditionally to the object's state object and then acknowledged.

This patch implements the special handling of setting the Radio
Carriers state to LOCK or UNLOCK. This is done by passing the
appropriate mute command to the L1 layer. Always all radio channels
are affected, it is not possible to lock single radio channels.
On success, an ACK is sent back to the bsc with the new state (based
on the state passed in the callback by the L1 layer). If something
went wrong or the firmware doesn't support RF mute, a NACK
(REQ_NOT_GRANTED) is sent instead.

Note that a NACK for such a request hasn't been sent by the BTS to
the BSC yet, so (albeit it's spec conformant to do so) the BSC must
be prepared to handle this correctly.

Ticket: OW#976
Sponsored-by: On-Waves ehf
2013-11-05 15:46:30 +01:00
Harald Welte 359fb8caf4 abis: Use OML remote (BSC) address if RSL CONNECT contains no IP
This introduces a new get_signlink_remote_ip() function whcih we also
use in the RSL code to determine the RTP remote address if the CRCX/MDCX
contains no remote IP address IE.
2013-10-06 15:50:36 +02:00
Harald Welte 6d5dc060ea migrate away from our own abis.c code to libosmoabis
libosmoabis has a BTS-side implementation of the IPA protocol for years,
and osmo-bts should have used that all the time.  Unfortunately it had
its own local hack, this patch is migrating to the libosmocore
implementation.
2013-10-06 15:50:36 +02:00
Holger Hans Peter Freyther 95c6eed436 oml: Remove the unused nofh variable from oml_mo_tx_sw_act_rep
The variable was assigned but nothing was done with it, just
remove it for now.

Fixes: Coverity CID 1040758
2013-07-16 18:36:44 +02:00
Harald Welte 6404a76661 make oml_mo_state_init() a void function
... so we don't get warnings about not returning anything
2013-06-30 15:29:26 +02:00
Harald Welte 48eca2524c Don't send OML STATE CHANGE before OML is connected
Instead of calling oml_mo_state_chg() [which transmits OML STATE CHG]
during bts_init(), we use a new oml_mo_state_init() function which
simply sets the state.
2013-06-30 15:09:35 +02:00
Andreas Eversberg 54dd949e62 Fix: Stop RADIO LINK TIMEOUT couter S from counting, if it has reached 0
In case that the counter S reached 0, it will stay 0. Subsequent received
good and bad SACCH frames must not cause to trigger radio link failure
again. Once the BSC has been indicated about link failure, it will release
channel.

The counting of S has been moved to a seperate function.

This patch will ensure that the link failure is indicated only once. But
even if the link failure would be sent multiple times, the BSC should
ignore it. The BSC releases the channel and may only reuse it after confirm
from BTS. (There cannot be any link failure indications after confirm of
channel release.)

The allowed timeout value range is 4..64, as defined in TS 05.08, so if the
BSC sends an attribute with value out of range or other failure criterion,
the Set BTS Attributes message is NACKed.
2013-03-15 21:41:27 +01:00
Harald Welte 620be0bbed OML: fix broken curly braces while parsing SET BTS ATTR
Looking at the problem, it's a surprise that the old code was working at
all...  (Thanks to jolly for pointing this out)
2013-03-14 11:20:09 +01:00