Commit Graph

1552 Commits

Author SHA1 Message Date
Philipp Maier 40c05f07f4 fix nullpointer deref in rsl_tx_mode_modif_nack()
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-26 12:42:10 +01:00
Philipp Maier 7d62629ca2 rsl: fix double-free in rsl_rx_mode_modif()
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
2018-01-26 12:42:04 +01:00
Alexander Huemer 75d0fcdfcd gitignore: add missing entries
Change-Id: I509e564a82b6632c0cdf052526e9f7f3397155ce
2018-01-25 01:48:55 +01:00
Alexander Huemer 0e176264f4 various Makefile.am: add missing CFLAGS
Change-Id: I0717aaaf062a7c3c8b35520fa837b51fd6aed47f
2018-01-25 01:44:51 +01:00
Alexander Huemer d6d4b50911 cosmetic: Makefile.am whitespace
Change-Id: I480fbf85912de2ea3518a906b9edf23b1485e936
2018-01-25 01:39:06 +01:00
Max 5675afa6b9 Enable sanitize for CI tests
Change-Id: I3e2e1fb777a7cbf74e2f7c4288ed5f3277c7faed
2018-01-24 12:36:45 +00:00
Max cedad415fc CI: drop unused OsmoPCU dependency
The independent copy of pcuif_proto.h file is used by OsmoBTS so we
don't have to checkout OsmoPCU to obtain it.

Change-Id: If8d7330adf3edc44c3b49b1f6e854cce0eca2d8e
2018-01-24 13:27:24 +01:00
Max e5b613d29b sysmobts: move header check to appropriate place
Move the header check specific to sysmoBTS 2050 next to generic sysmoBTS
header check.

Change-Id: I165c373b58146658a5a69a2d7222d60cff4db79a
2018-01-22 11:24:44 +01:00
Max 2d1f53439b sysmobts: remove weird default header location
The sysmoBTS-specific headers were never looked for in the current
directory. None of the CI tests use it as well. None of the other BTS
models use such defaults. Let's just drop this to restore expected
header location semantics.

Change-Id: I0b2906e284e1e22a960c4f0f1f38724de009eda5
2018-01-21 23:34:34 +01:00
Max 71506d70d7 Move -I inside *INCDIR variable
Previouslywe could end-up passing empty '-I' to compilerif corresponding
_INCDIR variable was not defined during the ./configure step. This is
apparently tolerated by gcc but still seems like a wrong thingto
do. Let's fix this by moving -I inside of *_INCDIR.

Change-Id: I80915e5756d1bf64d789cfd5341fdd417ca8eed9
2018-01-21 23:16:17 +01:00
Max d11e8cf341 sysmobts: use proper includes for sbts2050 test
When testing for sbts2050_header.h during ./configure stage, use proper
include path defined earlier.

Change-Id: I55e50f612ab2a082b34096d71359dd08da150cf1
2018-01-21 23:16:10 +01:00
Max f5a810d6f7 Remove unneeded LIBOSMOCORE_CFLAGS from tests
When testing for the presence of particular BTS model-specific header
during ./configure step, we don't need to add LIBOSMOCORE_CFLAGS because
none of those headers use it for compilation. Moreover, adding it might
hide the problem if the headers under check are available in the same
location where libosmocore headers were checked out.

Change-Id: I64bf1acb9db999567e8a2a6690cfc96d6e4b7ee1
2018-01-21 22:50:10 +01:00
Pau Espin e95ad79d6c bts-trx: Detect duplicated responses for retransmitted commands
It was detected that under some conditions, osmo-trx (with limesdr)
may take a long time to answer to CMDs, which means trx_ctrl_timer will
trigger re-transmitting the last sent but yet unacked CMD. Due to the
high latency in osmo-trx, the original AND the rentrasnmited CMD are
handled after a while and RSP messages are sent for both. When
osmo-bts-trx receives the first RSP, it was marking the CMD as acked and
carried on with next one. Then, when the RSP from the retransmited CMD
arrives, it already lost state and doesn't know where does that come
from. As a result, osmo-bts-trx shutdowns.

