aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/oml.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-07common/oml.c: fix: properly encode NM_ATT_SW_CONFIGVadim Yanitskiy1-6/+33
According to 3GPP TS 52.021, sections 9.4.61-62, 'SW Configuration' shall contain a list of 'SW Descriptions' related to the MO. In other words, all 'NM_ATT_SW_DESCR' blobs shall be encapsulated into a single NM_ATT_SW_CONFIG attribute. For some reason, they were not encapsulated properly, so OsmoBSC were unable to parse the 'SW Descriptions'. However, unlike OsmoBSC the old OpenBSC does not expect this encapsulation, thus after this change it will be unable to parse the 'SW Descriptions'. Change-Id: Id26104719891944f3e2151df362bd45bb057a9c5 Related: OS#3938
2019-05-07common/oml.c: refactor Get Attribute Response message generationVadim Yanitskiy1-67/+53
Instead of allocating two transitional buffers (one static, another dynamic), we can use the existing message buffer. Both handle_attrs_bts() and handle_attrs_trx() can put (append) the reported attributes, and push (prepend) non-reported ones as per 3GPP TS 52.021, 9.4.64 "Get Attribute Response Info". Change-Id: I349447a43bce360f59e0c6b435906c65167d158b
2019-05-05common/oml.c: fix broken debug print in down_mom()Vadim Yanitskiy1-2/+2
Change-Id: Ideac59946d50c6e06052a9590e02cfcfbf23d003
2019-05-05common/oml.c: use proper format specifier for uint16_tVadim Yanitskiy1-2/+1
Change-Id: I8f372a689b3c1cc2cf925654b2db44a0f4ee7603
2019-05-05common/oml.c: introduce and use both LOGPFOH and DEBUGPFOHVadim Yanitskiy1-51/+44
Change-Id: I9e9d6ccb88c9c9d35b2ce5778fa2580382704089
2019-04-19common/oml.c: fix total length calculation in cleanup_attr_msg()Vadim Yanitskiy1-1/+1
Both callers of cleanup_attr_msg(), i.e. handle_attrs_trx() and handle_attrs_bts(), always pass out_offset >= 1, so the length of the unsupported attributes counter is already accounted. Otherwise, both callers would copy an additional garbage byte from uninitialized memory. Discovered using Valgrind: DOML DEBUG oml.c:539 OC=BTS(01) INST=(ff,ff,ff) Rx GET ATTR DOML INFO oml.c:265 BTS Tx Get Attribute Response ==25467== Syscall param socketcall.sendto(msg) points to uninitialised byte(s) ==25467== at 0x623E0BD: send (send.c:27) ==25467== by 0x5685846: __handle_ts1_write (ipaccess.c:358) ==25467== by 0x5683F8B: ipa_client_write (ipa.c:79) ==25467== by 0x5683F8B: ipa_client_fd_cb (ipa.c:140) ==25467== by 0x5F1DC23: osmo_fd_disp_fds (select.c:223) ==25467== by 0x5F1DC23: osmo_select_main (select.c:263) ==25467== by 0x42980B: bts_main (main.c:354) ==25467== by 0x6160F44: (below main) (libc-start.c:287) ==25467== Address 0x7d83895 is 23,669 bytes inside a block of size 102,528 alloc'd ==25467== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==25467== by 0x589A6B4: talloc_pool (in /usr/lib/x86_64-linux-gnu/libtalloc.so.2.1.5) ==25467== by 0x5F1E28B: msgb_talloc_ctx_init (msgb.c:316) ==25467== by 0x4293D0: bts_main (main.c:234) ==25467== by 0x6160F44: (below main) (libc-start.c:287) ==25467== Uninitialised value was created by a stack allocation ==25467== at 0x415FE5: oml_tx_attr_resp (oml.c:259) ==25467== by 0x415FE5: oml_rx_get_attr (oml.c:561) ==25467== Change-Id: Ic7c2c4e54e9f99b60aaf70604044933978be945c Related: OS#3938
2019-04-19common/oml.c: use proper OML object for Get Attribute ResponseVadim Yanitskiy1-11/+20
It was noticed that the Get Attribute Response message always indicates BTS(00,ff,ff) as the addressed OML entity, even if e.g. Baseband Transceiver(00,00,ff) was requested by the BSC. Despite neither OsmoBSC nor OpenBSC does complain about this, such behaviour violates 3GPP TS 52.021. Let's fix this. Change-Id: Icb1ee75d4bf680deb6365288d8c2053816a12217 Related: OS#3938
2019-04-19common/oml.c: use proper NACK reason in oml_tx_attr_resp()Vadim Yanitskiy1-1/+1
Change-Id: I482caa0747f81da2979bfbdbd22bd6962af728cd
2019-04-19common/oml.c: constify argument 'trx' of handle_attrs_trx()Vadim Yanitskiy1-2/+2
Change-Id: Id476d492b3c1d0c728fca9eb0fb2254512bdef72
2019-04-01common/oml.c: fix: properly push abis_nm_ipa_magicVadim Yanitskiy1-3/+3
In oml_send_msg() we optionally push the A-bis IPA magic string ("com.ipaccess") to a given message buffer as LV (Length Value), including the terminating null byte ('\0'). There was a mix of both sizeof() and strlen() calls, and worse luck, memcpy() has been used in a wrong way, skipping the '\0': memcpy(dest, src, strlen(src)); In general, this is not critical because the headroom of a given message buffer would most likely be zero-initialized, so the '\0' is already there. However, msgb_push() gives no such guarantee. Let's use the libosmocore's TLV API (in particular, lv_put()), and stick to sizeof(), so the null byte will always be included. Change-Id: I0c7f8776d0caec40f9ed992db541f43b732e47ae Closes: OS#3022
2019-03-27oml: use oml_tx_failure_event_rep() instead of signals to SS_FAILPhilipp Maier1-12/+0
At some locations in the code a signal to SS_FAIL is dispatched in order to trigger the sending of an OML failure event report in oml.c. This is a bit overcomplicated for the task. Lets use oml_tx_failure_event_rep() to send the failure event reports and lets remove the signal handler for SS_FAIL. Change-Id: Ie4fce1273a19cc14f37ff6fc7582b2945c7e7c47 Related: OS#3843
2019-03-27oml: use oml_tx_failure_event_rep() instead of oml_fail_rep()Philipp Maier1-15/+0
The function oml_tx_failure_event_rep() replaces oml_fail_rep(), so lets use only oml_tx_failure_event_rep() and remove oml_fail_rep() Change-Id: I83c4fa9ebd519299fd54b37b5d95d6d7c1da24f6 Related: OS#3843
2019-03-18oml: make oml_tx_failure_event_rep() publicPhilipp Maier1-2/+2
The static function oml_tx_failure_event_rep() is a lot easier to use than the currently implemented signal scheme. Lets make it public so that we can quickly generate failure event reports. Change-Id: I9c4601840a06119f35cfe4da453fff3b293fe615 Related: OS#3823
2019-02-23OML: Store merged attributes of IPA OML Managed ObjectsHarald Welte1-2/+10
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-12OML: Work around OsmoBSC sending "GET ATTRIBUTES" with short lengthHarald Welte1-4/+11
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-12OML: Properly reject short messages and truncate over-long messagesHarald Welte1-0/+23
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-12OML: Reject segmented OML messagesHarald Welte1-1/+9
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-12OML: Use 'const struct abis_oml_mo *' whenever users only readHarald Welte1-14/+14
Try to constrain the code a bit further by making all read-only accesses use 'const *'. Change-Id: I5a61e6d1b4e5e083bb24017166186dc87d035cd0
2019-02-12OML: Report short messages even for invalid TRX numbers in down_fom()Harald Welte1-5/+3
Change-Id: I65b57d3fc714814db3ae3fd34398f307413fece8
2019-02-12OML: Reduce code duplication in down_mom/down_fomHarald Welte1-18/+10
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-12OML: send proper OML alerts in case of errorsHarald Welte1-9/+21
Change-Id: I5b19b82a4874617c7c584cf3eac55eb9c756710a
2019-02-09OML: remove double-logging on oml_tx_failure_event_rep()Harald Welte1-6/+0
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-09OML: Don't overwrite MO instance before oml_tx_failure_event_rep()Harald Welte1-11/+1
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-09OML: Return attributes in ACK/NACK messagesHarald Welte1-11/+8
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-08OML: some more comments on what functions doHarald Welte1-0/+6
Change-Id: I5f30f6c556968fab60283ff1948966af28dc6e83
2018-05-08add/improve various logging around dyn tsNeels Hofmeyr1-2/+6
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-07send a State Changed Event Report when rf is locked/unlockedStefan Sperling1-1/+10
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-04-23return NACK codes instead of errno values from oml_tx_attr_resp()Stefan Sperling1-14/+8
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-19cosmetic: fix typos in src/common/oml.cStefan Sperling1-4/+4
Change-Id: I6789421497182e957341b01a37a2d9b8d367adf9 Related: OS#2295
2018-04-19respond with NACK for non-hopping BTS with multiple ARFCNStefan Sperling1-2/+1
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-03-17fix inverted logic bug in omldummy patchHarald Welte1-1/+1
Change-Id: Ic2e7e78f922cb9634217f03482153950c90848a1
2018-03-17Add 'osmo-bts-omldummy' to bring up only OML without RSLHarald Welte1-3/+6
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-17Get rid of 'struct gsm_bts_role_bts'Harald Welte1-31/+29
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-17gsm_data_shared: Remove unused definitions/members/functionsHarald Welte1-1/+1
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-02-24load_indication: Fix start of load indication timerHarald Welte1-1/+3
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-07Add helper to get BCC from BSICMax1-1/+1
Change-Id: Ib539a8739d53ab60d8fadffcef38152b82a28498 Related: OS#1854
2018-01-08oml.c: Fix use of htons instead of ntohsPau Espin Pedrol1-1/+1
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
2017-10-23Fix race condition in attribute reportingMax1-2/+11
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-09-11OML: print actual type of report sent to BSCMax1-1/+1
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-08-22OML: use fom_hdr while handling attr. requestMax1-7/+9
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-06-22OML: move BTS number check into separate functionMax1-16/+34
* 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-18OML Add osmocom-specific way to deactivate radio link timeoutHarald Welte1-5/+15
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-15Set and report BTS featuresMax1-0/+9
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-15Extend Get Attribute responderMax1-43/+85
* detect if attributes are requested for BTS or TRX and act accordingly * report TRX phy version Change-Id: I9f72305bbf1ab74745bffac1bee9f539f5a6de32 Related: OS#1614
2017-05-29OML: fix Coverity-reported issuesMax1-2/+6
* CID 169803: Null pointer dereferences * CID 169802: Incorrect expression Change-Id: Ib3f91be97c8bf81a87681814bf81d3a5a9950e54 Related: OS#1614
2017-05-29Consistently check for minimum attribute/TLV length in RSL and OMLHarald Welte1-21/+21
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-27Implement basic Get Attribute responderMax1-0/+132
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-08Signal to BSC when PCU disconnectsMax1-1/+4
While at it - do not serialize NULL as a string when delivering OML Failure Report. Change-Id: I41a731bd719aee0bbb98d3236405fb3a7f3ddec0 Related: OS#1615
2017-02-20oml: Fix incorrect usage of const variable abis_nm_att_tlvdef_ipaIvan Kluchnikov1-2/+5
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-01-25OML: internalize failure reportingMax1-26/+61
* 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