Commit Graph

8239 Commits

Author SHA1 Message Date
Neels Hofmeyr c60fabb62b fix extraneous newlines in ho_fail() invocations
The ho_fail() macro includes a newline, so the callers should not add
one. Fix these cases where the extra '\n' fragments the logged message.

Related: SYS#5839
Change-Id: Ifdbce98be70c1aa127ae008d7a77b9795fd250d3
2022-03-09 07:15:51 +00:00
Neels Hofmeyr 826ec9ff75 inter-BSC incoming HO: store Codec List (MSC Preferred)
So far we completely ignore the codec list from the MSC in Handover
Request messages. This leads to error messages in subsequent handovers
because there is no Codec List stored on the conn:

  DHODEC ERROR handover_decision_2.c:390 [...] No Speech Codec List present, accepting all codecs

Besides the error log, in hodec2 we may subsequently take bogus or
unexpected codec decisions, ignoring the MSC's choice of codecs, or in
the worst case picking an unsupported codec.

This also has implications on what type of lchan we choose for handover
target in hodec2: say, if no half rate codec is supported as per the
MSC's request, we normally avoid handover to a TCH/H, etc.

Intra-BSC HO after an Inter-BSC incoming HO is the only case where this
problem occurs, in every other scenario there is an Assignment Request
from the MSC, from which we properly store the MSC's codec list.

3GPP TS 48.008 does indicate that on AoIP this codec list shall be
included. So reject HO Request with missing Codec List, as we already do
for Assignment Request on AoIP.

This makes TTCN3 BSC_Tests for inter-BSC incoming HO fail, because our
tests so far omit the Codec List (MSC Preferred) on AoIP. The related
fix of the tests is If06de9c9b43d79f749447a4e2a340176eef75c79.

Related: SYS#5839
Depends: If06de9c9b43d79f749447a4e2a340176eef75c79 (osmo-ttcn3-hacks)
Change-Id: I117cc29d6d11db77d160de654f43f5993db6ee21
2022-03-09 07:15:51 +00:00
Neels Hofmeyr 49a4820fc6 tweak error msg: s/inter-BSC MT/inter-BSC incoming
"inter-BSC MT" was the terminology of an early development stage of
inter-BSC handover, code review requested "incoming" instead. This one
was missed when applying code review.

Same in a code comment.

Related: SYS#5864
Change-Id: I1ca810542e89980ffda11876fd30626467e452d1
2022-03-09 00:01:06 +01:00
Neels Hofmeyr 908f014f09 support "empty" SCCP N-Connect from MSC
Teach osmo-bsc to handle empty N-Connect. So far we were always
expecting user data in an SCCP N-Connect from an MSC. However, it is
perfectly valid for an initial BSSMAP request to follow later.

This is relevant for:
- Handover Request (incoming inter-BSC handover)
- Perform Location Request (query physical location of the MS)

Add state WAIT_INITIAL_USER_DATA with new timeout net X25. Always enter
this state so that we don't have two separate code paths for handling
initial user data.

Related: SYS#5864
Change-Id: I535c791fa01e99a2226392eb05f676ba6c3cc16e
2022-03-09 00:01:06 +01:00
Neels Hofmeyr bdead6e87a add counter for inter-BSC incoming Handover Request
Related: SYS#5864
Change-Id: Icdde2bb339a5e367a4d297802214a1ef3f36eefa
2022-03-09 00:01:06 +01:00
Neels Hofmeyr d10d07b6e3 add missing counter increment for Perform Location Request
Also increment message counter for the case that a Perform Location
Request came in the initial SCCP N-Connect message.

Related: SYS#5864
Change-Id: I3f78ce73eb16fdff1f19359963405b2235000fc4
2022-03-08 23:00:21 +00:00
Vadim Yanitskiy 66a46ffa6a Fix description of BTS_CTR_BTS_RSL_FAIL: s/OML/RSL/
Change-Id: Icc3e603b08ab81869955ffa5b16ddfb458e83c78
Related: OS#4848
2022-03-06 20:20:47 +03:00
Neels Hofmeyr 1f089842a8 silence bogus error: event not permitted: READY_TO_SWITCH_RTP
During inter-BSC incoming handover, there is no previous lchan to be
switched, so this event always comes in the READY state of
lchan_rtp_fsm. No need to complain about that and confuse log readers.

