Commit Graph

27 Commits

Author SHA1 Message Date
Vadim Yanitskiy 64277a0217 doxygen: fix various typos in commands \param and \returns
Change-Id: If87cec3739449c6a54e24fb2cb81e746d8244da2
2023-02-28 18:48:56 +00:00
Alexander Couzens d802f9ae6e ns2: message: allow to pass a foreign NSVCI to STATUS PDU
To answer correct on a BLOCK PDU with a different NSVCI, the
STATUS PDU needs also a NSVCI parameter.

Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa
2021-10-08 05:43:46 +00:00
Alexander Couzens a2b846be2f ns2: ensure the NSVC is in the correct mode for NSVC UNKNOWN/NSVC BLOCKED cause codes
Those cause codes are only valid for BLOCK/RESET NSVCs.

Change-Id: I560f1c8c2826befd03641bebffe156ac070061c2
2021-10-08 05:43:46 +00:00
Alexander Couzens 67cfc5dc9a ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of using the nsvc nsvci
The BLOCK and BLOCK ACK PDUs can be send over a working NSVC to inform
the NSE that a NSVC is blocked.

Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
2021-10-08 05:43:46 +00:00
Alexander Couzens eec4f608b5 gprs_ns2: fix NS STATUS validation
The wrong TLVs were used.

Change-Id: I01339d93469285cc5340500717ab2b696284e12a
2021-09-07 20:46:04 +02:00
Daniel Willmann efa64f9429 Aggregate NSVC stats inside the NSE
Change-Id: Ifa3c85ec52bda14596e9d7a8705baa1fd4ee2010
Related: OS#4998
2021-07-09 20:35:00 +02:00
Alexander Couzens 6ba77a3770 gprs_ns2: fix wrong format string in Tx Size logline
Don't use %u for integer.

Change-Id: I324836ec4943c97f0dbc16ade697c468eba02b35
2021-07-06 09:50:00 +00:00
Pau Espin 7b894a7de0 Use new stat item/ctr getter APIs
Generated with spatch:
"""
@@
expression E1, E2;
@@
- &E2->ctr[E1]
+ rate_ctr_group_get_ctr(E2, E1)
"""

"""
@@
expression E1, E2, E3;
@@
- E2->items[E1]
+ osmo_stat_item_group_get_item(E2, E1)
"""

Change-Id: I41297a8df68e28dfc6016330ac82b0ed5dd0ebc1
2021-06-04 18:19:37 +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 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 22274dfeb5 gprs_ns2: Log all transmitted SNS messages
We already have similar log statements for all NS-{RESET,BLOCK,UNBLOCK,...}
and it's confusing that even a debug-level NS log file doesn't show
transmitting SNS messages at all.

Change-Id: I0d31c3911d3acd6ac7296c370e920d53412d8289
2021-03-04 13:35:14 +01:00
Alexander Couzens ce646c2371 gprs_ns2_message: tx_status: move all cause dependent code into the switch/case
Change-Id: I8f1e0962c6f5f0c7287990bb7608d0cc9b86dfdb
2021-02-19 10:41:50 +00:00
Alexander Couzens cf1fa6351b gprs_ns2: truncate the NS_STATUS to the MTU
A NS Status can contain the original NS message which might result
in a NS PDU which exceeds the MTU of the NS-VC.
Truncate the original message to the maximum possible.
Based on truncate BSSGP status message.

Related: OS#4889
Change-Id: I35d8f8bf0eae890f4db56423da0b23b638d24311
2021-02-19 10:41:50 +00:00
Harald Welte f22ae5af5f ns2: count number of dropped packets / bytes on transmit
Differentiate between successfully transmitted packets/bytes,
and pacets/bytes that were dropped (i.e. overflow of net-device)

OsmoNSdummy# show ns nsvc 1001 stats
 NSVCI 01001: UNBLOCKED PERSIST data_weight=1 sig_weight=1 fr)netif: hdlc1 dlci: 1001
  NSVC Peer Statistics:
   Packets at NS Level  ( In):       36 (0/s 8/m 32/h 0/d)
   Packets at NS Level  (Out):    23344 (170/s 20556/m 13119/h 0/d)
   Dropped Packets      (Out):    30692 (230/s 27056/m 17221/h 0/d)
   Bytes at NS Level    ( In):      262 (0/s 24/m 250/h 0/d)
   Bytes at NS Level    (Out): 32741312 (238680/s 28849400/m 18391024/h 0/d)
   Dropped Bytes        (Out): 43014628 (322920/s 37986624/m 24101344/h 0/d)

