Commit Graph

7556 Commits

Author SHA1 Message Date
Vadim Yanitskiy 86f5cdd26a abis_nm: LOGPFOH()/DEBUGPFOH(): remove redundant context info
Change-Id: I3531a0da3c64aea8bf4df5ffa1d8768f7e70c87b
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 35f4212e58 abis_nm: fix msgb memleak in _abis_nm_sendmsg()
Change-Id: I8e9c5d32e9bc43c760cb71efb8cab4982a305f0e
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 5715237911 abis_nm: fix erroneous use of LOGPC() instead of LOGP()
Change-Id: I8b6f791e423d1f7fcdabcaaaab48fc9586c1dc7b
2020-09-15 20:42:17 +00:00
Alexander Couzens 380831e678 gsm 04.08: correct calculate the Cell Selection Indicator after release of all TCH and SDCCH
When the measurement bandwidth was added the calculation of the maximum
length wasn't increased.

Fixes: 27a887f666 ("gsm 04.08: encode the LTE neighbors measurement bandwindth in Channel Release")
Change-Id: Ic8132fd988140c34b8e0fd8349f4518fcbaecc31
2020-09-15 11:47:11 +02:00
Philipp Maier f150c25615 bsc_vty: improve manual activation of lchans (debug / labtest)
The VTY already has a method available to activate lchans manually,
however, this method does not support proper activation of signalling
channels. Also additional commands to activate multiple lchans at once
are helpful to make labtesting simpler and more efficient.

Change-Id: I66b874736c8c456eb82ccc26d5209987d8ed706c
Related: SYS#4910
2020-09-14 13:06:47 +02:00
Vadim Yanitskiy 68f1025273 vty: clarify NM state owner printed by 'show trx N' command
Change-Id: Ib17d1e98cfa1f293cf76cd9614722b6dec538960
2020-09-11 20:27:20 +07:00
Philipp Maier fcc5ffb96d abis_rsl: fix memleak in rach dos reduction function
The function reduce_rach_dos() only removes the tossed channel requests
from the list, but does not free them.

Change-Id: I0a62fc897c07e118dd637b156b6f2822c44db731
Related: OS#4549
2020-09-11 14:47:26 +02:00
Philipp Maier 3c6e86adce abis_rsl: inform user when expired channel requests get tossed
At the moment expired channel requests are dropped silently, however, it
might help to know when this happens - not only for debugging.

Change-Id: Ib49df551a4cd7d5652e85c8ce29ef132385d4ae4
Related: OS#4549
2020-09-11 14:38:54 +02:00
Philipp Maier 1482ec4813 abis_rsl.c: flush channel request queue on RSL bootstrap
When RSL link is bootstrapped the BSC should clear the channel request
queue.

Change-Id: Iefb333817033e8d376184b58d89b186d875b968f
Related: OS#4549
2020-09-11 14:38:54 +02:00
Alexander Couzens 27a887f666 gsm 04.08: encode the LTE neighbors measurement bandwindth in Channel Release
Encoding missing measurement bandwidth of LTE neighbors in Channel Release
(Cell selection indicator after release of all TCH and SDCCH value part).
The measurement bandwidth was encoded in the neighbors description transmitted in
SI2quater while missing in the Channel Release which would overwrite the
SI2quater measurement bandwidth.

Change-Id: I4847d840ba9d5ac56bd00e4f405dc47792008c0d
2020-09-10 20:23:11 +02:00
Alexander Couzens cdfd687af4 gsm_data: always set spare bits in channel description
The spare bits were never encoded even when the spec says it must be 00.
Most caller of _chan_desc_fill_tail() initialized the struct with memset(),
but not all.
The SI4 did not initialize it.

Change-Id: Ib03d6d2cdadc49e49aa94917d17f81ef3c83f11c
2020-09-10 08:43:58 +00:00
Vadim Yanitskiy 0098b5ce74 abis_om2000: check result of gsm_bts_trx_set_system_infos()
Ensure that osmo-bsc would not continue to work as usual, if for
some reason we cannot encode or send System Information messages.

Introduce transitional state OM2K_TRX_S_SEND_SI, from where we
can generate and send System Information messages.  Otherwise
it's confusing if we fail to do something when we're already
in state OM2K_TRX_S_DONE.

