Commit Graph

3885 Commits

Author SHA1 Message Date
Oliver Smith cc775c38f4 Bump version: 1.5.1.1-6be7 → 1.5.2
Change-Id: I18dee970409b16a9a30eb0c2206c4ef3a7b00cd3
2021-09-24 14:09:54 +02:00
Philipp Maier 6be7e9dac0 gsm0503_coding: use ahs tables when encoding ahs codec id
The encoder function gsm0503_tch_ahs_encode uses gsm0503_afs_ic_ubit
when encoding the CMR or FT (depends on the frame number). This is not
correct. It should use gsm0503_ahs_ic_ubit instead.

Change-Id: Id250b2102ac79ff222bd3ad9d1abc4b60abdd12b
Related: SYS#5549
2021-09-24 14:08:15 +02:00
Harald Welte 4bedb53b34 Bump version: 1.5.0.3-45cf → 1.5.1
Change-Id: I6eea93d9723f7e6ffd1f9eb3d260a5b666cb2124
2021-02-24 09:35:21 +01:00
Harald Welte af52bcc5a0 attempt to fix RPM spec file after recent soversion bump
In I3bc0826c0000be4d76235ed6b5be86d216ea2e4d the soversion was
chhanged (e.g. libosmocore.so.16 to libosmocore.so.17) but the
spec.in file was not adjusted accordingly.

Change-Id: Id7e1e3feef6bda1a2d2a615a61635e22d550b5a3
2021-02-24 08:28:30 +00:00
Pau Espin 181578355b osmo-release.sh: Fix rc!=0 on TODO-RELEASE file without comment lines
Change-Id: Iff09a090284a0f65fd798d99265cba51f3309923
2021-02-23 14:31:11 +01:00
Pau Espin Pedrol f286fdc87e Bump version: 1.4.0.535-e387-dirty → 1.5.0
Change-Id: I3bc0826c0000be4d76235ed6b5be86d216ea2e4d
2021-02-23 14:03:31 +01:00
Pau Espin Pedrol e3870b30ef osmo-release.sh: Omit tab whitespace matching debian/control versions
Change-Id: I054245b54adfaae3d51bcfc3a3d1e3ecbaa5f116
2021-02-23 13:54:30 +01:00
Harald Welte fcbf3470b9 CBSP: Fix encoding of warning period
The warning period encoding was wrong, resulting in way too short
warning periods being encoded than intended/specified by the caller.

Change-Id: Idf3cae48a6ab45550d7bbd937bb49a0e1a4e8aed
2021-02-22 10:06:12 +01:00
Harald Welte 48f22b0e87 CBSP: fix encoding/decoding of keep-alive repetition period
Even though the value is only between 0..120s, they didn't encode
it 1:1 in the uint8_t, but 3GPP chose to use the same encoding
as for the warning period (which has a much larger range).

Let's fix this in our implementation.

Before this patch, osmo-cbc wanted to send 30s keep-alive repetition
period, but a spec-compliant receiver actually decoded this as 80s.

Change-Id: I04baa6b6b99b092fa0512b3b6138a363c7f3a13d
2021-02-22 09:58:00 +01:00
Harald Welte 3217d5187f support for stats static userspace probes via systemtap
We currently only have probes for the logging sub-system.

This patch adds two tracepoints for tracing the performance
impact of statistics reporting: stat_start and stat_done.

They can be used to trace the amount of time a libosmocore-using
application spends in reporting/exporting statistics.  This includes
both the CPU time for encoding the statistics, as well as the system
calls for sending them.

Change-Id: I7208c45f6d051505dd2435305c67b4d26c0b1dd2
Related: OS#4311
Related: SYS#4877
2021-02-22 09:58:00 +01:00
Pau Espin 6e9dd02bf8 logging: Deprecate API log_set_print_filename
Let's flag the API as deprecated so that people start using
log_set_print_filename2() API instead, which has less ackward
behavior implications like changing the print status of category-hex.

Related: OS#5034
Change-Id: If9b6b322989536a12094e6105c3aabc84d8be24a
2021-02-20 17:13:58 +00:00
Pau Espin 01e0d3e7fd Drop use of log_set_print_filename() API inside libosmocore
Let's use log_set_print_filename2() API instead, which has less ackward
behavior implications like changing the print status of category-hex.

Related: OS#5034
Change-Id: Ifc78e1dcba5baf0b41f6ccbbbd1e3f06552d73da
2021-02-20 17:13:58 +00:00
Pau Espin 690b661fbc tests: Set print_category values explicitly
This will alow easily changing default values for print_category vs
print_category_hex later.

In any case, every test relying on logging output validation should
always explicitly state the config to avoid issues in the future if
default values change.

