Commit Graph

4366 Commits

Author SHA1 Message Date
Vadim Yanitskiy af90103299 */Makefile.am: do not mix up AM_CFLAGS with AM_CPPFLAGS
Change-Id: I2c1d5f9c61714f487fbbe60603b2682f2c0a4c6b
2022-11-09 02:27:25 +07: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
Vadim Yanitskiy 8deedfa281 gsm0502: use parentheses in GSM_TDMA_FN_{SUM,SUB} macros
This makes it possible to pass expressions to the abovementioned
macros without any side-effects.  Strictly speaking, this is only
necessary for argument 'b' of GSM_TDMA_FN_SUB, but let's also add
them to GSM_TDMA_FN_SUM for consistency.

Change-Id: I7f26156813139bbb7774e1eb342c91bc84fdad38
2022-10-04 02:49:23 +07:00
Vadim Yanitskiy 395db204b4 include: use '#pragma once' everywhere
Change-Id: Iecc1754caae401aca28444d3e3d0cca04b398f26
2022-09-29 05:44:09 +00:00
Alexander Couzens 71ad530f7e gb: add bssgp2_enc_flush_ll encode FLUSH-LL
Change-Id: I76dc3b08a63cfd78c9f7657fb58c2ddfa9b4b7e2
2022-09-28 18:14:28 +02:00
Neels Hofmeyr 70093f23ad comments: gsm_08_08.h: AMR cfg: explain in much more detail
Change-Id: I1864a6beeeedc301c6dc7e2e0c52a3f94b2fef01
2022-09-25 20:26:21 +02:00
Pau Espin c3b904a87d vty: Allow using hex representations in cmd numeric ranges
Ranges can now be specified in hexadecimal notation. In this case, only
hexadecimal values are accepted (prefixed with "0x").

In order to allow using a hexadecimal value as an input argument, the
command must specify the range in hexadecimal form.
This way all existing commands (decimal) won't get an hexadecimal value
unless they are further extended in the future, avoiding hard to notice
breakage due to use of stroul() without using base=0 or even worse,
using atoi() directly (which only understands decimal and provides no
error checking mechanism).

A command argument can be expanded to accept both decimal and hex in a
range by means of specifying both, example:
"mycmd (<0-255>|<0x0-0xff>)".

Related: OS#5631
Change-Id: Ia2b7fbbf5502c28374c21dbff548232680da27d4
2022-09-15 16:25:56 +02:00
Pau Espin 812766e231 utils.h: protect param with parenthesis in OSMO_BYTES_FOR_BITS()
While at it, drop 8-1 in favour of 7. I don't think it is really more
understandable for readers to see some subtraction there...

Change-Id: I8b21eba9b9aa952f86abe7a6d4cdb1d1a61d9deb
2022-09-08 15:03:44 +02:00
Neels Hofmeyr a7f97b9093 gsm0408_test: do not print errno in expected output
The errno values are platform dependent. Printing them in the expected
output causes failure on some systems that don't match my development
system.

Still check for match with the expected errno value, but don't print the
actual value in gsm0408_test.ok.

Related: OS#4842
Change-Id: I87d125fb4e04b2130f653db1ed76691528e43411
2022-08-23 18:37:20 +02:00
Daniel Willmann d5150a61fc use_count: Return if uc is NULL
The documentation for osmo_use_count_get_put states the return value is
"Negative on range violations or USE_LIST == NULL, the use_cb()'s
return value, or 0 on success"

However, the code in _osmo_use_count_get_put doesn't check if uc is NULL
- instead it would crash in osmo_use_count_find() where it is dereferenced.
Add a check for uc and return -EINVAL if it is NULL.

Change-Id: I792563696860a3100e95cafdd5fe57511819ef56
Related: SYS#5895
2022-08-18 14:13:28 +00:00
Neels Hofmeyr 709da278ca Revert "Add function to guess AF_UNSPEC address"
This reverts commit a4063efa7d.

Reason for revert: It is not possible to guess the IP address
family from uninitialized memory. This function simply glorifies
random noise into an IPv6 address. It makes no sense to have it.

Change-Id: Ifadd614604cf9d0c2ed1a405493c1c3fcb37ae23
2022-08-17 14:05:18 +00:00
Neels Hofmeyr 9e4c2ebf18 Revert "Add osmo_sockaddr_strs_to_str()"
This reverts commit e145e28a91.

Reason for revert:
The function osmo_sockaddr_strs_to_str() should not be part of the
osmo_sockaddr_str API. The implementation of this should live in
the function multiaddr_snprintf() added in patch
Icef53fe4b6e51563d97a1bc48001d67679b3b6e9
and should not use dynamic allocation.

Change-Id: I263dfd68313b896c5b474025fbca13c22ce41cdc
2022-08-17 01:01:16 +00:00
Max e145e28a91 Add osmo_sockaddr_strs_to_str()
This will come in handy for working with multihomes sockets like SCTP.

