Commit Graph

4218 Commits

Author SHA1 Message Date
Pau Espin 1b625cb134 gsm: Support Sending Last EUTRAN PLMN Id in Handover Required
Related: SYS#5337
Change-Id: I6280ce1abc283f1491bc6f391b2dd952df33a16b
2021-04-19 10:55:43 +02:00
Vadim Yanitskiy e731a7da05 protocol/gsm_08_58.h: add asymmetric CSD data rates
The new values are present in 3GPP TS 48.058, V16.0.0 (2020-09).

Change-Id: Icf4c83fa443b8410f4362c119b0a85419036b9cd
2021-04-19 05:02:37 +02:00
Vadim Yanitskiy 307b201e8e protocol/gsm_08_58.h: add more 'Channel rate and type' values
The new values are present in 3GPP TS 48.058, V16.0.0 (2020-09).

Change-Id: I0aaea1549e6de01c374d6b46353312e6246078e0
2021-04-19 04:43:30 +02:00
Vadim Yanitskiy 99f6cd5f54 protocol/gsm_08_58.h: add RSL_CMOD_SP_{GSM4,GSM5,GSM6}
The new values are present in 3GPP TS 48.058, V16.0.0 (2020-09):

 * RSL_CMOD_SP_GSM4 - OFR AMR-WB or OHR AMR-WB,
 * RSL_CMOD_SP_GSM5 - FR AMR-WB,
 * RSL_CMOD_SP_GSM6 - OHR AMR.

Change-Id: I40eca759380c8895d7923b2b4259d37a50978160
2021-04-19 04:27:53 +02:00
Alexander Couzens 27a5592205 gprs_ns2: add functions for SNS add/del/change-weight messages
Related: OS#5036
Change-Id: Ib9492e213e82c18c7dcce6ba7d64e897b4c74796
2021-04-18 06:38:34 +00:00
Alexander Couzens 0a7c5eea22 gprs_ns2: SNS: allow transition missing transition GPRS_SNS_ST_UNCONFIGURED
A transistion from GPRS_SNS_ST_UNCONFIGURED -> GPRS_SNS_ST_UNCONFIGURED.

Related: OS#5036
Change-Id: I125e7e5a08ea6aff6e0308a18b5c0a6d0392ad32
2021-04-18 06:38:34 +00:00
Pau Espin 4da98cc943 cosmetic: Fix trailing whitespace
Change-Id: Ib79b0e0c728a7f4de0b3884785c73ab2d0d44f4e
2021-04-14 21:28:19 +02:00
Pau Espin d110529972 cosmetic: tlv_parser: fix typo in func description
Change-Id: I27f28376a88f00d86a0f65595f61f6026f7e0fd4
2021-04-14 17:21:02 +02:00
Pau Espin 8b913af11e gsm_08_08.h: Add extra field elements defined in other sections
The Signalling Field Element Coding list defined in 3.2.3 is used in
"Old BSS to New BSS Information" and "New BSS to old BSS Information"
IEs. However, the former IE (Old->New Info) defines 2 extra Field
Elements in 3.2.2.58 (3GPP TS 48.008 version 16.0.0 Release 16) not
present in 3.2.3.

Related: SYS#5337
Change-Id: I4db3f7974887e4c798a30c5b51a19472ceeee27d
2021-04-14 16:30:32 +02:00
Alexander Couzens 79a3a84b15 gprs_ns2: fix nsvc block and unblock vty command
e7dfeac8dc introduced a regression in the block/unblock check
as it was using the priv->initiate_block instead of priv->om_blocked.
The initiate_block tracks who is responsible to unblock the NSVC.

Fixes: e7dfeac8dc ("gprs_ns2_vty: print a response to vty `nsvc <nsvci> (block|unblock|reset)")
Change-Id: I516faea223e30b120a297faed10636daa554be8a
2021-04-13 12:38:44 +02:00
Vadim Yanitskiy 4b46b7eb53 vty/logging: logp: properly handle library specific sub-systems
The library specific sub-systems are kind of special, because their
position in the 'osmo_log_info' may vary depending on the number of
application specific sub-systems.  This is why their associated
constant values (like DLGLOBAL) are negative, and this is what
the LOGP() macro expects as the first argument.

Before this change, invoking 'logp' command with any library
specific logging sub-system would result in getting messages
printed with the fall-back DLGLOBAL sub-systems.