Change-Id: If21906ff5379038f7be10cf48c68d1f756dd7c1e
2021-01-31 12:34:36 +01:00
Harald Welte e5f55f73bd ns2: Increment Rx and Tx byte / packet counters
Change-Id: If5e93f69cddbc8962cbbae38c07b504dd9b1ecd1
2021-01-31 12:34:36 +01:00
Harald Welte 5a5bf720a8 ns2: encapsulate calls to nsvc->bind->send_vc()
Don't call the function pointer of the underlying transport
directly, as we many still want to do some common processing,
such as statistics counting (see follow-up patches).

Change-Id: I8d14c7b8d3aacc2bed033072d7934dbd6aab41df
2021-01-31 12:34:36 +01:00
Harald Welte 3d5eaee726 ns2: Use named array initializers to avoid mistakes
It's always a bad idea to have an array of descriptions that's indexed
by an enum, without using named initializers.  It's too easy to get
inconsistencies.

Change-Id: Id0ebd2a202a465ca0298f4245f1fb5c495235fc8
2021-01-31 12:34:36 +01:00
Alexander Couzens f7e2cace2c gprs_ns2: drop the public prefix gprs_ from all static functions/structs/..
Change-Id: I6ba0599e5a6d6fabf93851dd3ec7716f2ef2d840
2021-01-25 16:18:21 +01:00
Alexander Couzens 8dfc24cb47 gprs_ns2: drop prefix of all internal exposed function
All functions which are exposed by gprs_ns2_internal.h should not contain
the public prefix gprs_. Internal function should only contain ns2_ prefix.

Change-Id: Icecc5a918902cd10efac72bbac20780d39aab272
2021-01-25 16:09:23 +01:00
Harald Welte f294974e05 ns2: Unify logging context via log macros
Let's avoid open-coding the printing of log context and rather rely on
log macros to prefix each log line with the relevant context.  This
helps log readability, log post processing whether by grep or more
sophisticated tools.

Change-Id: I946c0e77686d91efc5afb62031e1ac1033a9a586
2021-01-20 16:42:33 +00:00
Alexander Couzens 718e37e5cc gprs_ns2_message: remove wrong comment
It's a leftover from converting NS1 -> NS2 code

Change-Id: I934c7905f8396e74bb1f14d68097c03463816720
2021-01-20 16:42:33 +00:00
Daniel Willmann 89a00f352d ns2: Fix memory leak in IP-SNS
Don't allocate msg twice - it's not nice.

Change-Id: I3fa0076eb480a7bcadb74cc86760dc29b77ac600
Related: OS#4874
2021-01-17 14:20:28 +01:00
Harald Welte 798efea27e gprs_ns2: Use TLVP_PRES_LEN instead of TLVP_PRESENT
With TLVP_PRESENT we only check if a given TLV/IE is present,
but don't verify that it's length matches our expectation.  This can
lead to out-of-bounds reads, so let's always use TLVP_PRES_LEN.

Change-Id: I4c438bc82ea6a48243db568f96a234adf784dc0b
2020-12-04 18:20:15 +00:00
Daniel Willmann 751977be6f ns2: Add log filtering by NSE/NSEI, fix NSVC filter on receive
NSVC filtering was only implemented on sending messages, this also adds
log_set_context() calls to  ns2_recv_vc()
Filtering by NSE is implemented similar to NSVC.

Change-Id: I63c0e85f82f5d08c5a6f535da94b8648498439d2
Related: SYS#5232
2020-12-03 15:14:18 +01:00
Harald Welte b40cfdc54b gprs_ns2: Mark gprs_ns2_validate_* as static
They are all called indirectly via gprs_ns2_validate(), so mark them
as static.

Change-Id: I8425ed3da32019b86cf12d3c27132f07d931cf27
2020-09-18 23:14:36 +02:00
Harald Welte 5bef2cc4bd ns2: Improve/extend doxygen comments for new ns2 implementation
I was reading through the code and noticed many functions not
documented yet, or with incomplete documentation. Change that.

Change-Id: I85a2419604a9fd9ff3c4828a7463e222652f77bf
2020-09-18 23:14:36 +02:00
Alexander Couzens 6a161497cf Gb: add a second NS implementation
Reimplement NS with FSM.

Change-Id: I3525beef205588dfab9d3880a34115f1a2676e48
2020-09-15 11:54:41 +00:00