Change-Id: Ia6df539d0914c57ea80fdb29882832678b47f267
2020-09-09 11:29:06 +00:00
Pau Espin f087c1ebd4 lchan_rtp_fsm: Deferr IPACC MDCX after BTS side MGCP MDCX
This is needed to be able to force MGW to provide an IPv4 address during
MDCX, since IPACC protocol on the BTS side only supports IPv4, but one
may need IPv6 side at the same time on the core side.
By moving the IPACC MDCX request to a later step, the BSC gains
knowledge of the local address on each side (BTS, MGW), and if they
don't match (ie. BTS uses IPv4 and MGW uses IPv6), it can then get MGW
to offer an IPv4 address during MGCP MDCX containing the BTS IPv4
address. At that point, the MGW can see the mismatch and provide an IPv4
address in the MGCP MDCX ACK, which can then finally be communicated to
the BTS during IPACC MDCX phase.

Previous order:
BSC -> MGW: CRCX
BSC <- MGW: CRCX ACK		(get MGW local IP addr)
BSC -> BTS: IPACC CRCX
BSC <- BTS: IPACC CRCX ACK 	(get BTS local IP addr)
BSC -> BTS: IPACC MDCX 		(set MGW IP addr)
BSC <- BTS: IPACC MDCX ACK
BSC -> MGW: MDCX 		(set BTS IP addr)
BSC <- MGW: MDCX ACK

New order:
BSC -> MGW: CRCX
BSC <- MGW: CRCX ACK 		(get MGCP local IPv6 addr)
BSC -> BTS: IPACC CRCX
BSC <- BTS: IPACC CRCX ACK 	(get BTS local IPv4 addr)
BSC -> MGW: MDCX 		(set BTS IPv4 addr)
BSC <- MGW: MDCX ACK 		(here MGW changes its local addr to IPv4)
BSC -> BTS: IPACC MDCX 		(set MGW IPv4 addr)
BSC <- BTS: IPACC MDCX ACK

Change-Id: I4de5ea5c94c1482c9cb0b6386997a942edc60e32
2020-09-09 12:39:14 +02:00
Vadim Yanitskiy 422b751ac8 fix bootstrap_rsl(): check result of gsm_bts_trx_set_system_infos()
Ensure that osmo-bsc would not continue to work as usual, if for
some reason we cannot encode or send System Information messages.

Change-Id: I7d3458fb10760e33411f2074a6b2df1c257438d5
2020-09-08 20:19:18 +00:00
Vadim Yanitskiy ccf2017b28 vty: propagate result of gsm_bts_set_system_infos()
We should not return CMD_SUCCESS if this functions fails.

Change-Id: Id8a761593fe89cc07c2fb6e69558f44494537c47
2020-09-08 20:19:18 +00:00
Vadim Yanitskiy 2eda570b75 SI Type 4: prevent potential buffer overflow
Make sure that in generate_si4() we do not corrupt other SI buffers
by limiting maximum length of the Mobile Allocation to 2 octets.
This would preserve at least 2 octets for the Rest Octets, what
should be enough to encode at least GPRS Indicator.

Change-Id: I2e3553865096faecda6bb22fc25b83fd47b738c4
Related: SYS#4868, OS#4545
2020-09-08 20:19:18 +00:00
Pau Espin 16ca3faf84 Fix creating MGCP proxy socket if MGW listens on an IPv6 address
If for instance "mgw remote-ip ::1" is configured, the MGCP IPA proxy
socket towards the MGW will use ::1 as the destination address, but it
was being created as AF_INET. Let's use AF_UNSPEC instead and let
osmo_sock_init2 decide the best socket type to create.
Moreover, change the default local address from "0.0.0.0" to NULL to
also let osmo_sock_init2 pick an IPv6 address if necessary.

Change-Id: Ide88c7358a38702ef11c84145518794e75870ef8
2020-09-07 12:53:54 +00:00
Philipp Maier cc6d35d788 abis_rsl: prioritize emergency calls over regular calls
when an emergency call arrives while all TCH are busy, the BSC should
pick an arbitrary (preferably the longest lasting) call / lchan and
release it in favor of the incoming emergancy call.

The release of the existing call is a process that can not be done
synchronously while the ChanRQD is handled sonce multiple messages are
exchanged between BTS and MSC and multiple FSMs need to do their work.