Related: SYS#5864
Change-Id: I96fd53b8c8da621a40bd65f85070eabd030cc875
2022-03-03 23:19:46 +00:00
Neels Hofmeyr e761affc6a tweak logl to ERROR for invalid initial BSSMAP
Related: SYS#5864
Change-Id: Idd7d763129a5acdf19cd0ae86e82b77ee0073f2f
2022-03-03 22:22:12 +00:00
Vadim Yanitskiy df58a69bde bitvec2freq_list(): fix handling of E-GSM ARFCNs
According to 3GPP TS 44.018, section 10.5.2.1b.2, only ARFCN values
in range 1..124 can be encoded using the 'bit map 0' format.  Before
this patch, ARFCN values belonging to E-GSM band (0, 975..1023) were
ignored in bitvec2freq_list(), and thus not present in the resulting
Cell Channel Description IE.

Change-Id: I17739e6845cd84e2a81bc406dd532541f7c52cb6
Related: SYS#5854
2022-03-03 09:43:27 +00:00
Vadim Yanitskiy d1cacced51 bitvec2freq_list(): determine empty set by checking the ARFCN count
I find it cleaner to relay on the counter ('arfcns' in this case) to
check if the set is empty, rather than checking one of the resulting
values ('max').  There is just a cosmetic change.

Change-Id: I29ca51461beec053bcb8b8210f0ad24bb8c7765f
Related: SYS#5854
2022-03-03 09:43:27 +00:00
Vadim Yanitskiy 20c6d07bf2 tests/gsm0408: add testing coverage for generate_cell_chan_list()
This commit demonstrates what happens when a cell has channels in
both P-GSM and E-GSM bands (case 'c').  As can be seen from:

  Case a) only the BCCH carrier: 10
  Case b) more carriers from P-GSM band: 1 3 10 64 99 124
  Case c) more carriers from E-GSM band: 1 3 10 64 99 124

in both cases 'b' and 'c' we have the same set of ARFCNs.  Carriers
from the E-GSM band are not present at all.  This is wrong and will
be fixed in the follow up change(s).

Change-Id: Ied0519c70501f105673a9b36657101063d275058
Related: SYS#5854
2022-03-03 09:43:27 +00:00
Vadim Yanitskiy 82aebfeacf system_information: fix unused 'mask' parameter in list_arfcn()
The callers of this function do pass different mask values, which
should be passed to gsm48_decode_freq_list().  Instead, 0xce was
passed regardless of the given mask value.

Change-Id: I47f2eab54ef8487b14992fd7a69d5c9ccbb3f5cf
2022-03-03 09:43:27 +00:00
Pau Espin 8f1597135d ipa oml: Fix encoding of T3105
As the comment above the fix suggest, the encoding is in 10ms units.
osmo-bts is also doing the proper:
"""
uint8_t t3105 = *TLVP_VAL(&tp, NM_ATT_BTS_AIR_TIMER);
bts->t3105_ms = t3105 * 10;
"""

Related: SYS#5838
Change-Id: Ie190514ee35d1ca81b70e9180bf7393b973d3504
2022-03-02 17:34:43 +01:00
Pau Espin 10edefe68b tests: nanobts_omlattr_test: Use msgb_eq_data_print() helper
Change-Id: I1c96305839e6627a36655c2e64da64f0a6704896
2022-03-02 17:34:43 +01:00
Pau Espin beed1365fa doc: bsc.adoc: Update timer info from code (gsm_network_T_defs)
Change-Id: I1652e6d53f568f606b692b16d4198d5209df2d9c
2022-03-02 17:34:43 +01:00
Neels Hofmeyr 9972978365 inter-BSC HO in: add Codec List (BSS Supported) IE to HO Req Ack
Related: SYS#5839
Depends: Iab0a7b4d81592157fc111d1adb9e9f4cb53a94e9 (libosmocore)
Change-Id: I3c0576505a3ceb3cd5cc31dc69c5bc4a86a4ea08
2022-02-28 11:53:37 +01:00
Neels Hofmeyr c9c90cda71 inter-BSC HO in: add Speech Codec (Chosen) IE to HO Req Ack
Related: SYS#5839
Change-Id: I1d0b395c97145b5aa1af4ef67aec9338d2f8f43b
2022-02-28 11:53:25 +01:00
Neels Hofmeyr 0a704ee857 inter-BSC HO in: add speech IEs only on speech mode lchans
Related: SYS#5839
Change-Id: I830654f419e6f0a196dc6d3e58422e00b324af9e
2022-02-23 16:23:38 +01:00
Neels Hofmeyr ec8c1dd11e cosmetics around select_best_cipher()
Improve the function doc. Remove a comment at a caller, because that
information is what the function doc is for.

