Commit Graph

1491 Commits

Author SHA1 Message Date
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 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 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 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
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 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
Alexander Couzens c470476923 gprs_ns2: add signalling & data weights for UDP binds
Allow to assign a signalling and data weight to UDP binds.
Those weights will be used when doing dynamic configuration over
IP-SNS.
This is only the first part which only uses the assigned weights
when doing a new SNS configuration.
The outgoing change weight procedure will be supported in a later patch
when the SNS fsm supports outgoing procedures.

Related: SYS#5354
Change-Id: I5133e4229377d44772a9af28628a2bc420fea34b
2021-02-12 03:34:32 +01:00
Pau Espin 15b5acb332 Fix struct bitfields on big endian systems
Changes done by contrib/struct_endianess.py.

Change-Id: Ia9cb1ef2ba2bfff9ef713c7d1cf388931dae1c46
2021-02-08 17:23:25 +00:00
Vadim Yanitskiy 53aff13af4 tlv: clarify documentation for msgb_tv{16,32}_put()
Change-Id: Ie439822e0587012e108f67ba4e73771dc684b95b
2021-02-06 16:09:13 +00:00
Vadim Yanitskiy d397a53cfc tlv: add msgb_tv32_put(), similar to msgb_tv16_put()
Change-Id: I11301b20038aa5d90d46d968f7eda3d53b560022
2021-02-06 16:07:54 +00:00
Philipp Maier d11a5d5b9a gsm48: add compare function for struct gprs_ra_id
Comparing struct gprs_ra_id using memcmp can be error prone, so lets add
a compare function to compare two struct gprs_ra_id values reliably.

Change-Id: I4d7558c04d9d01761516526086be5104bb2eeada
Related: SYS#5103
2021-02-04 15:17:41 +01:00
Harald Welte 2cc1d4d7df frame_relay: Add status call-backs for link + DLC status changes
Change-Id: Iec19db4e48642c3fcb0aa11fa7787b8323fd0e5a
Related: Os#4999
2021-02-02 11:37:48 +00:00
Vadim Yanitskiy 943133cad8 gsm_7bit_encode_n(): fix integer overflow in gsm_septets2octets()
Using 'uint8_t' for the length argument is definitely a bad idea.
Because of this, packing more than 255 septets would not work as
expected.  Deprecate the old function and use 'size_t' instead.

Change-Id: Ib1aac538afeb0a5c76a1df472d555139a496e12e
2021-02-01 17:47:54 +00:00
Oliver Smith af916f1c7b sim: fix gcc 4.9.2 + -std=gnu11 error
Remove "(const struct osim_card_sw)" infront of OSIM_CARD_SW_LAST, so
debian 8's gcc 4.9.2 doesn't fail anymore with the following error each
time the macro is used:
	card_fs_sim.c:105:1: error: initializer element is not constant

I verified with docker that there aren't any other build errors with gcc
4.9.2.

Fixes: OS#4991
Change-Id: I9d3abbf9812dc09201eff0e9f7542cddedb6848b
2021-02-01 09:19:34 +00:00
Harald Welte a3f7323288 ns2: Fix typos in comments
Change-Id: I155fd697e229621561f7d00204421ac941101d77
2021-02-01 09:39:29 +01:00
Philipp Maier 4d40047c50 gprs_bssgp: agregate RIM related code in gprs_bssgp_rim.c
gprs_bssgp and gprs_bssgp_util.c also contains code related to send and
receive RIM PDUs via BSSGP and also code to encode and decode RAN
INFORMATION PDUs. Lets move this to gprs_bssgp_rim.c

Change-Id: Icda279452962b06e552cb1361d2a27b7dc8a6b04
Related: SYS#5103
2021-01-29 21:27:18 +00:00
Pau Espin 3e3f377749 gsm: bts_features: Introduce BTS_FEAT_CCN
This feature is used by BSC to gain knowledge on whether a given BTS
supports GPRS Cell Change Notification (CCN) related procedures on PDCH,
and as a result enable or not by default the CCN_ACTIVE bit in SI13 to
announce the support it is allowed to use the feature.