To be able to release one lchan while handling a ChanRQD a queue is
implemented in which the incomming channel requests are collected. If
an emergency call is established while all channels are busy, an
arbitrary lchan is picked and freed. When freeing the lchan is done,
the queue is checked again and the emergency call is put on the free
lchan (TCH/H or TCH/F).

Change-Id: If8651265928797dbda9f528b544931dcfa4a0b36
Related: OS#4549
2020-09-07 12:44:41 +02:00
Vadim Yanitskiy e2b20c4aa8 generate_ma_for_ts(): fix: properly encode ARFCN 0 (corner case)
According to 3GPP TS 44.018, table 10.5.2.21.1 "Mobile Allocation
information element", in the cell allocation frequency list the
absolute RF channel numbers are placed in increasing order, except
that ARFCN 0, if included in the set, is put in the last position.

This basically means that the last bit of the Mobile Allocation
(MSB on the wire) corresponds to ARFCN 0, if it's included in
the cell allocation frequency list, or the last channel otherwise.

Recently introduced TTCN-3 test cases uncover the following problems:

  a) ARFCN 0 is encoded twice: as MSB and LSB of the bit-mask,
  b) ARFCN 0 is encoded one bit off its expected location.

Change-Id: I264a66a1405e72940a79e9e20ad6ad8f269a7bbc
Related: SYS#4868, OS#4545
2020-09-06 22:40:04 +07:00
Vadim Yanitskiy 31fab3e8de generate_ma_for_ts(): use OSMO_BYTES_FOR_BITS() macro
Change-Id: I119f930e9cb5d6e52d4b0e1160604c709d942a18
2020-09-06 14:48:11 +07:00
Philipp Maier 92eed41a99 lchan_fsm: make rsl mode-modify working again
osmo-nitb supports the modification of an lchan if the lchan is
compatible but in the wrong mode. This feature was dropped in the
transition to AoIP/bsc-split. However, osmo-bsc still has code to
generate and parse the messeages, but the FSMs do not support a mode
modify yetm

Lets add handling for mode-modify to the lchan_fsm and assignment_fsm in
order to support mode modify again

Change-Id: I2c5a283b1ee33745cc1fcfcc09a0f9382224e2eb
Related: OS#4549
2020-09-03 21:35:25 +02:00
Neels Hofmeyr 7e9ac64ba0 CBSP VTY: re-add legacy cbc config for backwards compat
In commit [1], I replaced the way the CBSP link is configured in the VTY. But
that configuration was already part of a release, hence I should only have
deprecated the old commands. Re-add the legacy config as deprecated.

Try to make the legacy commands take a similar effect as they previously would
be intended for, i.e. switching to server/client/disabled modes, and take
effect immediately when commands are read from telnet.

[1] 641f7f0845
    Icaa2775cc20a99227dabe38a775ff808b374cf98
    "CBSP: rewrite the CBSP link setup and 'cbc' VTY section"

Related: OS#4702
Change-Id: If6b742f28191b3f19ff1d87a217037a305133f4b
2020-09-03 15:04:29 +02:00
Neels Hofmeyr ca979b7857 CBSP: adjust manual to reflect new 'cbc' VTY config
Related: OS#4702
Change-Id: I101144dc4ebf151fa23d05743398aeea4a26834b
2020-09-03 14:34:49 +02:00
Vadim Yanitskiy 7630a29212 SI Type 4: fix missing CBCH Mobile Allocation IE
According to 3GPP TS 44.018, section 9.1.36.2, the CBCH Mobile
Allocation IE shall be present if CBCH Channel Description IE
indicates frequency hopping.  For some reason it was missing.

This change makes BSC_Tests.TC_fh_params_si4_cbch pass.

Change-Id: I8dce506a07d9d291b631b44fa2177c9deff6aa88
Related: SYS#4868, OS#4545
2020-09-03 10:57:44 +00:00
Vadim Yanitskiy 9ff1c3d650 gsm_04_08_rr: fix hopping parameters in RR Handover Command
A similar problem has already been fixed in [1]:

  - include GSM48_IE_MA_AFTER instead of GSM48_IE_MA_BEFORE,
  - fix position of the Mobile Allocation (after time) IE.