Related: OS#5034
Change-Id: If29b40557d5c2bcda04b964f344070bad58d8f28
2021-02-20 17:13:58 +00:00
Alexander Couzens 2665388e26 gprs_ns2: free_nse: free the SNS fsm early
If the SNS fsm isn't freed early, the SNS code will re-create a NSVC
when calling free_nsvc().
Fixes libasan heap-use-after-free.

Change-Id: If350df1d8d6dcea5715dd23b8bd1d684098cdb1f
2021-02-19 12:57:23 +01:00
Pau Espin 662d10dcda logging: Allow prefixing thread ID to each log line
Related: OS#5032
Change-Id: I38fc93ab0182b4edbd639c7ed0f31ce51964ee18
2021-02-19 11:21:46 +00:00
Alexander Couzens 7bb39e368d gprs_ns2: ensure no duplicate UDP NSVC can be created
Change-Id: I58a95817e2730bbbaa851a43a5b072d1de2db037
2021-02-19 10:41:50 +00:00
Alexander Couzens b2de546a5c gprs_ns2: add value_string for GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS
Change-Id: I7c9245be248cb8697a370f80021612c14efa5cbb
2021-02-19 10:41:50 +00: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
Alexander Couzens 3de1cb0d72 gprs_ns2_fr: pass MTU changes to the NSE
When the MTU of the frame relay device changes, update the bind
and notify all NSEs.

Related: OS#4889
Change-Id: I946f7655c9526ffd98dabdce219c6a419b71e00c
2021-02-19 10:41:50 +00:00
Alexander Couzens 67725e2920 gprs_ns2_sns: rename fsm events to include RX or REQ prefix
An event which originates by a received PDU is prefixed by RX.
An event which originates by code gets a REQ prefix.

Fixes: OS#5014
Change-Id: Ia8a6378cdca19b086e89058b1cc055f45c0bba7b
2021-02-19 10:41:50 +00:00
Alexander Couzens 6df1160873 gprs_ns2: make gprs_ns2_recv_prim() always take msgb ownership
Have a clear ownership of the msgb to prevent any leaks.

Related: OS#5022
Change-Id: I67e70561e7aae4d4556a02f03a8af6c2daf5ff9c
2021-02-19 10:41:50 +00:00
Alexander Couzens 9e81a32286 gprs_ns2: fix typo in function name ns2_load_sharing_modulo
It's a modulo operation, not modulo*r*.

Change-Id: I0345f2bcac9c57cf7efe8ff27fda4d049e04d5cc
2021-02-19 10:41:50 +00:00
Alexander Couzens d8a8d98053 gprs_ns2: implement a simple load sharing for UDP
Implement the load sharing based on modulo of the LSP. As long the gprs_ns2 doesn't
support the resource distribution function (48.016 § 4.4a) this simple
approach is good enought.

Fixes: OS#4836
Change-Id: I8c2fe5d647694886ac600470fca6ea5d5d210a85
2021-02-19 10:41:50 +00:00
Alexander Couzens bf5d0dbdec gprs_ns2_vty: add optional argument signalling and data weights to `nsvc udp`
A static configured UDP NSVC can have signalling and data weights

Related: SYS#5354
Change-Id: Id363937c64e786c55e3136401ebdb44052415e0f
2021-02-19 10:41:50 +00:00
Alexander Couzens 6b9d232421 gprs_ns2: rework IP-SNS binds
Introduce a `ip-sns-bind BINDID` vty command within a `nse` vty object.
The ip-sns-bind defines the binds which will be used by the dynamic
configuration with IP-SNS.
This is only the first part which only uses the binds when doing a
new SNS configuration.
The outgoing add procedure will be supported in a later patch
when the SNS fsm supports outgoing procedures.

This is a behaviour change of the API and must be synchronized with
the osmo-pcu. Otherwise SNS won't work with osmo-pcu.

Related: SYS#5354
Change-Id: I9ab8092bf286e7d90e92f5702a5404425e959c84
2021-02-19 10:41:50 +00:00
Pau Espin Pedrol d7a209bce9 gsm: Introduce API osmo_gsm48_rest_octets_si13_decode
Related: SYS#5358
Change-Id: I74fb0a3afc1ac4aadbfc609b882d929401f790eb
2021-02-18 00:54:33 +00:00
Pau Espin 74dddefcc7 logging: gsmtap: Store TID instead of PID in pkt hdr
This allows differentiating threads withing an application, while still
keeping same numbering for single-threaded application (since first
thread ID is always the same as the process group ID).

Related: OS#5027
Change-Id: I33da02524fc064e133b2b762af7060139c4cfd81
2021-02-17 18:55:46 +01:00
Pau Espin 2f765f02af logging: gsmtap: Fix fill PID field not stored in network byte order
Recent commit filling this field forgot to convert it to network byte
order.

