Commit Graph

99 Commits

Author SHA1 Message Date
Harald Welte a240bdd0a4 OML: Ensure minimum required attributes are set before accepting OPSTART
There are some vital configuration bits such as ARFCN, BSIC, channel
config, .. for which there are no reasonable defaults.  As a result,
the BSC must set those attributes before issuing OPSTART.

Prior to this patch we would blindly accept OPSTART and then transmit
on ARFCN 0, which is definitely not the intended behavior.

Closes: OS#3789
Change-Id: I3a818f8eceb6abef1b20d2b3892a749dbc9e4b05
2019-02-23 15:59:18 +01:00
Harald Welte 5eddf98dfc OML: Store merged attributes of IPA OML Managed Objects
For the TS 12.21 standard OML attributes, we store a copy of the
most-recently set value for each attribute in "mo->nm_attr".  This
somehow was missed when adding support for the IPA specific MOs like
those relevant for GPRS.

Change-Id: I75ebda46da9c1fcecc484311bf3833f31c536ee1
2019-02-23 15:59:10 +01:00
Harald Welte 3933e930c3 OML: Work around OsmoBSC sending "GET ATTRIBUTES" with short length
OsmoBSC used to have a bug in encoding the "GET ATTRIBUTES" OML message,
resulting in the actual message length being three bytes longer than the
encoded length value.

As in Ib98f0d7c2cff9172714ed18667c02564540d65d7 we have introduced
proper consistency checks on length values, all "GET ATTRIBUTES" from
OsmoBSC version suntil today will fail.  This patch introduces a
work-around to remain compatible with old OsmoBSC while still keeping
the consistency checks for all other messages.

Change-Id: Ifa24e9e2c71feb2c597557807d675438c2825b2d
Related: OS#3799
2019-02-12 20:29:50 +01:00
Harald Welte 906357c5e2 OML: Properly reject short messages and truncate over-long messages
For OML, what matters is the length indicated in the OML message header.

If we don't have sufficient bytes, reject the message and send a failure
event report.

If we have more bytes, truncate the message at the number of bytes
indicated in the OML length header.

Change-Id: Ib98f0d7c2cff9172714ed18667c02564540d65d7
2019-02-12 20:28:49 +01:00
Harald Welte e160ac6ea5 OML: Reject segmented OML messages
TS 12.21 describes segmenting of OML messages using placement
fist/middle/last and the "sequence' number of the OML header. We don't
implement this and hence must ignore or reject any related messages.

Before this patch however, we simply treated such segments as if they
were a complete OML message.  Let's fix that.

Change-Id: Idd42cf4edc1bf9ab366853bd9b0f7afd9c060910
Closes: OS#3795
2019-02-12 20:08:56 +01:00
Harald Welte 96bded3ebd OML: Use 'const struct abis_oml_mo *' whenever users only read
Try to constrain the code a bit further by making all read-only
accesses use 'const *'.

Change-Id: I5a61e6d1b4e5e083bb24017166186dc87d035cd0
2019-02-12 20:08:18 +01:00
Harald Welte ccc7ba17c0 OML: Report short messages even for invalid TRX numbers in down_fom()
Change-Id: I65b57d3fc714814db3ae3fd34398f307413fece8
2019-02-12 20:08:18 +01:00
Harald Welte 055c29bc6b OML: Reduce code duplication in down_mom/down_fom
Simply use a "mo" variable on the stack rather than having duplicate
but otherwise identical calls to oml_tx_failure_event_rep()

Change-Id: Ibe6c79e95405b13d041047549d2ffa39aa355eb2
2019-02-12 20:08:18 +01:00
Harald Welte e57a62deee OML: send proper OML alerts in case of errors
Change-Id: I5b19b82a4874617c7c584cf3eac55eb9c756710a
2019-02-12 20:08:08 +01:00
Harald Welte 268ba55a6e OML: remove double-logging on oml_tx_failure_event_rep()
When we send an OML failure event report using
oml_tx_failure_event_rep(), the function itself will not only send
the report to the BSC but also log it.  So there's no need to both
have an explicit LOGP() and a call to oml_tx_failure_event_rep().