Rename the array to codec_by_strength, because it is not the codec
strength but the codec number listed in the array.

Related: SYS#5839
Change-Id: Iaed6b97c31e4ccb1f28ca7e64596d5e20563b392
2022-02-22 11:26:51 +00:00
Neels Hofmeyr 8bacb71c90 fix inter-BSC-in handover encryption
In the field we saw Handover Requests without any Chosen Encryption
Algorithm IE, and osmo-bsc completely failed on those. This made me
understand my mistake from when I wrote this handover code.

So far, from a BSSMAP Handover Request, we (I) used only the Chosen
Encryption Algorithm IE to pick the encryption to use on the target
lchan. That is very wrong.

Instead, figure out the intersection of permitted algorithms MSC & BSC,
and pick the best of those. Which means, actually, completely ignore the
Chosen Encryption Algorithm IE.

In the message, the permitted algorithms are passed as a bitmask. The
current code using gsm0808_dec_encrypt_info() passes this on as an
array. In order to select_best_cipher(), I could convert that array back
to a bitmask. Instead pass the bitmask on from message decoding
alongside the struct gsm0808_encrypt_info in req->ei_as_bitmask.

In handover_end(), change the condition so that we can also pass
HO_RESULT_FAIL_RR_HO_FAIL to emit a Handover Failure.

Related: SYS#5839
Change-Id: Iffedc981b60d309ed2e5decd5efedee07a757b53
2022-02-22 11:26:45 +00:00
Neels Hofmeyr a0fb37906d rename RSL_ENC_ALG_A5 to ALG_A5_NR_TO_RSL, clarify
The naming confused me so that I wrote buggy code again. Hopefully this
clarifies which representations the code paths are using.

In the macro code, highlight the error case of n <= -1 explicitly.

Also add ALG_A5_NR_TO_PERM_ALG_BITS. I need the 1<<n case in an
upcoming patch.