The issue can be seen in the following truncated log from osmo-bts-trx
with TRX category enabled:
20180117135228175 Enqueuing TRX control command 'CMD RXTUNE 1782000'
20180117135228175 Enqueuing TRX control command 'CMD TXTUNE 1877000'
20180117135228175 Enqueuing TRX control command 'CMD SETTSC 7'
20180117135228175 Enqueuing TRX control command 'CMD POWERON'
20180117135228175 Enqueuing TRX control command 'CMD SETRXGAIN 1'
20180117135228175 Enqueuing TRX control command 'CMD SETPOWER 20'
20180117135228175 Enqueuing TRX control command 'CMD SETSLOT 0 5'
...
20180117135249829 Response message: 'RSP POWEROFF 0'
20180117135249855 Response message: 'RSP RXTUNE 0 1782000'
20180117135249876 Response message: 'RSP TXTUNE 0 1877000'
20180117135249876 Response message: 'RSP SETTSC 0 7'
20180117135250648 Response message: 'RSP POWERON 0'
20180117135251150 Response message: 'RSP SETRXGAIN 0 0'
20180117135253151 No response from transceiver for phy0.0 (CMD SETPOWER 20)
20180117135253777 Response message: 'RSP SETPOWER 0 20'
20180117135254535 Clock indication: fn=2018878
20180117135255777 No response from transceiver for phy0.0 (CMD SETSLOT 0 5)
...
20180117135256858 Response message: 'RSP SETPOWER 0 20'
20180117135256858 Discarding duplicated RSP from old CMD 'RSP SETPOWER 0 20'
20180117135256858 Response message: 'RSP SETSLOT 0 0 5'
20180117135256858 Response message: 'RSP SETSLOT 0 0 5'
20180117135256858 Discarding duplicated RSP from old CMD 'RSP SETSLOT 0 0 5'

Change-Id: I3633cba212edde878f83ed36aef922aaca6f503a
2018-01-19 15:41:19 +01:00
Pau Espin 8c1d157643 bts-trx: trx_if.c: Improve parsing of received RSP messages from TRX
First the cached CMD sent (struct trx_ctrl_msg) is reworked to have the
cmdname and the params in different buffers for easier comparison with
RSP later.

For the receive path (trx_ctrl_read_cb), new function helpers are added
to parse the buffer into cmdname+params+code (parse_rsp) and to compare
if a given RSP matches the current CMD we sent (cmd_matches_rsp).

The reasoning behind this patch is that a way to check for parameters
when receiving a RSP will be needed in future work, as before this patch
checking of parameters is ignored. This commit is a preparation for commit
to check for duplicated responses.

Change-Id: I2474cbc3e4457cf04f78e1c168768295e1132034
2018-01-19 15:41:19 +01:00
Pau Espin 1f80e9815f bts-trx: trx_if.c: trx_ctrl_read_cb: Move error handling to end of func
The move includes a small logic change: If there's a mismatch between
the rsp and the cmd, now we bts_shutdown instead of blindly skipping
expected RSP and continuing with sending the next CMD in the queue. The
change is specially not a problem since next patches are improving the
logic furthermore to account for duplicates, different parameters, etc.

Change-Id: I7018ded23fe51f364f248ade111aaa80ef46187e
2018-01-19 15:41:19 +01:00
Pau Espin 9a57c7bed4 bts-trx: trx_if.c: Log timedout+retransmitted CMD
Change-Id: Ib573c86a1640640c2a61e80fe1f1412b30342b1a
2018-01-19 15:41:19 +01:00
Max 63948b033d Enable optional static builds
The default (for both manual and .deb builds) is to use shared build (as
before) - the static build is entirely optional.

Change-Id: Iabdebefef5c07dd1cd4b94b29ca40c6be0f8adda
2018-01-19 14:32:32 +00:00
Neels Hofmeyr f37fcc9c7b fix build: tests/sysmobts: add missing -I$(SYSMOBTS_INCDIR)
Change-Id: I5427d614c6301b897ad32adbecd98ce5ebec6f66
2018-01-19 15:24:09 +01:00
Max e91723a967 fix build: tests/misc: missing libosmo-abis and -trau flags
Add missing LIBOSMOABIS_CFLAGS and LIBOSMOTRAU_CFLAGS.
Pair the _LIBS below the _CFLAGS in LDADD above (cosmetic).

Fixes the stow-enabled jenkins builds are currently failing like below:

In file included from ../../include/osmo-bts/gsm_data.h:136:0,
                 from ../../include/osmo-bts/bts.h:4,
                 from misc_test.c:23:
../../include/osmo-bts/gsm_data_shared.h:21:35: fatal error: osmocom/abis/e1_input.h: No such file or directory
 #include <osmocom/abis/e1_input.h>

Change-Id: I94ea8bad8b410550f72ee6a0408f42f6bd8b6cac
2018-01-19 15:22:57 +01:00
Max e81347f216 Allow specifying sysmocom headers explicitly
Add configure option --with-sysmobts=$INCDIR (like for LC1.5).

Use to fix the jenkins build to fix the build after migration to stow, where we
can no longer use a commin -I to include the sysmobts headers as well.

Tweaked-by: neels
Change-Id: I0416a9f4c428189cd9c3909c8bd016ca2908128a
2018-01-19 15:06:15 +01:00
Neels Hofmeyr d1f0a7e927 jenkins_common.sh: fix build_bts distcheck for more than one conf_flag
Passing configure flags in DISTCHECK_CONFIGURE_FLAGS requires enclosing all
flags in quotes. Currently we seem to have no callers with more than one
configure flag, so we were lucky not to break there.

Change-Id: I37bc517a30d00c744eddc8565a0a8181cb3b2cdb
2018-01-18 00:18:57 +01:00
Max bef6eae05b Move sysmobts-calib into osmo-bts-sysmo
It's prerequisite for jenkins tests fix after migration to stow. The
sysmobts-calib uses hand-coded Makefile instead of automake which makes
it hard to properly propagate build flags. Also, make it optional to
enable excluding it from certain jenkins tests.

Change-Id: I3b54bfa5ef1d89092f6cf13dc27de10874b31b18
2018-01-16 15:53:00 +01:00
Philipp Maier 5df57cb84c meas_test: fix header file references
The unittest module meas_test.c contains a lot of unused header
files as the result of a cut and paste error made earlier. Also
the reference to stdio.h is missing.

remove all header file references that are not needed.

add missing header reference to stdio.h

Change-Id: I167be096ed25a86b1114de1ada955822a0b42856
2018-01-10 11:10:28 +00: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 f28b660666 Print FN delta on L1 errors
Change-Id: Ieb99c970eafb25b504c2b85221fb12d5a3c39789
2018-01-08 13:48:01 +01:00
Max 1adfc52a72 Remove BSC-specific parts
The dead code is from before repo-split time.

Change-Id: I9d4ee8d55a4096bf47407c7d2bdbf3063bf1666e
2018-01-05 10:06:44 +00:00
Max 667b0f1fe5 Use existing function to obtain TSC
Change-Id: I209f26b527a41b3b6f8e405f2a21b3d4bc4746fb
2018-01-04 11:47:33 +01:00
Max a11d8e95ee Add --enable-sanitize configure option
Change-Id: I4e31e20ef2361c8f251f3ab04a0ac86e23d2e8a1
2017-12-21 17:29:53 +01:00
Philipp Maier 0bac3efc17 octphy: l1_oml: check returncode of trx_by_l1h()
The function trx_by_l1h() is used to fetch the pointer to a an
osmo_bts_trx from a list. The ID that is used to reference the
transceiver comes from the incoming message. If the firmware
sends odd identifiers (firmware bugs, damaged packets) the
transceiver can not be found in the list and a nullpointer is
returned, which then leads into a nullpointer derefernece
problem.

Check the returncode, and depending on the situation either
return with -EINVAL or exit osmo-bts immediately.

Change-Id: I04ef3b4896e1322c2a6d29ea86a88994c7748bf7
2017-12-20 15:54:25 +01:00
Pau Espin 3c96db29fa jenkins.sh: Disable building doxygen for deps
Change-Id: I2ed207a5febe8017a20a0e7de0ba575fd7966af6
2017-12-14 16:02:29 +01:00
Pau Espin 035fc9a134 debian/control: Remove uneeded dep libosmo-netif-dev
I didn't see any related libosmo-netif code dependency in the project.

Change-Id: I2da1935bcc3ce507cfb21419a1e340aa3361cd65
2017-12-14 16:01:13 +01:00
Philipp Maier 8f12047157 cosmetic: tests/agch: remove unused var "static_ilv"
remove unused const variable "static_ilv" from unit test "agch"