Change-Id: Ib3fd06b3266d896aebeed4ebe42ac71ff173bb5c
2019-02-09 09:08:27 +01:00
Harald Welte 742dad5b69 OML: Don't overwrite MO instance before oml_tx_failure_event_rep()
In Change-Id Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e we introduced
several additional calls to oml_tx_failure_event_rep() during OML
messaeg processing.  However, for some reason, we *overwrite* the
bts_nt/trx_nr/ts_nr of the TRX MO.  This is clearly wrong.  The
"address" of a managed object doesn't change at runtime!

Change-Id: Idfb80ccd6dd485d52dc006867fae3dde3fb005f3
2019-02-09 09:08:27 +01:00
Harald Welte 893e499e0c OML: Return attributes in ACK/NACK messages
As per 3GPP TS 12.21 Section 8.2 "ACK messages shall return all the
attributes in the original message". OsmoBTS fails to do so but simply
sends no attributes at all in the ACK.

TS 12.21 is a bit vague whether or not the attributes shall also be
achoed in the NACK.  Let's do it and append the CAUSE in this case.

Closes: OS#3788
Change-Id: Ifb305fe75f8305bb04872f26492b8b1bb8c27f49
2019-02-09 09:08:22 +01:00
Harald Welte 3c89e2c36a OML: some more comments on what functions do
Change-Id: I5f30f6c556968fab60283ff1948966af28dc6e83
2019-02-08 22:09:29 +01:00
Neels Hofmeyr 2f54c5f297 add/improve various logging around dyn ts
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-08 22:14:54 +02:00
Stefan Sperling 8799619d27 send a State Changed Event Report when rf is locked/unlocked
Make osmo-bts send a State Changed Event Report when RF is locked
or unlocked. This behaviour isn't mentioned in the spec as far as
we know, but an ipaccess nanobts also produces these messages.

Change-Id: I37e44ef4881c41f8835428b610e7863f37397c9f
Related: OS#3161
2018-05-07 16:44:39 +02:00
Stefan Sperling 4ad781412e return NACK codes instead of errno values from oml_tx_attr_resp()
The caller translates errno values back into NACK codes anyway,
so lets's return NACK codes directly.

Change-Id: I2b1f79e66c778139d64101c89dd6377921807e2d
Related: OS#2295
2018-04-23 08:59:42 +00:00
Stefan Sperling 5a8c0b2b5d cosmetic: fix typos in src/common/oml.c
Change-Id: I6789421497182e957341b01a37a2d9b8d367adf9
Related: OS#2295
2018-04-19 18:44:04 +02:00
Stefan Sperling 12ee1e12b3 respond with NACK for non-hopping BTS with multiple ARFCN
In addition to logging an error, send a NACK if the BSC attempts
to set more than one ARFCN in Radio Carrier Attributes for a BTS
which does not support frequency hopping.

Change-Id: Ia72e23a3f08f825cf9cf0d9a55302d13cfed51d6
Related: OS#2295
2018-04-19 15:46:30 +02:00
Harald Welte caeef44699 fix inverted logic bug in omldummy patch
Change-Id: Ic2e7e78f922cb9634217f03482153950c90848a1
2018-03-17 16:40:57 +01:00
Harald Welte 553535f87b Add 'osmo-bts-omldummy' to bring up only OML without RSL
This is used only in integration testing, where in the TTCN-3 testsuite
we currently have no A-bis OML implementation, but only a RSL one.

Change-Id: Id8e5f34091e6e32621d8c8673de7ea848dfd252f
2018-03-17 15:22:51 +01:00
Harald Welte d8cd756da4 Get rid of 'struct gsm_bts_role_bts'
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-17 13:40:03 +01:00
Harald Welte 5cef5056ff gsm_data_shared: Remove unused definitions/members/functions
What we remove here is a legacy from sharing this header file with
openbsc/osmo-bsc-sccplite, which we stopped to do quite some time ago
and hence can remove those parts that are only relevant to the BSC but
not to the BTS.

Change-Id: Icac1656da68f6a006a28c779e3b563bbdd905b3d
2018-03-17 12:24:26 +01:00
Harald Welte 6e92255cc7 load_indication: Fix start of load indication timer
Starting the timer in bts_init() may result in it expiring already
before the load indication period is set via OML.   Let's make
load_timer_start() safe to call several times and call it from OML
code.

Change-Id: I295d91413542014aa2507d5f09e01243fc3916fa
Fixes: OS#2991
2018-02-24 04:14:03 +01:00
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