Commit Graph

7216 Commits

Author SHA1 Message Date
Neels Hofmeyr dd4c93b3f9 vty: hide 'mscpool roundrobin next'
The 'mscpool roundrobin next' command is intended for use only by ttcn3 tests.
Hide it.

Change-Id: Ie8799b61b74cfb34acd5aa4aeb1fb69ae7d216e2
2020-06-21 16:09:11 +00:00
Harald Welte 0415a5c5fa Count RSL DELETE INDICATION received from BTS
If the BTS downlink CCCH (PCH + AGCH) queue is full, it sends
us an RSL DELETE INDICATION.  So far, osmo-bsc logs this as

<0004> abis_rsl.c:2026 Unimplemented Abis RSL TRX message type 0x14

which is not very helpful.  Instead, make the log message more
descriptive and add a rate counter for monitoring.

Change-Id: I9bd2966db90e39ccca442d6bc9abc91e9a9147d4
Closes: OS#3190
2020-06-21 16:07:15 +00:00
Harald Welte 959c916def bs11_config: Print "Not Equipped" for MBCCU (TRX) that don't exist
Particularly on BS-11 with only one TRX installed, this will improve
the output of bs11_config from

PHASE: 2 Load MBCCU           MBCCU0: Load BTSDRX MBCCU1: unknown 0x8 Abis-link: Down

to

Change-Id: I10a77315d537681985f8390b838a4cabfb7d27f3
PHASE: 2 Load MBCCU           MBCCU0: Load BTSDRX MBCCU1: Not equipped Abis-link: Down
2020-06-21 16:05:02 +00:00
Harald Welte 8c53a61aff [cosmetic] system_information: Values are not guesses; more comments
Change-Id: I978fbcd0c82658444b7603b082c236d23b0fa04b
2020-06-21 15:41:59 +02:00
Neels Hofmeyr a68c79b1ce merge files: absorb osmo_bsc_vty.c into bsc_vty.c
For historical reasons we had bsc_vty.c and osmo_bsc_vty.c. Ever since the
osmo-nitb split, there is no reason to keep these files separate. Merge
osmo_bsc_vty.c into bsc_vty.c (because osmo_bsc_vty.c is smaller).

I noticed this particularly because adding the NRI configuration required
adding things like #define NRI_STR in two separate files: once for the
'network' level vty, and once for the 'msc' level.

Change-Id: I7fd2ee631b22e38f3d96d8159dc1deaaca6a7013
2020-06-19 23:38:03 +00:00
Pau Espin 390db47b26 bsc: Allow setting negative nominal tx power through VTY
Some SDRs may provide tx power below 0 dBm on some bands.

Related: OS#4583
Change-Id: Ia53c303d1bea23e219de42e1242cb8a5b357a2ae
2020-06-19 20:35:50 +00:00
Vadim Yanitskiy 2190ac9ce5 abis_nm: fix length indicator in Set Channel Attributes
This message may contain optional IEs (HSN, MAIO, ARFCN list),
so we cannot know the final length in advance. Let's set both
msg->{l2h,l3h} pointers and use msgb_l3len() to get the length.

Change-Id: I948ad4b847921324794a6eabd95d5583324da6e4
Related: OS#4545
2020-06-18 11:54:24 +00:00
Vadim Yanitskiy 83e6e613a7 abis_nm: fix ARFCN list encoding in Set Channel Attributes
3GPP TS 12.21 defines coding of 'ARFCN List' attribute as follows:

  +---------------------------+--------------------+
  | Attribute Identifier      | 1st octet          |
  +---------------------------+--------------------+
  | Length                    | 2-3 octets         |
  +---------------------------+--------------------+
  | ARFCN1                    | 4-5 octets         |
  +---------------------------+--------------------+
  | ...                       | ...                |
  +---------------------------+--------------------+
  | ARFCNn                    | (n * 2 - 3) octets |
  +---------------------------+--------------------+

so this is basically TL16V, where L16 is the length of V.

In the Siemens dialect of OML coding rules are different though:

  +---------------------------+--------------------+
  | Attribute Identifier      | 1st octet          |
  +---------------------------+--------------------+
  | ARFCN count               | 2nd octet          |
  +---------------------------+--------------------+
  | ARFCN1                    | 4-5 octets         |
  +---------------------------+--------------------+
  | ...                       | ...                |
  +---------------------------+--------------------+
  | ARFCNn                    | (n * 2 - 2) octets |
  +---------------------------+--------------------+