Change-Id: Ie724e2e5875020aa835b4cd57ab96966aee283e1
2017-12-11 12:57:17 +00:00
Philipp Maier 4a43618332 cosmetic: tests/power: remove unused var "ret"
remove unused variable "ret" in unit test "power"

Change-Id: Ied484e3e2d3006eb0f03516ceaed3e0e802d51e4
2017-12-11 12:57:17 +00:00
Pau Espin 4848c2c445 Fix malformed Resource Indication packet
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
2017-12-11 13:28:34 +01:00
Philipp Maier 33942ed156 cosmetic: tests/Makefile.am: remove excess whitespace
Change-Id: I7090d46ae72183014e6c74d6ddb240af8d66e0b4
2017-12-10 22:12:35 +01:00
Pau Espin 4b4c2ec4b3 bts-trx: Avoid enqueueing consecutive duplicate messages to TRX
While debugging other protocol/timing issues between osmobts-trx and osmo-trx,
I found that sometimes two consecutives "POWER OFF" commands are
enqueued and sent to osmo-trx.
There's no point in doing so, as the write queue already maintains state
and retries the command until a RSP is received, then goes for the next
one.

With this change we hence improve timing response as we don't need to
wait for the second command to be processed, and on top we get cleaner
logs and simplified states which are easier to debug.

Change-Id: Ib6a5e7bfac8bc5e1b372da6a1f801c07a3d5ebb7
2017-12-10 14:05:57 +00:00
Pau Espin 62b575db67 bts-trx: trx_ctrl_cmd: Simplify var assignment logic
Change-Id: I9250e3003cff24035440bbba3e1171650dc83209
2017-12-10 14:05:36 +00:00
Philipp Maier 28cb32a74b cosmetic: meas_test: fix section comment
Change-Id: Id228620ccf5a40c8089ae1914d59b19e808ea151
2017-12-07 12:59:17 +00:00
Max 6f9d76e66c Log filenames on L1 errors
Change-Id: I7e73374f3f1da662ebed52548d29b6b76443c81b
2017-12-05 16:40:36 +00:00
Harald Welte 5b70bb673d DTX: avoid illegal character contained in DTX FSM allocation which causes BTS crash
Problem:

 lchan->tch.dtx.dl_amr_fsm struct failed to allocate in l1sap_chan_act routine
 in l1sap.c due to illegal characters contained in lchan->name which are passed to
 osmo_fsm_inst_alloc routine. As a result, lchan->tch.dtx.dl_amr_fsm is NULL
 causing BTS crashed (SEG FAULT) when trying to access this struct.

 Below is snapshot of crash log obtained by GDB:
 ...
 Fri Nov 24 18:13:55 2017 <0000> rsl.c:1653 payload type: 98
 Fri Nov 24 18:13:55 2017 <0000> rsl.c:1463 (bts=0,trx=0,ts=2,ss=0)
 RSL Tx IPAC_MDCX_ACK (local 127.0.0.1:11538, remote 127.0.0.1:30012)
 Program received signal SIGSEGV, Segmentation fault.
 0x00031930 in dtx_dl_amr_fsm_step (lchan=lchan@entry=0xb69592a8,
 rtp_pl=rtp_pl@entry=0x87ae8 " \024\351Y\363_\337\345\351f\177\373\300\210\201\200\210",
    rtp_pl_len=17, fn=1728481, l1_payload=0x10dd25 "", marker=marker@entry=true,
    len=len@entry=0x10ddc4 "\024", ft_out=0xbefff7d7 "\002",
    ft_out@entry=0xbefff7cf "\276\341_\032") at msg_utils.c:233
 233     msg_utils.c: No such file or directory.
 ...

Fix:
* Use different formatting for lchan name passed to osmo_fsm_inst_alloc routine
* Refuse channel activation if FSM could not be generated (as opposed to crash)

Related: OS#2606
Reported-by: Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com>
Change-Id: I929ce3703dc57acf8db569ae0e346265644d0b3c
2017-12-05 14:54:59 +00:00
Harald Welte 70c4dc8d70 osmo-bts-trx: Fix reported frame number during PRIM_INFO_MEAS
The upper layers (L1SAP, the common part of L1) *always* require frame
numbers in the uplink direction to be reported as the frame number of
the *first* burst, not the last burst of a given block.