Related: OS#5027
Fixes: bb149ecda2
Change-Id: I50857f35cb28138fa6f28100afeaa00f492f303a
2021-02-17 18:51:25 +01:00
Pau Espin 88e4058fc4 Introduce osmo_gettid() API
This API wraps conventional gettid() linux-specific API, which even in
Linux itself is sometimes not properly supported/announced.

This API also allows future porting to other platforms if needed, and so
far falls back to getpid() if no gettid(9 can be found.

Code ported from osmo-trx.git, see commit 7a07de1efd4eb7cc11c33d3ad25cb2df70aa1ef1.

Related: OS#5027
Change-Id: Id7534beeb22fcd50813dab76dd68818e2ff87ec2
2021-02-17 18:24:17 +01:00
Philipp Maier ca770ae77e gsm_08_58, gsm_44_004: add struct for l1 information
Libosmocore currently does not offer any structs to encode and decode
the l1 information on RSL level and the sacch l1 header on the air
interface level. Both structs are identical but the field order in the
first octet is reversed.

Change-Id: I23c1890b89d5a0574eb05dace9f64cc59d6f6df7
2021-02-16 21:42:04 +01:00
Pau Espin bb149ecda2 logging: gsmtap: Fill PID field for each message
It was recently discovered that PID field in gsmtap log messages was
always set to 0. Before this patch, the field was never being set.

The approach of this patch is to record the PID of process one, in
order to avoid calling getpid() syscall on each
log line to be sent. The counterpart of this optimization is that
eventual fork() calls would still keep the old incorrect value, but I
think nobody can safely assume that fork() is possible once all this
kind of infrastructure has already been configured (fork() should only
be done really at the start of the program before any osmocom foo is
initialized, or to immediatelly call exec()).

Related: OS#5027
Change-Id: I7db00d1810f0860166bffa0bda8566caa82e06a9
2021-02-16 17:24:48 +01:00
Alexander Couzens 4f1128fcbd gprs_ns2: inform the NS user (BSSGP) about the MTU of a NSE
The BSSGP layer needs to know the MTU of the NS UNIDATA payload.
The MTU can be 0 if the NSE doesn't contain any NSVC.
Every status indication will contain the mtu value.
The MTU in the status indication contains the maximum transfer
unit of a BSSGP message. From NS side the maximum SDU.

Related: OS#4889
Change-Id: I5016b295db6185ec131d83089cf6c806e34ef1b6
2021-02-16 16:29:47 +01:00
Pau Espin 524898504a gsm: Fix encoding of gsm0808_cell_id_list2 with CGI-PS types
CGI-PS type doesn't exist in GSM 08.08 Cell Id lists. That type of cell
id is osmocom-specific and used internally. In here CGI-PS is
automatically converted to CGI (since the later is an extension of this
one).

The encode/decode_cell_id_u are left intact (comment added) since those
can still be used (and are used by RIM code) to encode/decode TS 48.018
Cell Identifiers.

Related: SYS#4909
Change-Id: Id74f4577c397c1ba696f00395858311bd82cb2c8
2021-02-15 16:42:46 +01:00
Pau Espin 85a0f1143d gsm0808_utils: Move static function further up in file
It's a static internal function, so it makes sense to have it at start
of its related section.
It will be used by other functions in follow up patches.

Change-Id: I60f61f8f7bb6543feb068bdcee76d3b752565c95
2021-02-15 16:25:35 +01:00
Pau Espin 20b763d0af gsm: Support converting to cgi-ps in gsm0808_cell_id_from_cgi()
This is not really used nowadays, but added for completeness in case
someone wants to use it.

Change-Id: I1361b044bd897d04133cda6fd62c16852700b17a
2021-02-15 16:18:26 +01:00
Pau Espin 1bd495a787 comsetic: gsm0808_test: Fix trailing whitespace
Change-Id: I7f48e292fefe555939129f4000303e630a12cc50
2021-02-15 16:16:41 +01:00
Alexander Couzens 23aec35750 gprs_ns2_sns: fix typo in doxygen comment
Fixes: 5bef2cc4bd ("ns2: Improve/extend doxygen comments for new ns2 implementation")
Change-Id: I21b51791aa149d9a5b13169d1cf8c2857c55774a
2021-02-15 10:59:10 +00:00
Alexander Couzens e052c411e2 gprs_ns2: fix comment of alive NS-VC
There is no active NS-VCs only alive or dead.

Change-Id: Idb5d2ae4a99a472e38601ff841b8046ecf89d1bc
2021-02-15 10:40:54 +00:00
Harald Welte 094226866b BVC FSM: Treat overlapping BVC-RESET as implicit ACK
If the BSS (or SGSN) has sent a BVC-RESET PDU for a BVCI to the SGSN (or
BSS) and is awaiting a BVC-RESET- ACK PDU in response, but instead
receives a BVC-RESET PDU indicating the same BVCI, then this shall be
interpreted as a BVC-RESET ACK PDU and the T2 timer shall be stopped.

Related: OS#4974
Change-Id: I4d15733f9f205cb563b66ef9e41dc8df50151900
2021-02-15 10:06:55 +00:00
Alexander Couzens f46ebcd3ae gprs_ns2_vc_fsm: remove debug line of the alive_timer
The log line sneaked in when fixing the alive ms

Fixes: ab0e8646c4 ("gprs_ns2_vc_fsm: use CLOCK_MONOTONIC for alive elapsed timer")
Change-Id: Iffe367b240f47c39232bbc26991c19752a1c75ad
2021-02-15 03:45:35 +01:00
Pau Espin Pedrol 288f9b2486 gsm: Fix bitfield order in dtap_header
This bitfield was added later and all osmocom code still uses the old
field contain 1 byte "link_id". There's only one known user of the new
bitfield which only uses it to log the SAPI name in osmocom, so no
logical breakage is expected with this change (other than fixing a log
line).

While at it, fix a typo in comment describing related enum.

Related: SYS#4909
Fixes: 392f607f2d
Change-Id: I84866f03ee642aa7f1da273c93a16a38234cfa67
2021-02-13 08:05:30 +00:00
Daniel Willmann 4e5cdad658 bssgp_bvc_fsm: Consistent naming
bssgp_bvc_get_features_* are fsm "methods" and the name should indicate
that just lika all other function names in bssgp_bvc_fsm.h

Change-Id: I30fbbe36cdabf9635eaf4dfb1e93c8ce0f667b39
2021-02-12 22:27:56 +01:00
Daniel Willmann fa632b8e80 bssgp2_enc_status: Truncate STATUS message to maximum PDU length
Related: OS#4889
Change-Id: Ic39d918c56399ceb0431299ce938e3bf276f678a
2021-02-12 14:19:20 +00:00
Daniel Willmann 1ff86f7cec bssgp_bvc_fsm: Set/get maximum BSSGP PDU length
Add functions to get/set the maximum supported BSSGP PDU size by the NS
layer.

IPv4 and IPv6 should not matter since we can just enable IP
fragmentation and send NS PDUs up to 2**16 + bytes. Frame relay does not
support fragmentation and this is the reason we need to be aware of the
maximum PDU size. Luckily with 1600 bytes the MTU in frame relay can hold a
regular IP packet including NS/BSSGP overhead.

On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA
(3GPP TS 48.016 Ch. 9.2.10)

Change-Id: I9bb82ead27366b7370c9ff968e03ca2113ec11f0
Related: OS#4889
2021-02-12 14:19:20 +00:00
Daniel Willmann ae9899561c tests/gb: Add more complex osmo-ns-dummy.cfg
write config will not print out any configuration for bind/nse unless we
configure some. This way we can catch more issues with incompatible
configs such as https://gerrit.osmocom.org/c/libosmocore/+/22878

Change-Id: Iad422ee013c82a6cb96af8ce4eb3af8b0936a4c9
Related: OS#4887
2021-02-12 12:50:02 +01:00
Daniel Willmann 64db6366fd ns2: Fix incompatible VTY configs when writing config
It seems like we still don't have NS2 VTY tests running in libosmocore
so this only got caught once osmo-sgsn/osmo-gbproxy builds failed.

Change-Id: Id3cd407b05457a4703ee38c4b1b1b65800bbd30e
Related: OS#4887
2021-02-12 12:25:30 +01:00
Alexander Couzens b7921738be gprs_ns2_vty: use strcmp() instead of strncmp()
Otherwise substring wouldn't be detected.
E.g. local vs local2

Change-Id: I183b5176a1d8a295b7551ad186b3565adeb3d5e7
2021-02-12 08:57:34 +00:00
Alexander Couzens fa4121de2f gprs_ns2_vc_fsm: reset the alive elapsed timeout everytime
The alive elapsed timeout was only set once on the start of the
test procedure but not every time an ALIVE PDU was sent.

Fixes: OS#4997
Change-Id: I029696dfff21919f97ac4c33cdd82162b5ab1555
2021-02-12 08:57:29 +00:00
Alexander Couzens ab0e8646c4 gprs_ns2_vc_fsm: use CLOCK_MONOTONIC for alive elapsed timer
gettimeofday can jump and the comment says it should not be used for elapsed timer.

Related: OS#4997
Change-Id: I41989d8f9f82f4d1f7b97f11577653699365c8ae
2021-02-12 08:57:24 +00:00