This problem was uncovered by (not yet merged) TTCN-3 test case
verifying handling of the hopping parameters [2].  This change
makes it pass.

[1] I43ef66c109b107ebcaa1cb6197637701b13b3787
[2] BSC_Tests.TC_fh_params_handover_cmd

Change-Id: I7569eead9760b6fd4bb91fc2d8d0b8200bebe374
Related: SYS#4868, OS#4545
2020-09-03 10:57:44 +00:00
Vadim Yanitskiy 94972dc877 vty: add a command to clear hopping ARFCN list
Change-Id: I05b0adc407a2808e5fdfac1cf9cd4dba67daa0f0
Related: SYS#4868, OS#4545
2020-09-03 10:57:44 +00:00
Neels Hofmeyr b26dd1ebf6 drop some unused members and function decls
Change-Id: I0de2c8a3ee6c693a5a321f0ea2a8a75fbe64a1c2
2020-09-03 01:07:15 +02:00
Pau Espin 75b3cba5fc Fail on invalid IP addresses passed to IPACC MDCX
IPACC protocol supports only IPv4 addresses, so make sure if an IPv6
address (or whatever malformed address) is caught is not sent without
noticing. Prior to this patch, faulty addresses would be sent over the
wire as 255.255.255.255 (-1 returned from inet_addr()).

Change-Id: Iee84e8b40cdede1cacd8e8a9e26dda0d85383ec8
2020-09-02 10:24:34 +00:00
Pau Espin 783960f4d9 vty: Hide show running-config ACC ramping params if not enabled
If the feature is not enabled there's no real use in displaying default
values for it.

Related: SYS#4912
Change-Id: I759eb0c31dd3c9b6f5f3d2bf57c6efc9ac5f74f1
2020-09-01 16:20:26 +02:00
Neels Hofmeyr d7e2be6b33 CBSP: fix link startup when enabled in config file
Restart the CBSP link from the VTY only from telnet sessions, not when reading
in the config file. When reading the config file, link startup might happen too
early and twice -- rather rely only on the CBSP startup invoked from main().

This is fixing a bug introduced recently in
"CBSP: rewrite the CBSP link setup and 'cbc' VTY section"
commit 641f7f0845
Change-Id Icaa2775cc20a99227dabe38a775ff808b374cf98

Change-Id: Ia0bb507c8468048789a446df09185ad8565c5ad8
2020-08-31 20:46:02 +00:00
Neels Hofmeyr 4d26688239 handover: fix detection for ambiguous HO neighbor ident
Adding rate counter checks to TC_ho_neighbor_config_1 (1.c) uncovers that the
test passes for the wrong reason. The ambiguous cell identification should be
the cause for the handover error, but the log shows that instead a handover is
attempted to BTS 3 which is not connected.

find_handover_target_cell() first tries to find a precise match of values, and
in a second pass applies wildcards like BSIC_ANY and
NEIGHBOR_IDENT_KEY_ANY_BTS. That second pass lacks detection of ambiguous
matches.

Use the same code for both passes, by encapsulating in a loop of two, which
first runs with exact_match == true and then false.

Proper detection of the ambiguous target cell identification in
TC_ho_neighbor_config_1() is shown by the resulting 'handover:error' count,
see I10bc0b67ca8dcf41dbb02332ed18017e819c2b32 (osmo-ttcn3-hacks).

Related: OS#4736
Related: I10bc0b67ca8dcf41dbb02332ed18017e819c2b32 (osmo-ttcn3-hacks)
Change-Id: Ib0087b6566ae4d82f8c3ef272c1256bcd1d08bf1
2020-08-31 18:01:17 +02:00
Neels Hofmeyr cd219d88f7 handover_fsm: signal Clear from gscon, for proper HO result counts
An inter-BSC-OUT handover ends with a Clear Command, which HO_OUT_ST_WAIT_CLEAR
waits for. Actually tell the handover_fsm.c about an incoming Clear Command, so
that the inter-BSC-OUT success can be counted.

Similarly, count failing handover results for an unexpected Clear Command from
the MSC.

Related: OS#4736
Change-Id: I0c489838a99f930e2104619ca745191d2a736f1b
2020-08-31 18:01:17 +02:00
Neels Hofmeyr 90f7c3c08d bssap: do not send a Clear Request after a Clear Command
During handover cleanup due to a Clear Command from the MSC, do not send
another Clear Request to the MSC. Only send that when no Clear Command was
received yet.