This is particularly important in the case of passing up measurement
information, as we use this frame number to detect if the measurement
interval for that specific timeslot has just ended (and hence we must
process the measurements and send an uplink measurement report to the
BSC.

Before this patch, the measurement results were reported with the *last*
frame number, which caused the common/measurement.c code never detect
the end of a measurement window.

On TS2, tons of the following log messages were observed:
<0004> measurement.c:199 (bts=0,trx=0,ts=2,ss=0) no space for uplink measurement, num_ul_meas=104

With this patch, it behves as expected:  the measurements of 25 blocks
(= 100 bursts) are aggregated, after which point the report is computed
and sent.  Subsequently, num_ul_meas is reset to 0 and the cycle
restarts.

Related: OS#2329
Change-Id: I1065ae9c400bb5240a63ab8213aee59aeb9ceeff
2017-12-04 13:25:34 +00:00
Harald Welte be4a208809 Put useful information in RTCP SDES.
The RTCP Sender Description is supposed to contain useful information
to identify the source of the RTP stream.  So far, it only contained
compile-time default data of libortp.  Let's put the BTS UnitID, the
lchan number and the OsmoBTS version in there.

This change requires libosmo-abis Change-Id Ice794f9e0c6caeea1c67520c12efbfa375d1fb82

Change-Id: Id6ce7188354d3a0517661c9648854ec829ef1cac
Related: OS#2701
2017-12-03 21:22:25 +00:00
Harald Welte 5112c45d22 rsl.c: Log RTP socket related errors as DRTP, not DRSL
The respective errors/events occur as a result of calling osmo_rtp_*
API, and are clearly more fitting into the DRTP category than the DRSL,
even though the respective actions are triggered by RSL.

Change-Id: I52e6f9865492a2f757a37860eb92a3dc49e174ef
2017-12-03 21:13:24 +00:00
Harald Welte a7bfb6c8da osmo-bts-octphy: Remove bogus warning about BS_AG_BLKS_RES
Contrary to osmo-bts-sysmo, the OCTPHY-2G does not have different L1
SAPI for AGCH and PCH.  It uses cOCTVC1_GSM_SAPI_ENUM_PCH_AGCH for both,
and we convert that to the cbits=0x12 (Downlink CCCH) on the L1SAP.

The code above L1SAP can hence freely decide if it wants to respond with
an AGCH or PCH message, based on its knowledge of BS_AG_BLKS_RES,
without the OCTPHY specific code having to do anything about it.

Hence, there's nothing to do, and the warning can be removed

Change-Id: Ic1038b8dc57bdaf05493cd8479355b960275ea41
Related: OS#1575
2017-12-03 10:01:54 +00:00
Harald Welte 57ce53d8aa measurment.c: Introduce INFO category for DMEAS logging
There's no point in either having full verbosity in DEBUG level
and not logging any measurement related information in INFO.  Let's
at least print the results at the end of each measurement period in INFO
level.

Change-Id: I2c870531478c05ce31cc1015597a068a4a76cf99
2017-12-02 21:06:06 +00:00
Harald Welte 6b264c5344 l1sap: Fix log subsystem: Use DRTP for RTP related bits, L1C for MPH
Change-Id: Icc0325f41a1d80535d33e123083e220ee47df129
2017-12-02 21:05:34 +01:00
Harald Welte cbcd3c5034 scheduler_trx: L1P is for PH (data), L1M for MPH (control)
Almost all log statements in scheduler_trx.c were using the wrong
logging subsystem.  Let's fix this.  Also, make it more obvious from
the log subsystem help text

Change-Id: I4312f8ab0414eb38db0d62f05c95ab961f500c14
2017-12-02 21:05:34 +01:00
Harald Welte 62a6a2680f scheduler: Harmonize log line format; Always print TS name + decoded FN
Change-Id: I5703b46c8a59fe00a3cdc063bcf72872980ec5e5
2017-12-02 21:05:34 +01:00
Harald Welte 41d471351f Comments on individual members of struct gsm_abis_mo
Change-Id: I8e005410080201746906b8a60e9f7957031d2e58
2017-12-02 21:05:34 +01:00
Harald Welte 478f2f7696 measurement.c: Fix various typos in comments
Change-Id: Ief208045664769406cd60a92a12c4b44988a98b4
2017-12-02 21:05:34 +01:00