Related: SYS#5839
Change-Id: I7557ae97764bba09c906748a18e9031dfb362611
2022-02-18 13:21:56 +01:00
Pau Espin 3900aae7a3 bts: Add explicit switch case for Cell Id SAI
This patch imposes no logical change in the code on itself, but makes
sure people compiling osmo-bsc uses an old enough libosmocore
implementing Cell Identifier SAI. This is important since adding the SAI
ID (CELL_IDENT_SAI) displaced CELL_IDENT_WHOLE_GLOBAL_PS to a new
number outside of the 3GPP range for cell IDS (4 bits, this way we
garantee we won't have the same problem again).

This means there was an ABI breakage (see Depends below).
As a result, using an osmo-bsc compiled against an older libosmocore
, and then using at runtime against a newer version of libosmocore, will
most probably provoke some RIM features to not work properly, since
libosmocore will handle CGI-PS cell ids sent by osmo-bsc as SAI ones,
and most probably do wrong comparisons when matching (they only match up
to LAI included).

ABI break analysis:
osmo-bsc uses CELL_IDENT_WHOLE_GLOBAL_PS in:
* gsm0808_dec_cell_id_list2() -> this is called on stuff received from the
				 network, so it's actually fine handling it
				correctly as CELL_IDENT_UTRAN_SAI instead
				of CGI_PS.
* gsm0808_cell_id_list_add
	same_cell_id_list_entries
		gsm0808_enc_cell_id_list2
			cell_id_to_cgi-> On old osmo-bsc, When
					 CELL_IDENT_WHOLE_GLOBAL_PS is passed
					 to be encoded as CGI, RAC byte is
					 taken for encoding instead of 2nd CI byte.
* gsm0808_cell_ids_match
	gsm0808_cell_id_u_match
		cell_id_to_cgi -> If CELL_IDENT_WHOLE_GLOBAL_PS as 0x11
				  (CELL_IDENT_UTRAN_SAI), 1 byte offset when
				  comparing (1 byte of RAC is taken converting to
				  CGI instead of the 2nd byte of CI). That means
				  match would be wrong if 2nd byte of CI differs.

Related: SYS#5838
Depends: libosmocore.git Change-Id Id25e563febdb7640174540136225f399515a0089
Change-Id: I70972efffefd57fd36332fab539683696c32f4a5
2022-02-16 18:55:21 +01:00
Philipp Maier 49865023c9 bssmap_reset: make T4 user configurable
The timer (T4) that controls the re-sending of the BSSMAP RESET can not
be changed via the VTY, althrough it is defined via a tdef struct. Lets
add a description along with default values to make it configurable via
the VTY.

Change-Id: I1fb5699220ab8a643a168567a89c6f381fe433a7
Related: SYS#5796
2022-02-08 11:51:42 +01:00
Neels Hofmeyr f8345b7ad5 fix two comments in chan_counts.h
An earlier patch version had that typedef, the merged version switched
to the struct containing the array.

Change-Id: Id8ca7b298436feb98f4a563ad3cdea510b9362b0
2022-01-21 16:53:35 +01:00
Philipp Maier 99f97ee90f nm_bts_fsm: fix sourcecode formatting
Change-Id: If7db7f5611e0ebf69d66b135515c0a08c6edfb11
2022-01-17 11:29:02 +01:00
Pau Espin 326ee2ea49 Fix DLCI CC bits transmitted in SAPI "n" REJECT
The SAPI "n" REJECT messages were being sent with DLCI keeping the RSL
LINK ID format, which is not the same for CC bits.

With this patch, TTCN3 test BSC_Tests.TC_rll_sapi_n_reject_dlci_cc
passes again.

Related: OS#4728
Related: SYS#5047

Change-Id: Icc187f594743040a3d9b8beff7d9cfc21dd6eb08
2022-01-13 06:08:02 +00:00
Neels Hofmeyr 47d38f9967 gscon clear: without SCCP conn, no need to wait for RLSD timeout
Skip the BSSMAP Clear and SCCP RLSD parts and immediately deallocate the
gscon when there is no SCCP connection present. Before this patch, such
conn would stick around for a minute before a timeout deallocates it.

Related: OS#5337
Change-Id: I8c8537acf6b47b121903197608636c43ae601a57
2022-01-12 22:42:16 +06:00
Neels Hofmeyr 53b23c252e fix gscon clear 3/n: separate state for SCCP RLSD
Properly implement the separate conn release stages in separate FSM
states:

x) sent Clear Request, wait for a Clear Command from the MSC.
   Timeout after a configurable 60s.

y) after a Clear Command and sending a Clear Complete, wait for the SCCP
   RLSD. Timeout after a configurable 60s.

z) terminate after the RLSD is received / after timeout.

handover_test.c needs a little tweak to make the MGCP release work with
its fake MGCP client, because cleanup now ensures to invoke
gscon_forget_mgw_endpoint() in all cases.

Related: I680ec4ed866aa5f0b1ff29e7e98322615cfb288d (osmo-ttcn3-hacks)
Related: OS#5337
Change-Id: Ie975117d37f38ba853589dc7f8d3e94f8f9586b2
2022-01-12 22:41:33 +06:00
Pau Espin 4842443c29 Drop unneeded ax_check_compile_flag.m4
The macro was never used in this repo.

Change-Id: I2c7299937db91f9940edfadafa3319d5e09d840c
2022-01-11 18:15:20 +01:00
Neels Hofmeyr c2dba7c5b9 fix gscon clear 2/n: proper state transition to ST_CLEARING
The way the ST_CLEARING is entered before this patch has various
symptoms of how I / we used osmo_fsm when we were still FSM amateurs in
Osmocom. Patch that up:

- In gscon_bssmap_clear(), ask for a state transition to ST_CLEARING
  first. Go ahead only if it is allowed.

