Write a new API and implementation to manage network namespace related
operations.
This will be used by the upcoming tundev module.
Change-Id: I0f2fba2fa42250a07211a7b7f479498f27c529da
The documentation was copied 1:1 from the Linux kernel, where it
already was wrong and apparently described an earlier implementation.
Change-Id: Ib5def2ae3c79f408f2ee0bb4c20fba1437d30c64
There are some parts of libosmogsm which are not really GSM specific,
but rather ISDN bits that were inherited by GSM. This includes the
I.460 multiplex as well as the core LAPD protocol.
Let's move those bits to its own libosmoisdn library, before we add
more ISDN specific bits to the wrong place.
Backwards-compatibility is created by making libosmogsm depend on
libosmoisdn, and by providing wrapper include files for source
compatibility.
Change-Id: Ib1a6c762322fd5047be3188b1df22408ef06aa50
config.h is created in $(top_buildir)/config.h.
Let's make sure all CPPFLAGS add correct -Ipath includes,
and that all code includes the correct file.
Change-Id: Ie9ea38bb009bc715b01cde4d66d181f7bec2e7bd
When someone is modifying a given library there's no need to be looking
at a common file contains tons of lines from different libraries.
Furthermore, this removes the need of "nobase" autofoo prefix, hence
following the usual directive of having one Makefile per directory.
Change-Id: I785891c2f89114bf8303c799094b637d3d25ac71
This way we have all libosmocore.so in an own subdir instead of having
lots of files in the parent dir, which also contains subdirs to other
libraries.
This also matches the schema under include/osmocom/.
Change-Id: I6c76fafebdd5e961aed88bbecd2c16bc69d580e2
Implementation is imported from osmo-ggsn.git
97f60e3dca581797007524e0006ca9fafad59713 in46a_netmasklen() and adapter
to work with an osmo_sockaddr.
This will be used by osmocom-bb's "modem" app.
Change-Id: I75e75e251c6776801fffdde745aebedf21c68799
The function gsm_gsmtime2fn() uses a hack to account for the truncated
modulo implementation of C/C++. libosmocore offers proven modulo
functions, so lets use OSMO_MOD_FLR() instead. Also arrange the formula
so that it looks more like the one in the spec.
Also add better spec references and a final modulo GSM_MAX_FN to
prevent frame number results that exceed the valid range.
Change-Id: Ibf94bca8223f1f7858a6dd67bf27de0ab6feab20
The function gsm_gsmtime2fn(), which is used to compute a frame number
value from given starting time values T1, T2 and T3 has no unit test.
Due to to the modulo that is used the computation can be a bit tricky.
Lets add a unit-test to make sure the function works as expected.
Change-Id: I8b9b71c8dcccf3b44326b5e61229f4637689d763
C/C++ only implements a so called "truncated modulo" function. Lets also
add a floored and an euclidian modulo function to be more complete.
The functions will be used to generalize the following Change:
I5fb2b0ada8d409730ac22963741fb4ab0026abdd
Change-Id: If61cd54f43643325c45f64531c57fe4c5802a9cf
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
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
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
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
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
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
This assert can be dropped because the switch statement above does
not leave any sc->type >= 0x0f for type_extended == false.
Change-Id: Iafb45ed66378f2c9c2480f81371e92c6d1da71a7
Use timerfd to schedule 1-second periodic timer once
instead rescheduling every second in timer callback.
Related: OS#5671
Change-Id: I2525fd691caa380a862d305cfcb4fa3cc50b70d0
Binding to a negative port should not be allowed.
Using signed value for unsigned parameter is a mistake to begin with.
Change-Id: I24f957641f2d8e230ccceb331a719496df0fdb1f
We don not run 'make check' at all so configuring with external tests support is pointless.
Related: OS#5671
Change-Id: If96756a85ab3b01a786838a4882884efe33f968b
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
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
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
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
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>
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