Related: OS#5581
Change-Id: Ic0d7c08f669994e37a2314555ecac85d28c42c89
2022-08-14 12:21:12 +07:00
Pau Espin 18c6a8183f gsm: bts_features: Add missing entries to osmo_bts_features_names
Those features were present in osmo_bts_features_descs but not in
osmo_bts_features_names.

Change-Id: Ic8162e7ab6b657de694e3825e694e9b18c540271
2022-08-09 17:53:17 +02:00
Max a4063efa7d Add function to guess AF_UNSPEC address
Sometimes we receive generic "struct sockaddr" with unspecified (AF_UNSPEC)
address family. It's handy to try to guess
the proper address (there're just 2 variants ATM in most practical applications).

Use the added function to relax input checks in osmo_sockaddr_str_from_in*()

Related: OS#5581
Change-Id: I1c90c56ce832f53b65e0d18d3cea94621c02a69a
2022-08-09 08:58:49 +00:00
Max ec87a9494d Ignore osmo-ns-dummy
Change-Id: Id562988942be13b83c552bdaa1ad93e275b3d0ae
2022-08-09 08:55:57 +00:00
Pau Espin 83287ba41c gsm: rsl: Define new osmocom extension TLV IE to pass Osmux CID
This is similar to what we already do between BSC<->MSC to pass Osmux
CID (GSM0808_IE_OSMO_OSMUX_CID).
We now want to support Osmux between BSC and Osmocom BTS, hence add an
extension IE which will be used in ipaccess CRCX messages to tell the
BTS to use Osmux.

Change-Id: I580fe99c01bc0a844d877994ec6cd954310e265d
2022-08-09 08:35:55 +00:00
Pau Espin 306400786d gsm: Add BTS feature for Osmux
This feature is used by the BTS to signal to the BSC that it supports
using Osmux instead of RTP on the BTS<->BSC(MGW) data plane.

Related: SYS#5987
Change-Id: Ie79bfb6d0a7a8fe2842d2596b3244e7b74a0d5b6
2022-08-09 08:35:55 +00:00
Pau Espin 862dd36318 tlv.h: Fix TLVP_PRESENT returning a pointer instead of a boolean
I was warned by gcc about comparing a pointer with an integer when using
TLVP_PRESENT with something like:
bool expect = ...;
if (expect != TLV_PRESENT(...))

That's indeed dangerous because TLV_PRESENT is considered to return a
boolean, as opposite to TLV_VAL.

Change-Id: I45cc2745c695e30c37b10f592903ec3775a55492
2022-08-08 20:07:15 +00:00
Pau Espin 6960b6a855 cosmetic: tlv.h: Fix trailing whistespace
Change-Id: Ief318882def539b35ef15c85566f69220e7edbfe
2022-08-08 20:07:15 +00:00
Neels Hofmeyr aafa2b3a67 enrich API doc for gsm0808_speech_codec
Change-Id: Iee52f38c1040b7f7ee37aaa58cfdb0cb6cf33f4d
2022-08-08 18:47:25 +02:00
Alexander Couzens d13faaa968 gprs_ns2: add vty `nse <0-65535> restart sns`
Allow to restart SNS procedure and initiate a SNS-SIZE procedure with Reset.
SGSN side SNS restart will stop answer on ALIVE and is sending NS STATUS
invalid protocol state.
BSS side SNS restart will send a SNS Size procedure to reset the state.

Change-Id: Icb55d8449908d348ab10572eebcf971737fba00d
2022-08-06 17:12:07 +00:00
Pau Espin 9eb698a030 cbsp: Fix decoding of Fail List
The decoding pointer was not increased correctly, ending up in reading
by 1 byte offset  for each item in the list.

Change-Id: I16ed9bd65109a7ce32ff43c5789b4544479838e7
2022-08-06 17:00:48 +00:00
Pau Espin 5563bc998f cbsp: Guard against malformed msgb without l1h,l2h being passed
Change-Id: Ie8854c780cfd96e67df10c1fc38c6b99ec07422f
2022-08-06 17:00:48 +00:00
Pau Espin 061f96d038 tests: Run smscb/gsm0341_test during make check
Some initial testing for that module was writen to apparently do some
manual tests (rand()) but were never added to testsuite.at.
Let's make sure they run during make check (make the test deterministic
by removing rand()).

Change-Id: Icd4feced06afb749de994195c6b338df006749ad
2022-08-06 17:00:48 +00:00
Pau Espin fdb8f81922 cbsp: Return error if decoding any of the cell id lists fail
Change-Id: I5934167f927df0547cb57687e2717489fd1f3719
2022-08-06 17:00:48 +00:00
Oliver Smith c66b35b616 gsm0808_enc_aoip_trasp_addr: add length check
Instead of running into OSMO_ASSERT in msgb_put(), return early if the
msgb is too small. As suggested by Pau in [1].

I would have returned -EMSGSIZE, but the function returns uint8_t.

[1]: https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28582/2#message-a183c463ea20a8d958465ce45a83e62c46214cf6

Change-Id: I632986b99d841abff0f14c6da65f030175f5c4a1
2022-08-05 14:07:55 +00:00