Add a flag rx_clear_command per gscon instance, indicating whether a Clear
Command was received, and exit early in gscon_bssmap_clear() when true.

This is part of patches fixing the rate counters around handover, which uncover
some bugs:
- Another patch enables proper handover result handling when receiving a Clear
  Command.
- After that, the handover_end() handling would always cause sending a Clear
  Request, even if a Clear Command was already received.
- This patch removes the extraneous Clear Request, for this scenario and for
  all other corner cases that might still exist.

Related: OS#4736
Change-Id: Iab82cac0a7ffa7d36338c8ff7c0618a813025f13
2020-08-31 18:01:17 +02:00
Neels Hofmeyr dbe59f69a4 add {BTS,BSC}_CTR_INTER_BSC_HO_OUT_FAILED for RR HO Failure
So far, during inter-BSC outgoing handover, when receiving an RR Handover
Failure from the MS, it would be counted as 'error'. Instead, add the 'failed'
counter like for all other HO types.

It may make sense to omit the 'failed' counter for inter-BSC *incoming*
handover, because then we won't receive an RR Handover Failure message. I
probably got those two mixed up during initial development.

Related: OS#4736
Change-Id: I9a61d5cc7273a830ba4e66e43e4aac6cdb707471
2020-08-31 18:01:17 +02:00
Neels Hofmeyr e6142d0e25 fix HO inter-BSC-IN target bts for counters
Related: OS#4736
Change-Id: Id38c69695c4ab93733571c0c288a2d5c10624ace
2020-08-31 18:01:17 +02:00
Neels Hofmeyr 01c06a9163 fix 'handover:*' counters: remove bogus increments
To handle cases of unknown handover type (like failure to find the target
cell), return -1 as counter code; treat -1 as skipping in ho_count_bsc() and
ho_count_bts().

The handover:* counters indicate overall counts, without knowing whether inter-
or intra-BSC, or whether the target ARFCN even exists. So they need to be
counted separately, and must not serve as fallback category in
result_counter_bsc() and result_counter_bts().

Related: OS#4736
Change-Id: Ie311e599d7bd35d33cf471c6c63e649246e8396a
2020-08-31 18:01:07 +02:00
Neels Hofmeyr c859ef646c fix 'handover:*' counters: add missing / move increments
Move initial 'handover:attempted' counts from bsc_subscr_conn_fsm.c to
handover_fsm.c, where all the other counters are handled.

Add missing increments for the overall 'handover:*' counts.

Related: OS#4736
Change-Id: I783bdedafc0eb8f2df9ea100792846fecc7ccbf7
2020-08-30 00:32:28 +00:00
Neels Hofmeyr 5a7d01792c ho counters: count invalid target cell as 'error', not 'no_channel'
Related: OS#4736
Change-Id: If6d6b7262536831ebb2b638efe521dd5a8153cdb
2020-08-30 00:19:42 +00:00
Neels Hofmeyr 8a3b507dea cosmetic: dissolve error-goto with single source in handover_start()
Change-Id: I9c7d10c36f3f868100c1aa2d0433ceed74161175
2020-08-30 00:02:14 +00:00
Neels Hofmeyr 09ea10d30d cosmetic: use local var in handover_start_intra_bsc()
Change-Id: I3ae079a2aa9ff3980acd5a212cb287a96a1dc0ed
2020-08-30 00:02:09 +00:00
Vadim Yanitskiy 22826ffb6b abis_rsl: fix IAR Rest Octets in rsl_send_imm_ass_rej()
Currently osmo-bsc encodes the IAR Rest Octets as follows:

  IAR Rest Octets
    0... .... = Extended RA: Not Present
    .0.. .... = Extended RA: Not Present
    ..1. .... = Extended RA: Present
    ...0 1011 = Extended_RA: 11
    0... .... = Extended RA: Not Present
    .L.. .... = Additions in Rel-13: Not Present
    Padding Bits: default padding

This is not really critical, but still may look confusing as this
is only relevant for the PS domain (11-bit RA), while osmo-bsc is
responding to a CHANNEL REQUEST in the CS domain.