- move the Clear Request messaging to ST_CLEARING's onenter function.

- Fix the timeout behavior: by using conn_fsm_state_chg(), use the
  actual proper X4 timer value for ST_CLEARING from VTY configuration
  instead of hardcoded magic numbers.

Related: OS#5337
Change-Id: I234b2a754d0c98031056981823cdbc187e977741
2022-01-04 13:33:26 +00:00
Neels Hofmeyr c984dc1a86 fix gscon clear 1/n: store clear cause in gscon
Allow returning a context sensitive cause instead of a hardcoded one in
gscon pre_term().

Also, the conn->cause is needed to move message dispatch to an "onenter"
function in patch I234b2a754d0c98031056981823cdbc187e977741. I Split
this part off as a separate patch for better readability.

Related: OS#5337
Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915
2022-01-04 13:33:26 +00:00
Neels Hofmeyr bd1eac2fb2 lcs: fix bsc_subscr use_count leak
In lcs_ta_req_wait_ta_onenter(), fix use count leak of 'start-paging':
get() the use count only after the early exits.

osmo-ttcn3-hacks patch I69d4c5c6f8d499bb7f0b96a48af045361433c57b
introduces testing against this leak in various LCS tests (e.g.
BSC_Tests.TC_lcs_loc_req_for_active_ms_ta_req).

Related: OS#5355
Change-Id: Ibbfbfe766eafe42c78048ec5b3b503a11ef5535d
2022-01-04 13:33:26 +00:00
Neels Hofmeyr 3b4b7c1efd lchan/gscon: always clear both cross ref pointers
During specific release scenarios, it became clear that an lchan still
pointed at a conn even after it had been deallocated. That was due to
setting conn->lchan = NULL but not lchan->conn = NULL. Fix that.

Do lchan_forget_conn() first, because during gscon_forget_lchan() we may
enter the gscon clearing dance, which in case of no SCCP conn being
present will soon / should immediately deallocate the conn.

Related: OS#5337
Related: I8c8537acf6b47b121903197608636c43ae601a57 (osmo-bsc)
Change-Id: Idbfe4672233ba8105eff5ba77ee07fd871358255
2022-01-04 13:33:26 +00:00
Neels Hofmeyr 9aed5f541f log: always include timeouts in FSM transition logging
Before:
  state_chg to ACTIVE
  state_chg to WAIT_RLL_RTP_RELEASED
  state_chg to WAIT_SCCP_RLSD

After:
  State change to ACTIVE (no timeout)
  State change to WAIT_RLL_RTP_RELEASED (T3109, 5s)
  State change to WAIT_SCCP_RLSD (X4, 60s)

Change-Id: I94b7dc4d9e5e45dc731bcb3a843ede9fb6cc0839
2022-01-04 13:33:26 +00:00
Harald Welte d3b0db5515 om2000: Don't print "should not generate any message" on FAULT_REP
Change-Id: I65184ef5aa90a993491f9393614bb499c6998169
Closes: OS#4643
2022-01-04 13:08:20 +00:00
Harald Welte 9f53838c58 om2000: Don't print "should not generate any message" on CAL_TIME_REQ
Change-Id: Ic6f576250d56707cf325886d70209a3744163d79
Closes: OS#4670
2022-01-04 13:04:22 +00:00
Harald Welte 6e250bbf82 om2000: Fix memory leak in OM2000 message handling
Change-Id: I7a94320f3b3af65003df67c11fe7221dfc7d7d62
2022-01-02 15:15:25 +01:00
Philipp Maier 9b844df27b bts: fix sourcecode formatting (excess whitespace)
Change-Id: Ie4fad0426d1d089156481806a05982a24375b766
2021-12-20 15:29:52 +01:00
Philipp Maier 2544c1058c bts: add missing return -EINVAL statements
The checks that make sure that an ARFCN falls in the correct range do
not return with -EINVAL as they should, instead nothing happens. (Only
the check for GSM1800 is corrct)