Related: SYS#4909
Change-Id: I61991266b95d0c13d51b47906cc07846e9cf1390
2021-01-29 18:01:14 +01:00
Pau Espin 5f2b8e5edf cosmetic: fix typo in comment
Change-Id: I787cca5a032c57202a86dab18e1790ef3ad1509a
2021-01-29 17:04:14 +01:00
Alexander Couzens 2e1a3a982a gprs_ns2: remove api call gprs_ns2_dynamic_create_nse
The call was only introduced as workaround for the first implementation
of vty. There is no need for this anymore. The configuration can
just add "accept-ipaccess" to the bind to allow creation of dynamic
ipaccess NSE.

Change-Id: Ie924ead6da17657f3da334068c8ada82c8845495
2021-01-28 13:54:32 +01:00
Alexander Couzens da1bf8e835 gprs_ns2: drop gprs_ns2_vty, rename vty2 -> vty
Drop the vty(1) code and replace it with vty2. The vty(1) was only
used as intermediate to not develop a vty while developing a new
code base behind. Users of gprs_ns2_ has to use the new vty code.

API change which must be synchronized with osmo-pcu,
osmo-gbproxy, osmo-sgsn.

Change-Id: Ic2059e75d8ede8e5c29c4fef6be608ed79c8a97c
2021-01-28 13:54:24 +01:00
Pau Espin caf5317412 Revert "gprs_ns2: drop gprs_ns2_vty, rename vty2 -> vty"
This reverts commit b306094448.

It was merged too quickly and patches for projects using related
features are not yet prepared.

Change-Id: I8a2aaf74a47de8f4f0adb37d16426d199788e3fe
2021-01-28 13:38:23 +01:00
Alexander Couzens b306094448 gprs_ns2: drop gprs_ns2_vty, rename vty2 -> vty
Drop the vty(1) code and replace it with vty2. The vty(1) was only
used as intermediate to not develop a vty while developing a new
code base behind. Users of gprs_ns2_ has to use the new vty code.

API change which must be synchronized with osmo-pcu,
osmo-gbproxy, osmo-sgsn.

Change-Id: I8c3f2afecc74b78f7f914f7dce166cbcb63444eb
2021-01-28 11:56:37 +00:00
Alexander Couzens 138b96f21c gprs_ns2: refactor: ensure all enums have GPRS_NS2_
All public enum should have the prefix GPRS_NS2_.

API change which must be synchronized with osmo-pcu,
osmo-gbproxy, osmo-sgsn.

Change-Id: I548ff12f7277cbb7e1a630a3dc02b738ce89be72
2021-01-28 11:56:37 +00:00
Philipp Maier c08a3fd30e gprs_bssgp_rim: add functions to convert a RIM-RI to a string
RIM routing formation structs can contain different variants of address
identifiers, so it is difficult for an API user to pick the _name()
function to generate a human readable string. Lets add
bssgp_rim_ri_name() and bssgp_rim_ri_name_buf() to make printing a
routing identifier easier.

Change-Id: Idca6bdccffe663aea71a0183ca3ea5bb5b59e702
Related: SYS#5103
2021-01-26 16:36:53 +01:00
Pau Espin 445a366c8a gprs_bssgp_prim.h: Add missing includes
Includes for struct gprs_ra_id and osmo_eutran_tai were missing.