Change-Id: I30a43efc70345a4bb0571127c239a24422b7fd2c
2020-08-29 16:39:53 +07:00
Neels Hofmeyr d41247d4cf CBSP: add local bind to client mode
Add the ability to set a local bind address for the CBSP client mode.

Change-Id: I56a420d204a9a487b27dd460f4cc52e0b4093d69
2020-08-29 07:57:59 +00:00
Neels Hofmeyr 641f7f0845 CBSP: rewrite the CBSP link setup and 'cbc' VTY section
Firstly, make CBSP server and client mutually exclusive: Do not allow osmo-bsc
to be configured as CBC client *and* CBC server at the same time.
cbsp_link.c expects at most one CBSP link to be established, and, upon sending
CBSP messages, probes whether to send the message to a CBSP server or client
link. When both listen-port and remote-ip are configured (regardless of an
actual CBSP connection), osmo-bsc gets confused about where to send CBSP
messages.

One solution would be more accurate probing for an actual established TCP
connection. But the simpler and less confusing solution is to force the user to
configure only server or only client mode, never both.

Introduce 'cbc' / 'mode (server|client|disabled)'.

Secondly, clarify the 'cbc' config structure into distinct 'server' and
'client' subnodes. Refactor the 'cbc' VTY node in such a way that the IP
addresses for server and client mode can remain configured when the CBSP link
is switched between server/client/disabled modes.

To implement the above, switch the struct bsc_cbc_link to use osmo_sockaddr_str
for address configuration.

Related: OS#4702
Related: I7eea0dd39de50ed80af79e0f10c836b8685d8644 (osmo-ttcn3-hacks)
Related: I9e9760121265b3661f1c179610e975cf7a0873f1 (docker-playground)
Change-Id: Icaa2775cc20a99227dabe38a775ff808b374cf98
2020-08-29 07:57:59 +00:00
Pau Espin 657f3109dc Allow storing IPv6 address strings in BSSAP structs
Related: SYS#4915
Change-Id: I95601f24e3c658aab328e1c55dc514f553c297b8
2020-08-28 19:11:18 +02:00
Pau Espin c8ec051bde tests: acc_test: Test more rotating scenarios
Change-Id: I8ac8ef362af8222e6b7e302e3763811ba093db62
2020-08-27 14:24:03 +02:00
Pau Espin 88cef63e85 acc: Fix ACC rotate barring highest ACCs too quickly during wraparound
Expected steps (size=4):
6 7 8 9 -> 0 7 8 9 -> 0 1 8 9 -> 0 1 2 9 -> 0 1 2 3 -> 1 2 3 4 -> ...

Befre this patch, for size>2 we got:
6 7 8 9 -> 0 6 7 8 -> 0 1 6 7 -> 0 1 2 6 -> 0 1 2 3 -> 1 2 3 4 -> ...

Which means highest ACCs were barred during more time than others.

Change-Id: I03c298ecb29c4fc5f4c361773f2666588e423ffe
2020-08-27 14:05:14 +02:00
Pau Espin c7b85d3a64 acc_test: Print allowed ACC from t2 and t3
Change-Id: If41e8e41310e2b9e27aaa5fe9d04ea39d7272703
2020-08-27 13:07:44 +02:00
Vadim Yanitskiy 6a26e2cf50 bsc_subscr_conn_fsm: use proper cause values in SAPI N REJECT
As 3GPP TS 48.058 clearly states, an RLL RELease INDication is only
sent if the datalink is released by the MS.  Thre's no cause value
giving further diagnostics, but if the MS releases the link, it is
clearly not the BSS's fault, and hence "BSS not equipped" is wrong.

Change-Id: I38222e60071841abcd06046a472ddb35907164a4
Related: OS#4728
2020-08-26 19:05:59 +00:00
Vadim Yanitskiy e76de16ff6 bsc_subscr_conn_fsm: fix a memleak in rll_ind_cb()
Change-Id: I9ce35c1e446b0dfdb5b01651466ccaafc23c9318
2020-08-26 19:05:59 +00:00
Vadim Yanitskiy f1339dfece fix bsc_sapi_n_reject(): dlci is unsigned, use uint8_t
Change-Id: I5f04f16caecb58a28e119512267999fdc18ff172
2020-08-26 19:05:59 +00:00