so this is TCV, where C is the amount of ARFCNs in V.

This change fixes encoding of 'ARFCN List' for other dialects,
in particular encoding of the 'Length' field (1 vs 2 octets).
I verified the results in Wireshark (generic 3GPP TS 12.21
and ip.access dialect), everything looks good.

Change-Id: Iec1826f55459ac8e9355328a1a6bb0949874db60
Related: OS#4545
2020-06-18 11:54:24 +00:00
Neels Hofmeyr 1c963eb97d MSC pooling: add rate counters
Tests for these counters are added in I2006f1def5352b4b73d0159bfcaa2da9c64bfe3f
(osmo-ttcn3-hacks).

Change-Id: I2ded757958dfa62b502efbab765203bcadf899e2
2020-06-17 05:05:40 +02:00
Neels Hofmeyr 25389e82b9 debug: log about matching Paging Response to earlier Paging
Change-Id: I277d3236686dd5a5a21113ef2ddfd29341190086
2020-06-17 00:14:01 +02:00
Neels Hofmeyr e15dec75ac log: add MSC number to bsc_subscr_conn_fsm id
Change-Id: Iae232d0616d6c0009e3abe2dcfcb9c51ddfc761e
2020-06-17 00:14:01 +02:00
Neels Hofmeyr b34fdf2868 vty: add 'mscpool roundrobin next' for ttcn3 tests
In the ttcn3 tests, the MSC round robin algorithm is affected by what tests ran
before, so an osmo-bsc test needs this to reset the round robin to get
predictable behavior to test against.

Change-Id: I2155d906505a26744966f442ffb1e87a6a9b494c
2020-06-17 00:14:01 +02:00
Neels Hofmeyr 73a6803111 mscpool: add user manual chapter
Change-Id: Ia60afc8a91189c9de0d8e8065781ed463bf18d7e
2020-06-17 00:14:01 +02:00
Neels Hofmeyr b69db82b1c MSC pooling: add 'no allow-attach' for MSC off-loading
As in 3GPP TS 23.236, to offload an MSC, the BSC must be able to avoid
attaching new subscribers to it:

4.5a.1: "UEs being moved from one CN node are stopped from registering to the
same CN node again by an O&M command in BSCs and RNCs connected to the pool."

Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
2020-06-17 00:14:01 +02:00
Neels Hofmeyr 343a8a1a1a MSC pooling: LU: ignore TMSI NRI from a different PLMN
Change-Id: Iac1158cff022b6365ce22bb70feaaff93e39172a
2020-06-17 00:14:01 +02:00
Neels Hofmeyr 2a366d9c25 MSC pooling: implement NAS node selection by NRI from TMSI
If applicable, choose MSC from NRI, extracted from TMSI MI.

Change-Id: Ifbdea197b26e88751a391c8a80c41f04e7d5e047
2020-06-17 00:14:01 +02:00
Neels Hofmeyr 4099f1db50 MSC pooling: make NRI mappings VTY configurable
Use the osmo_nri_ranges API to manage each MSC's NRI ranges by VTY
configuration.

Change-Id: I6c251f2744d7be26fc4ad74adefc96a6a3fe08b0
2020-06-17 00:14:01 +02:00
Neels Hofmeyr daf5d8b6c7 tweak log category for Compl L3 error
At this time, no MSC has been selected for handling this subscriber, so DMSC is
clearly the wrong logging category.

Change-Id: I9c6373e5f28c9c69a0609889188ef28ade11da3d
2020-06-16 14:56:57 +02:00
Neels Hofmeyr a87646cd84 use osmo_mobile_identity API everywhere
Depends: If4f7be606e54cfa1c59084cf169785b1cbda5cf5 (libosmocore)
Change-Id: I71c3b4c65dbfdfa51409e09d4868aea83225338a
2020-06-16 14:56:57 +02:00
Neels Hofmeyr 2c61245935 remove extract_sub(), add bsc_subscr_find_or_create_by_mi()
Use the new osmo_mobile_identity API to shed some code dup and simplify.
gsm48_paging_extract_mi() is now unused, drop.

(More refactoring to use osmo_mobile_identity follows in subsequent patch.)