Change-Id: I1c068b6841561003d4d7722daa6c2abb21363dda
2021-01-26 13:06:53 +01:00
Philipp Maier cf11411ebb gprs_bssgp_rim: add value strings for enum bssgp_rim_routing_info_discr
Change-Id: Idd06d2e3df0d60409a89a474018a9d97f7772090
Related: SYS#5103
2021-01-22 19:59:31 +00:00
Philipp Maier 8b19d06643 gprs_bssgp_rim: add value strings for enum bssgp_ran_inf_app_id
Change-Id: I581d1176f82d6657d6136c32daa9c76dffb802a6
Related: SYS#5103
2021-01-22 19:59:31 +00:00
Philipp Maier 139c4ae003 gprs_bssgp_rim: add value strings for enum bssgp_nacc_cause
Change-Id: I3354699555569c2b0bd1b4313cffd32a0cbeffe9
Related: SYS#5103
2021-01-22 19:59:31 +00:00
Pau Espin d426ba6730 gsm: Introduce osmo_{rai,cgi_ps}_cmp() APIs
Similar to what we already have for other data types, such as
osmo_lai_cmp or osmo_cgi_cmp.

Change-Id: I00e329bc5be8674b30267dec238e7656ddfc21db
2021-01-22 20:32:45 +01:00
Harald Welte cec4bbed73 vty/fsm_vty: Add vty_out_fsm2() + vty_out_fsm_inst2() with prefix
Callers other than "show fsm" / "show fsm-instances" may want to
indent the output.

Change-Id: I10e01ef91116369868cdb878a99634c8681728af
2021-01-20 14:59:03 +00:00
Philipp Maier 7741bc320c gprs_bssgp: add utilities to send and parse BSSGP rim PDUs
At the moment libosmogb offers no convinient way to send RIM PDUs. Also
parsing an incoming RIM messages into destination, source routing
info and RIM container is not available.

Change-Id: I18134fd9938040d2facb6beee3732628b167ce8c
Related: SYS#5103
2021-01-19 18:04:13 +01:00
Philipp Maier 7450f77f57 bssgp_rim: move bssgp_parse_rim_ri and bssgp_create_rim_ri to gprs_bssgp_rim
The function bssgp_parse_rim_ri() and bssgp_create_rim_ri() are located
in gprs_bssgp.c, since there is now a gprs_bssgp_rim.c module it makes
more sense to put them there. Also adjust the code a bit so that its
more intuitive to read.

Change-Id: Icd667f41d5735de56cd9fb257670337c679dd258
Related: SYS#5103
2021-01-18 21:11:44 +01:00
Philipp Maier 9828d28fc3 bssgp_rim: add encoder/decoder for NACC related RIM containers
BSSGP RIM uses a number of nested containers to signal RIM application
specific payload information in a generic way. Lets add the container
structurs required for NACC.

Depends: libosmocore If48f412c32e8e5a3e604a78d12b74787a4786374
Change-Id: Ibbc7fd67658e3040c12abb5706fe9d1f31894352
Related: SYS#5103
2021-01-18 21:11:44 +01:00
Pau Espin dec7b8c238 ctrl: ports.h: Add OSMO_CTRL_PORT_BSC_NEIGH
Hence 4248 becomes the well-known port for osmo-bsc's Neighbor
Resolution Service.

Related: SYS#4909
Change-Id: Ic77a8cff022c2f939a684ebd1f9f62a82e0de510
2021-01-13 14:48:53 +01:00
Pau Espin ca33a71ca8 Intoduce Packet Switch CGI
This structure is needed in order to identify a given cell within the
BSS during RIM transactions.
The naming was made up by myself since I couldn't find any naming
reference for this kind of data (RAI + CI).
Since LAI + CI = CGI, then RAI + CI = CGI-PS

osmo_rai_name2 family of functions get a "2" suffix due to already
existing functions handling struct struct gprs_ra_id in gsm48.h

Change-Id: If48f412c32e8e5a3e604a78d12b74787a4786374
2021-01-11 14:22:21 +00:00
Philipp Maier cea0c30507 gsm_08_18: add struct to parse RIM PDU Indications
3GPP TS 48.018, section 11.3.65 describes an IE to transfer some control
flags via a RIM container. The IE is essentially just a bitfield, so it
can be parsed by overlaying it with a C-struct. Lets add an appropiate
struct to protocol/gsm_08_18.h

