Commit Graph

4391 Commits

Author SHA1 Message Date
Eric Wild 555c293867 bitgen test: fix concat macro
..compilers might not like concatenating "nothing", and it looks weird.

Change-Id: Ibcd49a5c5c4f4fd0406fa1697edfd59307eac6f7
2023-01-11 09:01:18 +00:00
arehbein ee7b8c5273 libosmocore: Deprecate APIs telnet_init(_dynip)()
Related: OS#5809
Change-Id: Ibd05d3bc2736256aa45e9e7ec15a98bd14a10454
2023-01-09 21:18:15 +00:00
Vadim Yanitskiy 179dec096f gsm48_ie: gsm48_decode_freq_list(): make 'cd' argument const
Change-Id: Ide9110b984d3302aec6b439c563eb10e2dcdec9e
2023-01-02 12:49:15 +00:00
Oliver Smith a42f4a51c0 utils/osmo-stat-dummy: check for ENABLE_UTILITIES
Don't attempt to build osmo-stat-dummy, unless ENABLE_UTILITIES is set.
We check for this in utils/Makefile.am too.

Fix for currently failing master-osmo-ccid-firmware job, at
cross-compiling libosmocore:
  make[3]: *** No rule to make target '../../src/vty/libosmovty.la', needed by 'osmo-stat-dummy'.  Stop.

Fixes: 7a79dd3d ("osmo-stat-dummy: add rate counters and statsd tester")
Change-Id: I44e49b5646518bd07b2628ca488e4bf74586852c
2022-12-21 10:34:50 +01:00
Max 3f79ce8f23 ctrl: add optional port to bind command
So far ctrl interface did not allow to specify port to bind to.
Let's fix this and make it consistent with the way vty bind works.

N. B: the functions which ignore port configured via vty are marked as deprecated,
the sw which uses them should be ported to either newly added ctrl_init_default()
or simplified ctrl_interface_setup()

The similar change for vty interface will be addressed via separate patch series.

Related: OS#5809
Change-Id: I0fd87fd41fd3ac975273968d24f477daa3cd3aa9
2022-12-20 14:23:04 +03:00
Max 7a79dd3dab osmo-stat-dummy: add rate counters and statsd tester
It's handy for testing rate counters as well as statsd metrics.

Related: OS#5671
Change-Id: Ibd8b17aa3ba9ceb527c6231310f01d736fb542a7
2022-12-20 14:20:05 +03:00
Max 23a7d0740c rate_ctr: drop rate estimation code
Drop the code which tried to estimate the value for the next timeframe:
it accumulated error over time which only adds confusion.

N. B: this means that long-term intervals (day, hour) will show the rate of 0 until
corresponding timeframe passes. This matches how other monitoring software [1] behaves.

[1] https://learn.netdata.cloud

Fixes: OS#5671
Change-Id: I07232e9ff8bd62403ae82d9bd60d967d40b54ebc
2022-12-19 15:51:42 +00:00
Vadim Yanitskiy 6db830f316 gsm0808: use new gsm0808_enc_speech_codec[_list]2() API
The motivation behind adding and using the new API is explained in
the preceeding change [1].  Whenever any of the encoding functions
fails to encode either a Speech Codec or a Codec List IE, free()
the msgb and return NULL.

Change-Id: I28219b61b9347f0652f9fd0c717f6cdf3c63e8f9
Related: [1] I199ffa0ba4a64813238519178155dfc767aa3975
Related: SYS#6229
2022-12-14 03:24:51 +07:00
Vadim Yanitskiy 5a51331729 gsm0808: add gsm0808_enc_speech_codec[_list]2()
The problem with most of the existing gsm0808_* functions in this file
is that they assert() too much, assuming that their callers always pass
perfectly valid input parameters.  But this is impossible on practice,
as there can be bugs in complex projects using them, liks osmo-bsc.

It was reported by a customer that a heavily loaded osmo-bsc crashed a
few times, dropping more than 100 sites without network coverage for
a few minutes.  As was revealed during the investigaion, it crashed
due to a failing assert at the end of enc_speech_codec():

  OSMO_ASSERT(sc->cfg == 0);

The problem is that somehow osmo-bsc is passing an unexpected sc->cfg
value to gsm0808_create_ass_compl2(), in particular 0x02, while the
given sc->type value (GSM0808_SCT_HR1) implies that there cannot be
any configuration bits on the wire.