Change-Id: Iddadafe3fbc47e2f980d8e4ab4f320998cb454ff
Related: SYS#5369
2021-12-20 15:29:25 +01:00
Oliver Smith 260eb1d256 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: Ifbbafe185931c0f508ff8148ef244f25a9620fd8
2021-12-14 12:51:44 +00:00
Philipp Maier 3ba9bd7c35 abis_nm: actively block BTSs with invalid configuration
At the moment the BTS configuration is checked, but the check does not
have much consequence other than that some initialization that is not
executed. The BTS will go into the OML bootstrap phase anyway and most
likely fail at some later point due to the invalid configuration. To
reduce noise and unexpected behaviour of the BTS lets make sure that the
OML boostrap phase can only proceed when the BSC conciders the
configuration as valid.

Change-Id: I42c1c26a9b800600787b1266a871f95f2114c26e
Related: SYS#5369
2021-12-13 18:03:12 +01:00
Philipp Maier 5cebdefed6 bts-examples: add example for E1 connected BTS
The manual lacks an example on how to set up an E1 connected BTS.
Especially the relation between trunk number and E1 line number is not
obvious.

Change-Id: I02f5d4fe059e5cc9c3ffc2e3636d812532c09239
Related: OS#5308
2021-12-06 19:03:37 +01:00
Neels Hofmeyr 67fb8b7c17 fix assignment success counters: count *before* cleanup of fsm state
Counting the Assignment success after osmo_fsm_inst_term() meant that we
were counting a cleared out channel mode, which always yielded
signalling mode.

Count the Assignment success *before* terminating, so that we correctly
count the successful assignment as speech mode.

Related: SYS#4878
Related: Icb1386ec2ccd70eb3c026301b9b08ad7177278f7 (osmo-ttcn3-hacks)
Change-Id: Ie9fcd1e86f27ecb2f11e2e8813faac365cb470b8
2021-11-30 14:19:11 +01:00
Neels Hofmeyr c309754ff9 dbg log: also log assignment counters on BTS level
Change-Id: I68b3e794ddf97c80f647c3536ec466217b338af9
2021-11-30 14:19:07 +01:00
Neels Hofmeyr fdf2262968 fix chreq:* counters: typos in chreq:successful_* constants
Related: SYS#4878
Related: I17a7702b151ac03fd9f7ecd6927ef42133aad953 (osmo-ttcn3-hacks)
Change-Id: I1fde77d5d5920093ab037184eb3518876804353d
2021-11-30 14:19:05 +01:00
Neels Hofmeyr 33e687a97e dbg log: abis_rsl print_meas_rep(): clarify rxlev
Change-Id: Ia2c1d59eac556b8f6a56c39abf12b35a3ba807eb
2021-11-29 15:10:49 +00:00
Oliver Smith 2df65db3da stats: add bsc.paging:expired
Similar to paging:attempted, count paging:expired not only per BTS, but
also for the whole BSC. Add active_paging_requests to struct bsc_subscr,
to increase the counter only once if paging expires, and not once per
BTS where paging expired.

Related: SYS#4878
Change-Id: I9c118e7e3d61ed8c9f1951111255b196905eba4d
2021-11-29 11:33:34 +01:00
Oliver Smith 61e041d92a Cosmetic: osmo-bsc/osmo_bsc_bssap: fix formatting
Change-Id: Icc4947e68fa46aab180f2047231e51b997cca71b
2021-11-29 11:28:10 +01:00
Vadim Yanitskiy cc7bdbe62e ipaccess-config: request and print NM_ATT_IPACC_NV_FLAGS
Below is an example output:

"""
  Received SIGNAL S_NM_GET_ATTR_REP
  {
      "primary_oml_ip": "192.168.100.100",
      "primary_oml_port": "0",
      "unit_id": "6969/0/0",
      "nv_flags": {
          "static-ip": "no",
          "static-gw": "no",
          "no-dhcp-vsi": "no",
          "dhcp-enabled": "yes",
          "led-enabled": "yes",
          "secondary-oml-enabled": "yes",
          "diag-enabled": "yes",
          "cli-enabled": "yes",
          "http-enabled": "no",
          "post-enabled": "yes",
          "snmp-enabled": "yes"
      }
  }
"""

Change-Id: Ic901910878529e6d8b152b3417463bae60644b82
2021-11-27 04:51:09 +03:00