Change-Id: If86563e169fe1243adfa7b09c9d65d9f88c8a99e
2021-04-12 12:15:17 +00:00
Neels Hofmeyr 47c7b4fc24 add osmo_bts_features_names: short BTS feature strings
This will be used by osmo-bts-omldummy to parse features strings from
the cmdline.

Note that osmo_bts_feature_name() already exists to return the longer
descriptive value_strings from osmo_bts_features_descs (_descs!).
Luckily that misses the plural 'features' in the name, so that I can
still add a properly named osmo_bts_features_name() function that only
returns the name, matching the common pattern used in osmocom code.

Related: SYS#4895
Change-Id: I699cd27512887d64d824be680303e70fff3677c1
2021-04-09 00:10:44 +02:00
Neels Hofmeyr 524b4f802f deprecate osmo_bts_feature_name(), add osmo_bts_features_desc()
The function osmo_bts_feature_name() is ill-named for two reasons:
- it returns descriptive text instead of just a string representation of
  the name.
- The enum is named "osmo_bts_features", so the function name lacks the
  "s" for "features".

Rationale: An upcoming patch adds a function to return just the name,
properly called osmo_bts_features_name(), so deprecate the weirdly named
one first.

Change-Id: I9dfdb5e81037b6000effbd340af4e5db0dcfd69c
2021-04-08 23:11:45 +02:00
Oliver Smith d4393608a4 stats: have_value is a bool, not int
Change-Id: Id92c63f4e54ec1bf3411205be1bd268e1d184b03
2021-04-07 18:39:05 +00:00
Oliver Smith 2623fca8ad stats: log error when missing stats values (v2)
Related: SYS#4877
Change-Id: I5140d967c2f1d36dadf93b03e52b9bbd42e2a3a6
2021-04-07 18:38:54 +00:00
Oliver Smith c7930589fd stats_test: restore stat_item_get_next asserts
This is a partial revert of b27b352e ("stats: Use a global index for
stat item values"). Now that osmo_stat_item_get_next correctly returns
how many values have been skipped, we can use the accurate asserts on
its return value again.

Fix the initial values of next_id_a,b (1 instead of 0), so we don't get
a skipped value on the first read. This is needed, because b27b352e
refactored osmo_stat_item_get_next to have the next id as parameter
instead of the last read one, and the initial value was not adjusted in
the tests.

Related: OS#5088
Change-Id: I9d4cda2487a62f52361c24058363dfa90e502c63
2021-04-07 18:38:54 +00:00
Oliver Smith 6140194347 stat_item: make value ids item specific
Fix counting of values missed because of FIFO overflow in
osmo_stat_item_get_next(), by assigning a new item value id effectively
as item->value[n + 1].id = item->value[n].id + 1, instead of increasing
a global_value_id that is shared between all items and groups. With
global_value_id, the count of values missed was wrong for one item, as
soon as a new value was added to another item.

This partially reverts b27b352e ("stats: Use a global index for stat
item values") from 2015, right after stats was added to libosmocore. It
was supposed to make multiple readers (reporters) possible, which could
read independently from stat_item (and later added comments explain it
like that). But this remained unused, stats has implemented multiple
reporters by reading all stat_items once and sending the same data to
all enabled reporters. The patch caused last_value_index in struct
osmo_stat_item to always remain at -1.

Replace this unused last_value_index with stats_next_id, so stats can
store the item-specific next_id in the struct again. It appears that
stats is the only direct user of osmo_stat_item, but if there are
others, they can bring their own item-specific next_id: functions in
stat_item.c still accept a next_id argument.

Related: OS#5088
Change-Id: Ie65dcdf52c8fc3d916e20d7f0455f6223be6b64f
2021-04-07 18:38:54 +00:00
Vadim Yanitskiy 2d1a9fabcc vty/logging: ensure consistent '%' prefix for warnings
Change-Id: I2b2bab61e46668c3b4b0ccad88d02b6d00a83544
2021-04-07 16:33:18 +00:00
Vadim Yanitskiy ad34465349 vty/logging: use consistent quiting in warning messages
Change-Id: Ifded63a38caac26e174fc6cb69dead7bc83db344
2021-04-07 16:33:18 +00:00
Alexander Couzens e7dfeac8dc gprs_ns2_vty: print a response to vty `nsvc <nsvci> (block|unblock|reset)
The vty wasn't printing anything to the user if it was a success or not

Change-Id: Idbb83ea319bbdc94177febdd66e79c49fce7fdd2
2021-04-07 16:25:35 +00:00
Alexander Couzens 53e7009049 gprs_ns2: sns: remove the initial SNS NSVC if it's not part
A SNS configuration can be done over a NSVC, however this initial NSVC doesn't
need to be part of the configuration.
Those NSVC need to be removed when the configuration is done.
This wrong behaviour can be seen in the vty `show ns` on

NSEI 00001: UDP, ALIVE
 FSM Instance Name: 'GPRS-NS2-SNS-BSS(NSE00001-SNS)[0x55c72c09b420]', ID: 'NSE00001-SNS'
  Log-Level: 'DEBUG', State: 'CONFIGURED'
 Maximum number of remote  NS-VCs: 8192, IPv4 Endpoints: 8192, IPv6 Endpoints: 8192
 Local IPv4 Endpoints:
  10.0.0.1:23000, Signalling Weight: 1, Data Weight: 1
 Remote IPv4 Endpoints:
  10.0.2.2:23000, Signalling Weight: 1, Data Weight: 0
  10.0.2.2:23001, Signalling Weight: 0, Data Weight: 1
  3 NS-VC:
   NSVCI none: UNBLOCKED DYNAMIC data_weight=1 sig_weight=0 udp)[10.0.0.1]:23000<>[10.0.2.2]:23000
   NSVCI none: UNBLOCKED DYNAMIC data_weight=0 sig_weight=1 udp)[10.0.0.1]:23000<>[10.0.2.2]:23001
   NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[10.0.0.1]:23000<>[10.0.2.2]:8888

The UNCONFIGURED NSVC should not be present in when SNS is in CONFIGURED.

Related: SYS#5416
Change-Id: I4045ac6c033ae084743b17a16eef4fcff76589b9
2021-04-07 16:12:34 +02:00
Alexander Couzens cdb2baaa0c gprs_ns2: sns: ensure the sns->alive state is correct
The SNS fsms also track the NSE however since the NSVC
starts now in ALIVE for SNS the SNS must check when synchronize
the alive state when entering the ST_CONFIGURED.

Related: SYS#5416
Change-Id: Ib6a1cc1fd84959e69c07b72ef780642205d2cd18
2021-04-06 14:30:19 +00:00
Alexander Couzens 5b72247dde gprs_ns2: nsvc_fsm: reorder notification st_alive_on_enter()
The start_procedure() can't be called after ns2_nse_notify_unblocked()
because ns2_nse_notify_unblocked() might free the nsvc.
Otherwise the fsm will do use-after-free on the NSVC memory.

Related: SYS#5416
Change-Id: If97dfd123eefd71fc6c3fe886a243a21784aeeb4
2021-04-06 14:30:19 +00:00
Oliver Smith 43686dacd6 stat_item: add comment with struct overview
Related: OS#5088
Change-Id: Ic63a5884da778938197c658c5f478c23a85a4587
2021-04-06 11:27:34 +02:00
Oliver Smith d3490bc442 stat_item: make next_id argument name consistent
Let osmo_stat_item_get_next, osmo_stat_item_discard,
osmo_stat_item_discard_all consistently refer to their next_id arg as
such (and not idx or next_idx). It refers to an ID (item->values[i].id),
not an index (item->values[i]), and it is always the next one, never the
current one.

Do the same change for _index/_idx variables in stats.c, which are used
as arguments to these functions. Replace rd_ with next_id_ in
stats_test.c, too.

Related: OS#5088
Change-Id: I5dd566b08dff7174d1790f49abd2d6ac020e120e
2021-04-06 11:27:34 +02:00
Alexander Couzens 8bd63b667e gprs_ns2: vty: remove a white space in `show binds`
Change-Id: Ia3579ec5599f5f5c58eebab03f1ed9e17f171177
2021-03-31 06:00:44 +00:00
Alexander Couzens 7619ed4304 gprs_ns2: fix memory leaks when receiving SNS or invalid packets
Change-Id: I8834d3f092e6cbe4f527e95e1eebd8133a386207
2021-03-29 21:26:46 +00:00
Harald Welte c2fbbd7307 gprs_ns2_sns: Fix memory leak when creating ip[46]_local arrays
Prior to this patch, we would unconditionally allocate new memory
for the local SNS IP endpoints.   This results in a memory leak
on every SNS-SIZE procedure.

Let's move to talloc_realloc() which recycles any previously allocated
memory.

Change-Id: I12cb670e087c6d6190f3f5bf8483ea62008ae06f
2021-03-29 10:20:08 +02:00
Neels Hofmeyr 158bc795e5 add BTS_FEAT_VAMOS
Change-Id: Ic3bd1b8075f76d1f35499faa68fad70698ee9a00
2021-03-27 17:14:57 +01:00
Pau Espin 1c4195fad0 Skip RPM checks if no *.spec.in available
Some projects don't necessarily have RPM packaging yet. Hence, avoid
running into unexpected check results in that case.

Related: OS#5094
Change-Id: Id306256af1ab3bf081b7df5a6c271628e3b8715c
2021-03-26 13:50:45 +01:00
Harald Welte 3053bbb3f3 gprs_ns2_sns: Don't create NS-VCs for binds outside the NSE
We may very well have any number of binds configured, but which
are not part of the current NSE.  When creating the "full mesh" of
NS-VCs after SNS-CONFIG, we must only iterate over those binds that
are part of the NSE (or 'ipa-sns-default bind' in cae of SGSN role),
but not over all the other binds that may exist in the system.

Closes: OS#5092
Change-Id: Ida361fa02ad1d86844d54c8f0664c996ed28e30a
2021-03-24 16:18:15 +00:00
Harald Welte e8c6106c2e gprs_ns2_sns: remove code duplication in create_missing_nsvcs()
Change-Id: I78d79c3bc92f0c0bebbbbe639b8406c4b188582f
2021-03-24 16:18:15 +00:00
Alexander Couzens 27e5873c8d gprs_ns2: add vty command `nsvc <nsvci> reset`
Change-Id: I436dd0367e83548acfc8f8e36ae4707496a252d9
2021-03-24 15:42:45 +00:00
Alexander Couzens 1dd9cbf45e gprs_ns2: dump_nsvc: correct indention
As both `show ns entities` and `show ns binds` looking similiar
correct the indention.

Change-Id: I55794188bec7e62f0341188dbf23ac04006974fe
2021-03-24 15:42:45 +00:00
Alexander Couzens 0ea4a4e0c4 gprs_ns2_vty: make the `show ns entities` and `show ns binds` look similiar
`show ns binds` prints a count of NSVCs. Add the same line
to `show ns entities`.

Change-Id: I15c58a1c0fe94dda728afb29e7e5ca41e3fa8966
2021-03-24 15:42:45 +00:00
Alexander Couzens 3e539ed127 gprs_ns2_vty: hide dynamic NSE information when ask for persistant only
dump_nse() should only print persistant NSE when persistant_only
argument is set. A NSE can be persistant or dynamic configured.
Depending on the NSE all NS-VC must be the same as the NSE.

Change-Id: Ibd2c6962eda39a850ab61cf347063934378d2fdc
2021-03-24 15:42:45 +00:00
Alexander Couzens 75b6188974 gprs_ns2: always use the same method to print NSVCs
The binds also print a list of associated NSVC when
dumping the bind.
However the binds using their own representation of
printing the NSVC which is different to `show ns entities`.
Use the same function to print NS-VC.

Before:
  NSVCI 00000: udp)[127.0.0.1]:23000<>[127.0.0.1]:22000
After:
  NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[127.0.0.1]:23000<>[127.0.0.1]:22000

Change-Id: If31ec6c1c07dc134ab1ddeb915bc89747c7be048
2021-03-24 15:42:45 +00:00
Alexander Couzens 6cf65d9d81 gprs_ns2: rework logging of Rx and Tx NS PDU
Introduce 2 new logging sub systems for signal and unit data.
Unify log messages so all log messages look similiar.
Log also Rx PDUs. Ensure dropped Tx packets (BLOCK/RESET on SNS)
contain *Tx*.

Change-Id: I34b8fde2955ecc010d1dcd9512e1bba9211e2c0d
2021-03-24 15:42:45 +00:00
Harald Welte 2d807b6c7d gprs_ns2_sns: Compute local endpoints before using them
This fixes some bug introduced in Change-Id I1638f04ba45fef3ba0b237948dff6022267141fb

Related: OS#3373

Change-Id: Ic0873e63f1f046b674c7898480ff070a18a7abc7
2021-03-24 01:58:52 +01:00
Harald Welte 5e4083166a gprs_ns2: Actually start Tns-test after SNS-CONFIG creates NS-VC
the previous commit fixed the state transition, but also caused
neither Tns-alive nor Tns-test to run

Change-Id: I07ea3fd5cec3d4acf4051930a1a3c746d6fd597c
2021-03-24 01:04:21 +01:00
Harald Welte c51ddf27b4 gprs_ns2_vc_fsm: In IP-SNS/ALIVE mode, initial state is ALIVE/UNBLOCKED
Only when the ALIVE procedure fails, we mark a NS-VC as RECOVERING.

Change-Id: Ieb860827c2149306b135c0e6c8b3cd3bbb78851e
2021-03-24 01:04:21 +01:00
Harald Welte c962a2efc3 gprs_ns2: Add comments explaining the nsvc->sns_only field
Change-Id: I16009a1b03d8027de2be56b7d5013b755c9550fd
2021-03-24 00:30:23 +01:00
Harald Welte d164ef80f9 gprs_ns2_sns: Allow VTY configuration of default binds for IP-SNS
In the IP-SNS SGSN role, we need to inform the BSS of our local
IP endpoints.  For statically configured NSEs, those are explicitly
stated on a per-NSE level.

For dynamically created IP-SNS NSEs, we are adding a new VTY
command, using which the administrator can configure which binds
should be advertised as IP endpoints to such BSS.

Change-Id: Id01c29b07e9203c9305f2129361a4f5aaefa2c52
Related: OS#3373
2021-03-24 00:30:23 +01:00
Harald Welte fe0266e8d8 gprs_ns2: dynamic NS-VC + NSE creation for IP-SNS in SGSN role
Related: OS#3373
Change-Id: Ie10bb3531fae2e651da04f965d964de6eb1e7a97
2021-03-24 00:30:23 +01:00
Harald Welte 42e3646a98 gprs_ns2_vty: Permit VTY configuration of bind->accept_sns
Related: OS#3373
Change-Id: Ifb52cd245b10bf47d42d57d167d6d6c02b12ee12
2021-03-24 00:30:23 +01:00
Harald Welte 01fa6a3ef3 gprs_ns2_sns: Implement checks during processing of inbound SNS-SIZE
As per 3GPP TS 48.016 section 6.2.4.1, we need to perform some
consistency checks during the SNS-SIZE procedure.  Let's implement them.

Change-Id: I1638f04ba45fef3ba0b237948dff6022267141fb
Related: OS#3373
2021-03-24 00:30:23 +01:00
Harald Welte 24f4df5c46 gprs_ns2_sns: Assume the SGSN has a very large number of max. NSVC
It is the SGSN's job to ensure sufficient NS-VC capacity.  As the SGSN
doesn't tell the BSS, we should not make assumptions of only 4.

Change-Id: I41f493643cf51d7853959ab9c7bbc0ffae4e1f4b
2021-03-24 00:30:22 +01:00
Harald Welte 4e41acc1ad gprs_ns2_sns: SNS-SIZE contains the actual number of local endpoints
The SNS-SIZE sent from BSS to SGSN contains the actual number of local
IP endpoints on the BSS side, and not the maximum number of remote IP
endpoints supported.

Change-Id: I62a8bca4a3f7c47bcb9f292b045fa867d8877a09
2021-03-24 00:30:22 +01:00
Harald Welte a2c5af5547 gprs_ns2_sns: Verify mandatory IE presence in incoming SNS-SIZE
Change-Id: I40571e313c3332d8cead8fb4aa9768d0d083804d
2021-03-24 00:30:22 +01:00
Harald Welte 46eb7643c9 gprs_ns2_sns: Don't clear remote IP endpoints in SGSN role
In BSS role, we can clear local + remote endpoints when sending
SNS-CONFIG, as we are first.

In SGSN role, we must not clear remote endpoints when sending
SNS-CONFIG, as we are last, and the BSS has just previously told
us its IP endpoints in the BSS-originated SNS-CONFIG.

Change-Id: I58549707ac5a3a0aae5f9348ed76f16c09ad3e46
Related: OS#3373
2021-03-24 00:30:22 +01:00