Change-Id: I781ab838bd02ac1b13d384ce3f4259e26cedb61e
Related: SYS#5103
2021-01-06 18:33:42 +01:00
Pau Espin Pedrol 9584cd718a ctrl: Allow handling CTRL get/set replies in user defined code
Prior to this patch, it was not possible to gather SET/GET reply
information when implementing a CTRL client using libosmocontrol. This
is specially important when using the GET command, since one wants to
receive the queried value.
CTRL traps can also be handled this way by extending this patch in the
future if needed.

Change-Id: Id3c4631cd32c13e78e11b6e8194b8c16307ec4f1
2021-01-06 12:32:36 +00:00
Harald Welte e4cd267ab1 Add inter-thread queue
This adds an inter-thread queue "it_q" to libosmocore. With it_q,
one can perform thread-safe enqueing of messages to another thread,
who will receive the related messages triggered via an eventfd
handled in the usual libosmocore select loop abstraction.

Change-Id: Ie7d0c5fec715a2a577fae014b0b8a0e9c38418ef
2021-01-06 00:22:13 +01:00
Philipp Maier 1eaa7bc931 gprs_bssgp: add handling for BSSGP RIM primitives
Receive and forward RIM messages to bssgp_prim_cb()

Change-Id: Idfd0a65872a2cc6089885afd8d31b0b029d85d47
Related: SYS#5103
2021-01-04 21:47:19 +00:00
Vadim Yanitskiy 833e8fac82 gsmtap_util: SNR can be negative, use a signed integer
In 'struct gsmtap_hdr' field 'snr_db' is defined as a signed integer,
however all functions that fill this structure accept an unsigned
integer.  This is wrong, because SNR can be negative.

Let's use 'int8_t' instead of 'uint8_t'.  Changing from unsigned
to signed should be relatively safe compared to the opposite.
Most of the callers I am aware of always do pass 0 anyway.

Change-Id: I9f432be5c346d563bf518111c14ff04d4a63f592
Related: SYS#5073
2021-01-04 17:49:18 +01:00
Vadim Yanitskiy 8f5844ed01 gsm_08_58: add flexible array member to 'struct ipac_preproc_ave_cfg'
Some averaging methods may have additional parameters, so let's
make it easier to access them for the API user.

Change-Id: I2f4ed56837dd479dbbd10c0a7df0ed7565d3946a
Related: SYS#4918
2021-01-03 22:23:11 +00:00
Daniel Willmann 0a2b257868 Declare osmo_ctx_init() in talloc.h
This function is called automatically on the main thread, but needs to
ba called explicitly in order to run the select loop on another thread.
Make it available for applications through talloc.h

Change-Id: Ie710ca9ad01d3fadb9f4ff344a55d6c01004727b
2020-12-28 22:29:01 +01:00
Alexander Couzens 412bc3494d gprs_ns2: add new vty2
Change-Id: I163279cf57e84198dc8c53e1c109f5a9474670e9
2020-12-22 16:36:19 +01:00
Harald Welte 4eb0f16e25 fsm: Add osmo_fsm_inst_broadcast_children()
This is a helper function to broadcast an event to all of the
siblings of a specified FSM instance.

Change-Id: I2ce398741a8672d7b7c4058d056f46e2fe7353c1
2020-12-21 15:45:45 +01:00
Vadim Yanitskiy 2060bbb4c1 gsm_08_58: fix wrong field order in 'struct ipac_preproc_pc_thresh'
Thanks to the CLI of nanoBTS, I noticed that upper and lower RxQual
thresholds are sent in wrong order.  Only the little-endian variant
needs to be fixed, the big-endian one looks good.

Change-Id: If6ab2377bae6742f871589b529a349498775552f
Related: SYS#4918
2020-12-19 17:33:52 +01:00