Depends: If4f7be606e54cfa1c59084cf169785b1cbda5cf5 (libosmocore)
Change-Id: Id6cccaac64392b737b3bba8f3a22a88009adb23b
2020-06-16 14:56:57 +02:00
Neels Hofmeyr 83bba52b5c osmo-bsc main: exit on cmdline option error
Change-Id: I7c3432790a77ae9081d2c458ee9f598e435e089d
2020-06-16 10:16:30 +00:00
Neels Hofmeyr 10983f206b manuals: generate vty reference xml at build time
Move 'doc' subdir further down to "make sure" the osmo-bsc binary is built
before the docs.

Remove bsc_vty_reference.xml from the source tree.

In manuals/Makefile.am use the new BUILT_REFERENCE_XML feature recently added
to osmo-gsm-manuals, and add a build target to generate the XML using the new
osmo-bsc --vty-ref-xml cmdline switch.

Depends: I613d692328050a036d05b49a436ab495fc2087ba (osmo-gsm-manuals)
Change-Id: I5dc872149154e1a949bb6a2b9bbc1461e0fc51f6
2020-06-16 10:16:30 +00:00
Neels Hofmeyr 77c330d57c add osmo-bsc --vty-ref-xml: dump VTY ref XML to stdout
Add only a long option to not clutter the cmdline namespace.

To add a long option without a short letter is slightly complex: use the 'flag'
and 'val' mechanism as in 'man 3 getopt' to write an option index to
long_option.

Depends: Ic74bbdb6dc5ea05f03c791cc70184861e39cd492 (libosmocore)
Change-Id: I316efedb2c1652791434ecf14a1e261367cd2fb7
2020-06-16 10:16:30 +00:00
Daniel Willmann b5ccf09fc4 Count assignment rates per BTS as well
This adds the assignment counters for the BTS as well and changes the
assignment_count() macro to increase both the counters for the BSC as
well as the BTS.

Related: SYS#4877
Change-Id: I0009e51d4caf68e762138d98e2e23d49acc3cc1a
2020-06-16 09:07:20 +00:00
Daniel Willmann fea5d640d4 abis_rsl: Count successful channel requests
Ticket: SYS#4877
Change-Id: I5c51956569223e802f4789dc5ed1605d18f80aea
2020-06-16 08:43:45 +00:00
Daniel Willmann ce7aa0d5c2 gsm_data.h: Remove period at end of counter description
Change-Id: I045cef207603074bd018e40f984263d03db31405
2020-06-16 08:43:45 +00:00
Neels Hofmeyr eec776e9ca refactor bsc_find_msc()'s round-robin
Prepare for MSC pooling by NRI. Before introducing actual NRI decoding and MSC
matching, fix the bsc_find_msc() implementation.
(Indicate the places relevant for NRI by "TODO" comments).

bsc_find_msc() puts an MSC to the end of the internal list of MSCs when it was
used. This has problems:

- Modifying the list affects VTY output, e.g. 'show running-config' and
  'show mscs' change their order in which MSCs are shown, depending on how
  often a round-robin selection has taken place.

- Emergency calls and normal calls potentially pick quite different sets of
  eligible MSCs. When the round-robin choices between these sets affect each
  other, the choice is not balanced. For example, if only the first MSC is
  allow_emerg == true, every emergency call would reset the round-robin state
  to the first MSC in the list, also for normal calls. If there are regular
  emergency calls, normal calls will then tend to load more onto the first few
  MSCs after those picked for emergency calls.

Fix: Never affect the ordering of MSCs in the internal list of MSCs. Instead,
keep a "next_nr" MSC index and determine the next round-robin target like that.
Keep a separate "next_emerg_nr" MSC index so that emergency call round-robin
does no longer cause normal round-robin to skip MSCs.

Further problems in current bsc_find_msc():

- The "blind:" label should also do round-robin.
- The "paging:" part should not attempt to use disconnected MSCs.
- Both should also heed NRI matches (when they are added).

Fix: instead of code dup, determine Paging Response matching with an earlier
Paging Request right at the start. If that yields no usable MSC, continue into
the normal NRI and round-robin selection.

The loop in this patch is inspired by the upcoming implementation of MSC
pooling by NRI, as indicated by the two TODO comments. The point is that, in
the presence of an NRI from a TMSI identity, we always need to iterate all of
the MSCs to find possible NRI matches. The two round-robin sets (Emergency and
non-Emergency) are determined in the same loop iteration for cases that have no
or match no NRI, or where a matching MSC is currently disconnected.