The reason why and under which circumstances this can be happening
is not clear yet, but what we agreed on so far is that the library
API should be enforcing correctness of the input parameters in a
less agressive way, rather than aborting the process without
letting it any chance to recover.

Modify the original gsm0808_enc_speech_codec[_list]() functions, so
that a negative value is returned in case of an error.  Rename them
and add backwards compatibility wrappers, because it's public API.

A separate patch making use of the new API follows next.

Change-Id: I199ffa0ba4a64813238519178155dfc767aa3975
Related: SYS#6229
2022-12-14 03:24:51 +07:00
Vadim Yanitskiy c2f1ed1dd0 gsm0808: remove over-defensive assert()s for function parameters
I believe the gsm0808_* API is mature enough to avoid assert()ing
pointers accepted via function parameters.  We can assume the caller
never passes NULL, as we do in almost all public API.

Change-Id: If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0
2022-12-14 02:18:21 +07:00
Vadim Yanitskiy 90b64a1d70 gsm0808: remove redundant assert() in enc_speech_codec()
This assert can be dropped because the switch statement above does
not leave any sc->type >= 0x0f for type_extended == false.

Change-Id: Iafb45ed66378f2c9c2480f81371e92c6d1da71a7
2022-12-14 02:08:40 +07:00
Vadim Yanitskiy 061b7ec434 gsm0808: remove unneeded assignment in enc_speech_codec()
Change-Id: Ifc6d109e27cdada0d08d2a8fc1c354f3de04f15c
2022-12-14 02:06:06 +07:00
Vadim Yanitskiy 8e962451fc gsm0808: cosmetic: switch is not a function
Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1
2022-12-14 01:13:19 +07:00
Max 7c1b6cb4cd rate_ctr: convert to timerfd
Use timerfd to schedule 1-second periodic timer once
instead rescheduling every second in timer callback.

Related: OS#5671
Change-Id: I2525fd691caa380a862d305cfcb4fa3cc50b70d0
2022-12-05 22:07:50 +03:00
Max af35eb203c telnet_init_dynif: don't allow negative port
Binding to a negative port should not be allowed.
Using signed value for unsigned parameter is a mistake to begin with.

Change-Id: I24f957641f2d8e230ccceb331a719496df0fdb1f
2022-12-04 11:44:54 +00:00
Max 6d261343fa telnet_init_dynif: propagate error
Return actual error from osmo_sock_init_ofd() to the caller.

Change-Id: Ib09f4315b3868ec031ecbced8a63069e7c2de7da
2022-12-04 11:39:46 +00:00
Max 5b37642818 vty: fix doc typo
Change-Id: I9f1112fc27dfe967b4a007648ddda1050e9bd9fa
2022-12-04 10:03:13 +00:00
Max a840ad5e19 jenkins_arm.sh: disable external tests
We don not run 'make check' at all so configuring with external tests support is pointless.

Related: OS#5671
Change-Id: If96756a85ab3b01a786838a4882884efe33f968b
2022-12-04 10:03:13 +00:00
Harald Welte d7d4b1b7d0 gsmtap.h: Add definitions for various ISDN sub-types
We've started to encapsulate a varieth of ISDN related formats
as sub-types to GSMTAP_TYPE_E1T1 for quite some time.  Let's add
some more formats, such as V5EF, V.110, V.120, X.75 and H.221

For the HDLC based V5EF, V.110, V.120 and X.75 the payload format is
clear.  For V.110 and H.221 we will need to specify how the actual
payload looks like.

Change-Id: I8dee0f730cf91d6f9133d5c57f653e669ec8d598
2022-12-02 17:05:50 +01:00
Max a9ddb834e6 osmo-ns-dummy: add ctrl interface
It's handy for rate_ctr tests with follow-up patches.

Related: OS#5671
Change-Id: If6e06d9433e438b92f1ed1ef0f892308e031779b
2022-11-30 18:47:32 +00:00
Neels Hofmeyr f4854f39c6 osmo_tdef_get(): clarify API doc on val_if_not_present
Change-Id: I2301aad86d6d165a3b51c6849bcd8fe02972e0a3
2022-11-28 15:19:47 +01:00
Max 2b283b1a1a LAPD: move tx_hist code into static functions
Related: OS#4074
Change-Id: Ibf3b08c8d874416796b94ba3a672a02d614313b1
2022-11-26 13:59:09 +00:00
Pau Espin 6ca0a43294 gsm: constify several readonly params
Change-Id: Ib11bfe57f546a5618f70152b9b75115808e54bf6
2022-11-24 17:09:03 +01:00
Max a9a9ce6db0 Add define for unset Frame Number
It's handy for OsmoPCU as well as upcoming LAPD T200 code.