Change-Id: Idf71f07ba5a17d5b870dc1a5a2875b6fedb61291
2020-06-10 14:21:11 +02:00
Daniel Willmann 112609f918 osmo-bsc: Use designated initializer in bts_stat_desc
Change-Id: Ic29f3a7e6fb16955bc74cc163d45a243b373183a
2020-06-08 15:21:59 +02:00
Neels Hofmeyr 7cd900dd2b gsm0408_test.c: drop test_mi_functionality()
Testing these functions is actually done in libosmocore. Also, with new
osmo_mobile_identity API, the functions being tested are marked deprecated. So
drop the test.

BTW, the test contained an IMSI of 16 digits, which is too long, yet was
expected to succeed. GSM23003_IMSI_MAX_DIGITS == 15. I first considered fixing
the test data, but the test is in the wrong place here anyway.

Change-Id: I902d31ecd72d71892fad7945f695a9f1fb403bf2
2020-06-03 23:53:32 +00:00
Neels Hofmeyr c1a73302c2 is_cm_service_for_emerg(): return false, not 0
Change-Id: Ife25ed26214abf7aea95b0b7943d9fa585868529
2020-06-03 17:42:57 +02:00
Neels Hofmeyr 6aa666024b cosmetic: tweak rc type of is_cm_service_for_emerg()
Change-Id: Id752d3882645708b5b8e1058b6799d3d285286c4
2020-06-03 17:30:07 +02:00
Neels Hofmeyr 6109f1015b create only one SCCP user per SCCP instance
Depends: I9ecbab16b45268f626950303d6ff8296dd6acda0 (libosmo-sccp)
Change-Id: I6a2710edeb9ba047ae70e6b49d4c2e5f06d41a4e
2020-06-03 17:30:07 +02:00
Neels Hofmeyr d3cb71b551 CTRL: determine MSC connection status from RESET-ACK, not AS_ACTIVE
Change-Id: I264ba6a72ea93297cfbc99602eccfbf4a890f703
2020-06-03 15:29:42 +00:00
Vadim Yanitskiy 3a986ba3c9 abis_nm: fix: properly truncate feature vector reported by BTS
The value of the feature vector can not only be greater, but also
shorter than size of the buffer! This would potentially result
in a buffer overrun. Let's fix this.

Change-Id: I65e3228022865ea73de2e4821985df3097b9448b
2020-06-03 06:52:37 +00:00
Vadim Yanitskiy a6050088c5 abis_nm: cosmetic: use sizeof() for printing buffer size
Change-Id: I14be343578a64c1e4ce8ce4d28da9008eb309f3c
2020-06-03 06:52:37 +00:00
Vadim Yanitskiy eda1312605 abis_nm: cosmetic: add curly braces to complex 'if' statements
Change-Id: I74fbb46920c74a194c296feeeb1bb086fcbd572f
2020-06-03 06:52:37 +00:00
Vadim Yanitskiy 4f3a64182e handover_test: use 'unknown' BTS type instead of 'sysmobts'
This unit test does not really need a BTS of such specific type.

Change-Id: Id676042518d06e94a9fb20112334280e2b91074b
2020-05-31 02:14:28 +07:00
Vadim Yanitskiy 01f530bce4 bsc_bts_alloc_register(): fix possible NULL-pointer dereference
Change-Id: I4560a7037a0a016636c4626c9fb3ceddfe98058e
2020-05-31 02:14:28 +07:00
Vadim Yanitskiy 36cd19ff98 bts_sysmobts: fix: properly zero-initialize the feature vector
The last argument must be size of buffer, not size of size!

Change-Id: I6539a3c9829d4f74a18b1cc2aa522c69ff8e638d
2020-05-31 02:14:28 +07:00
Vadim Yanitskiy 4458496e84 bts_unknown: fix: properly initialize the feature vector
This is unlikely to cause any problems, but having a NULL-pointer
that can potentially be dereferenced is dangerous. Fix this.

Change-Id: Icf594604f69023d1483e897edb811e51774b5b8e
2020-05-31 02:14:28 +07:00
Vadim Yanitskiy c1b141c8c3 gsm_data: cosmetic: mark argument of is_*_bts() as const
Change-Id: Ifa084e34cbea006e09c83a530e1434a22895e9aa
2020-05-31 02:14:28 +07:00
Vadim Yanitskiy 8519d50081 doc/manuals: regenerate the VTY reference file
Change-Id: I4f7bf671b7948d8c3771d33d40ab5e8cf209e2b2
2020-05-31 02:14:28 +07:00
Neels Hofmeyr 06a14d289b flatten: move network->bsc_data->* to network->*
The separate struct osmo_bsc_data is like another separate struct gsm_network
for no reason. It is labeled "per-BSC data". These days, all of this is a
single BSC and there will not be different sets of osmo_bsc_data.