Related: OS#4074
Change-Id: I641f1a1bf1e86ced8ffe89e88bc48afb79823393
2022-11-20 21:48:52 +00:00
Vadim Yanitskiy 8fbaad6903 */Makefile.am: do not mix up AM_CFLAGS with AM_CPPFLAGS
Change-Id: I2c1d5f9c61714f487fbbe60603b2682f2c0a4c6b
2022-11-10 16:07:03 +00:00
Harald Welte 6dda35a80f Fix typos in copyright statements.
Change-Id: I783c56bb1d216ce3a47a19da230ee5f50aca2ab3
2022-11-09 16:54:50 +01:00
Harald Welte 88bb5ed7fa Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
... if --enable-werror is used

Change-Id: I8acd1b276f1ff8f015856d70fd582e457915ea11
2022-11-08 16:30:58 +00:00
Harald Welte 8d5fc1db44 vty/logging.h: Avoid -Werror=pragmas error in C++ code
The newly-introdiced pragma to disable strict-prototypes checking works
in C, but creates a -Werror=pragmas error in C++ code:

In file included from osmo-trx.cpp:45:
/build/deps/install/stow/libosmocore/include/osmocom/vty/logging.h:10:32: error: option
‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [-Werror=pragmas]
 #pragma GCC diagnostic ignored "-Wstrict-prototypes"

So let's also suppress those errors for that one line of code...

Change-Id: I85596cf4538d7a8c522f4bce1620a2d19e2a910e
2022-11-07 10:08:09 +01:00
Harald Welte be912e7c1d Disable -Wstrict-prototypes for logging_vty_add_cmds()
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea0). However,
its declaration in C file didn't contain "(void)", which meant the
number of parameters is undefined and thus compiler doesn't complain.

However, in recent Change-Id I84fd99442d0cc400fa562fa33623c142649230e2
we changed the declaration to '(void)' to allow building with
-Wstrict-prototypes.  This caused downstream build-failures of osmo-mgw (1.4.0)
and osmo-e1-recorder (master).

So let's make one very small-scoped exception here.

Change-Id: Iadb54848b67db937b640dc2102dddb6e708a6a9f
2022-11-06 10:57:52 +01:00
Philipp Maier de4e8daf7d bits: fix typo
Change-Id: I3d6c30ffffdfe981f50cb755104b033b62e6b0c0
2022-11-04 19:34:05 +00:00
Harald Welte e61d459cef Support building with -Werror=strict-prototypes / -Werror=old-style-definition
Unfortunately "-std=c99" is not sufficient to make gcc ignore code that
uses constructs of earlier C standards, which were abandoned in C99.

See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for
some related discussion.

Change-Id: I84fd99442d0cc400fa562fa33623c142649230e2
2022-11-03 12:44:28 +01:00
arehbein 0d9b6b0e31 gb/vty: Show if NSVC is blocked locally by O&M/vty or by remote
Related: OS#5085

Change-Id: I0e8a12c3e54b701c9e697d50de1c9cb0bcc817e0
2022-10-27 18:35:30 +02:00
Vadim Yanitskiy 19bd12e919 gsm0502: gsm0502_fn_remap(): use GSM_TDMA_FN_SUB() macro
Change-Id: Id77644d945ad195733d4bf68c0d1c5b450b16e58
2022-10-26 18:13:22 +07:00
Max df5b1e17a5 msgb: introduce extended copy functions
Those are similar to existing *msgb_alloc*() functions but allows
to change the size of destination msgb provided it fits the
data from source msgb.

Change-Id: I36d4c16241d19f0f73c325be4d0e0bdef6813615
Signed-off-by: Max <msuraev@sysmocom.de>
2022-10-25 08:51:22 +00:00
Vadim Yanitskiy 73aa0e5219 {gsm,gb}/Makefile.am: drop undefined $GCC_FVISIBILITY_HIDDEN
Change-Id: I142cf38e8954720ed66b0c242a5527c96626dcaa
2022-10-20 04:51:40 +00:00
Vadim Yanitskiy 6755aac51e configure.ac: fix 'AM_CONDITIONAL(ENABLE_GNUTLS, false)' listed twice
Change-Id: I057eb55d381144489d0385493af5a43839b45023
2022-10-20 04:51:40 +00:00
Max 73984a88e5 doc: correct typo in ticket reference
The OS#4993 has nothing to do with AF_PACKET/ENOBUFS,
the proper ticket is OS#4995 as referenced later in the same file.

Change-Id: Icf13b351dc74508fc312c535d68b13b7ce9b7e1e
2022-10-19 20:39:01 +03:00
Max 61359a2cdd msgb: expand copy test
* use proper Lx comparison functions
* use msgb_l4len()
* check test invariant
* print destination properly

Change-Id: I695c40e9350f608049111e81907fa6a5f48bb199
2022-10-17 16:01:15 +00:00
Harald Welte d98a867743 logging.h: Allocate DLM2PA and DLM2UA for libosmo-sigtran
Change-Id: I106b7586bfe8ee03c052b6f8b33da4c466e05abd
2022-10-16 17:14:08 +02:00
Harald Welte 729a2c8e9a allocate VTY port number 4270 for osmo-isdntap
osmo-isdntap is a ISDN protocol + call tracing utility currently under
development, see https://gitea.osmocom.org/retronetworking/osmo-isdntap

Change-Id: I25ca4565e326ee9b0b32eeabc4a76756e2fde4ac
2022-10-16 17:14:08 +02:00
Max 327e5e990d LAPD: use bool for T200 reset flags
Related: OS#4074
Change-Id: I2d1a3dd7938b079a3525c84647f82b7bc6cdfdd6
2022-10-11 20:01:59 +03:00
Max c569526379 LAPD: log unknown format value
Change-Id: I9efd433ed128ae1d9df45591b1a93e10f8a3372c
2022-10-11 19:47:49 +03:00
Max 68588c57ef cosmetic: make linter happy with LAPD code
The weird formatting not only makes it hard to read but caused linter to fail in the follow-up patch.

Change-Id: Ie4e56b4796c1b8f270a692453faccf102c963db5
2022-10-11 19:34:43 +03:00
Max 7bd1670520 cosmetic: remove trailing space
Change-Id: Ibecfcccd3eabd81979b2296a2dbca1ffbbec8f1c
2022-10-11 10:57:26 +03:00
Philipp Maier 724c1625e2 msgb: do not use msgb_l4 instead of msgb_sms
The macro msgb_sms() is basically an alias for msgb_l4(). Lets use
msgb_l4() in msgb_l4len() instead of msgb_sms().

Change-Id: I90d4f5c07fbaadd9e022752a2c64c4855f0b4227
2022-10-06 07:52:09 +00:00
Philipp Maier d9d62102cc msgb: assert msgb->lXh to be not NULL
When any of l1h, l2h, l2h or l4h is set to NULL (which is the default
for newly allocated message buffers). Then the msgb_lXhlen() functions
will return the address value of msgb->tail. This can lead to unexpected
results at a later point. We should have an OSMO_ASSERT to catch the
problem early.

Change-Id: I1795c559f190713ebbabfbabf3453ab77da46a49
Related: OS#5645
2022-10-06 07:52:09 +00:00
Keith Whyte 486d98404d Fix Typo in gsm0808_msgt_names[]
Change-Id: I91585d81efd6e18f4b8f9eaeaaaa50412253d93b
2022-10-06 03:16:15 +01:00
Keith Whyte e852544f6c Fix LCLS-CONNECT-CONTROL generation
gsm0808_create_lcls_conn_ctrl() was adding the LCLS-Configuration IE twice.

Correct is LCLS-Configuration followed by LCLS-Connection-Status-Control
(TS 48.008 3.2.1.91)

Change-Id: I455ac7695ad33ef9073bea7d1711508717732607
2022-10-06 01:12:15 +01:00
Pau Espin 3b3955b203 socket: Introduce API osmo_sockaddr_is_any
Change-Id: I2810a889fc14052d0e0be6a2b500ad4e5088ffa9
2022-10-04 16:30:32 +02:00
Pau Espin 3c12f557bd socket.h: Reorder sockaddr APIs to have them all together
Change-Id: Iab2ee2854be8027ee5978e06a83248b530a39bf7
2022-10-04 12:31:03 +02:00