Drop struct osmo_bsc_data, move its members directly into gsm_network.

Some places tested 'if (net->bsc_data)', which is always true. Modify those
cases to rather do checks like 'if (net->rf_ctrl)', which are also always true
AFAICT, to keep as much unmodified logic as possible in this patch.

Change-Id: Ic7ae65e3b36e6e4b279eb01ad594f1226b5929e0
2020-05-29 20:16:40 +00:00
Neels Hofmeyr b281b1cdb6 drop MSC types "local" vs "normal"
Another legacy feature. All that this setting effectively does is prevent MSCs
from being contacted for non-emergency calls. To select which MSCs shall handle
emergency calls, there is the allow_emerg flag.

Change-Id: I7fc630d9c35be9a69a0d378d3de2b2312c69690d
2020-05-29 20:16:40 +00:00
Neels Hofmeyr 39a0af3bf4 doc/examples: remove deprecated ussd text config
Change-Id: I7c0b615bbb0a5c50341968a748612448ad9d18e4
2020-05-29 20:16:40 +00:00
Neels Hofmeyr 6a8955b741 drop all BSC originated USSD notification features
The BSC is the wrong network component to originate USSD messaging, as can be
seen in the hacks in the USSD code: for example, the BSC would send a CM
Service Accept message as if an MSC had accepted the connection, dispatch a
USSD and directly send some RR release message (without proper tear down
messaging like the lchan_fsm does these days). This made sense in the osmo-nitb
world, but by now we are aiming for solid 3GPP compliance. The BSC shall not
originate USSD messages.

Deprecate all VTY and CTRL commands related to USSD:
VTY
 [no] bsc-welcome-text
 [no] bsc-msc-lost-text
 [no] bsc-grace-text
 [no] missing-msc-text
 (the commands with 'no' are ignored, without 'no' lead to an error)
CTRL
 ussd-notify-v1

Drop (already unused) ussd.h.
Drop gsm_04_80.h, gsm_04_80_utils.c, and all calling code.

Drop "RF grace" notification, where osmo-bsc was able to notify active
subscribers that the RF was being turned off.

Change-Id: Iaef6f2e01b4dbf2bff0a0bb50d6851f50ae79f6a
2020-05-29 20:16:40 +00:00
Neels Hofmeyr dbc7a3c9b9 code cleanup: absorb complete_layer3() into bsc_compl_l3()
Tweak return code handling: also return a failure code when dispatching the
GSCON_EV_A_CONN_REQ event failed.

Change-Id: I939e8a9a865250033e4837439a6b9ec251e5ce4c
2020-05-29 20:16:40 +00:00
Neels Hofmeyr bf4134edaf drop CC 'local-prefix' feature
It is not entirely clear to me what this used to do once, but I've stumbled
upon this before. By now I am certain that this is a non-standard legacy
feature. The BSC does *not* redirect connections during CC transactions.

Along with this, a bunch of legacy utility functions can be dropped. All of
this is unused code.

(Preparing for MSC pooling.)

Change-Id: Id54afe8ccf0e11b9121a733224054c9565eafb58
2020-05-29 20:16:40 +00:00
Alexander Chemeris 962cb637fc Return 0 from gsm0408_rcvmsg() if SCCP link is already closed.
Whether to forward the message or not to an SCCP connection is
an internal question for the GSM 04.08 code. Unlike errors with
the message decoding, memory allocation and other critical errors,
this not an error which should be reported to the caller.
abis_rsl_rx_rll() (the caller) shouldn't know about the message
routing decisions and should only care about actual errors.

This code path is hit in production very often because we frequently
receive a Classmark Change message from a phone right after the MSC
has shut the SCCP connection but before we close the lchan on the BTS.

Change-Id: I2d430ebc894a2345bebaa1841a75e94a3b45eae2
2020-05-29 20:03:26 +00:00
Vadim Yanitskiy b87103098c bsc_subscr_find_or_create_by_{imsi,tmsi}(): fix NULL pointer dereference
Change-Id: Icb89d566b51031c2296be0888f8b7e554aa50418
2020-05-29 14:10:39 +07:00