Age | Commit message (Collapse) | Author | Files | Lines |
|
This will disable the thread-safe use of many libosmo* featues,
but it seems even in 2020 there are still systems out there
wthat don't support thread-local-storage.
Related: OS#4456
Related: OS#4062
Change-Id: I9baa7047fc4ff1a595ee318dcdb1247f1460da1b
|
|
This function offers the highest level of API among all libosmousb
helper functions. It is intended as a one-stop shop for everything
related to grabbing an interface.
Change-Id: I748ded6cc7b73a73625588bd7a34a017a905b6bf
|
|
libosmosim contains a variety of definitions and utility fuinctions
useful when working with SIM card [protocol]. They can not only
be used with PC/SC readers but also in other contexts.
Change-Id: I741940d3dc2a5653c760e9d1597d7f08afb3b631
|
|
The table amr_len_by_ft represents the length of the raw AMR speech bits
in bytes. The table is based on the Table found in RFC 4867 §3.6, Table 1,
Column "Total speech bits". The number of bits is divided by 8 and then
rounded up to get the number of consumed octets.
An AMR SID frame (including STI and MI) takes up 39 bits, this will
result in 5 octets, not in 7. Lets correct this.
Related: OS#2978
Change-Id: Icf330450981b32be5d1cee5b10aa92bac4cb72f5
|
|
Change-Id: Ib52d22710020b56965aefcef09bde8247ace4a9c
Related: OS#2966
|
|
AMR SID update frames are protected using an 1/4 convolutional coder,
wich is similar to the one used with 6,7 kbit voice frames. Except that
there is no puncturing and the length is different.
Change-Id: Ia35ed4178a7f0d816052b7e5d6478b93a1d9744f
Related: OS#2978
|
|
AMR not only specifies a 6 bit CRC for regular voice information. It also
specifies a 14 bit CRC to protect the comfort noise updates contained in
the SID_UPDATE frames.
Change-Id: I5cfd8ca806aba8d42cb9787f69605cea7de6e900
Related: OS#2978
|
|
* What we used to call TCH/F and TCH/H in gsmtap are actually only
FACCH/F and FACCH/H, i.e. the signaling part of Bm/Lm channels
* Give them proper names with backwards compatibility #define
* Split VOICE into VOICE_F and VOICE_H. If we don't differentiate this,
a receiver is not able to determine the RSL channel ID of a frame
without looking at external state/context. That in turn has been a
design feature of GSMTAP Um format so far, and programs like
osmo-bts-virtual rely on it.
Change-Id: I952044a17334f35712e087dc41781805000aebc1
Related: OS#2557
|
|
In Change-Id If223020933b083fe359a2e8ff5fab1ce64a363d8 we introduced
GSMTAP_CHANNEL_VOICE, but we didn't add it to gsmtap_gsm_channel_names[]
Change-Id: I7ab696d3e0edb13632e048a9e05be03612d3d28c
Related: OS#2557
|
|
Change-Id: Ieebec5487f5d995a453d15bc024931299d5cf5bf
|
|
Change-Id: I24605c8616015b5f7d45297afc65d6a93d2edbaf
|
|
This adds missing entries for CBCH in the conversion between RSL-style
channel numbers and GSMTAP channel types.
Without this change, you will see tons of messages like
virtphy[19865]: Wed Feb 26 16:16:28 2020 DVIRPHY <0002> gsmtapl1_if.c:267 MS 0000: Ignoring unknown channel type UNKNOWN (0)
if running virtphy of osmocom-bb with a BTS that broadcasts CBCH.
Change-Id: I19bbd2942adf441f58955ac896ef968bfd8aec5f
|
|
All the fields of the structure are set explicitly anyway.
Change-Id: I40c0322d5f2febd98bae6fbe0ec2132eda6fb35b
|
|
Change-Id: I5606ca34a72d42a9b6aafed662b995f9fa77be09
|
|
Change-Id: Ie60bf7d993fe80d3c0fcd04e4c3dd81da4a2ea0b
|
|
This function is supposed to return 0 on success or 1 in case of
error. However, it used to return 1 even in case of success. The
reason is that length of the input string was not taken into
account and sscanf() was failing on '\0'.
Let's use osmo_hexparse() and rely on its return value.
P.S. Funny that the unit test expectations were wrong too.
Change-Id: I441a22c7964bb31688071d8bcf6a282d8c0187ff
|
|
Change-Id: Ifafb65e9d0adc286e16104274db440f38a86d800
Related: CID#208181, CID#208179
|
|
Change-Id: If7d6e0441f73092a4fb455340c076ba4dc60af3f
|
|
If (!env_whitelist && addl_env), osmo_environment_append() would
access uninitialized memory. If both are false, execle() would
also deal with garbage values. Let's ensure that at least the
first element of new_env[] is initialized.
Change-Id: Id3901de4692ef44e9e9c67b1804e027fc4ce7c18
Fixes: CID#206571
|
|
Most likely, we should not assert() here, but let's at least log
an error message in case if osmo_fd_register() fails.
Change-Id: Ia20755ec12ee9fb0eba8322551642a96e68e1570
Related: CID#206572
|
|
A caller shall never pass NULL to osmo_conv_encode().
Change-Id: Ice0050cd7c7e3fcbf57c2c73682ca28843a92d8b
Fixes: CID#208174
|
|
Some osmo-* applications may need to use their own VTY node as a
parent for the timer configuration commands. Therefore it makes
more sense to use 'unsigned int' instead of 'enum node_type'.
Let's also clarify that osmo_tdef_vty_groups_init() accepts parent
node for configuration commands only: 'parent_node' -> 'parent_cfg_node'.
Change-Id: Ifb4c406c85d76a25fc53fc235484599aa87dc77c
|
|
Change-Id: I183882ff2eae82754d55189b154863fad9cce4aa
|
|
Found by clang with enabled LTO (Link Time Optimization).
Change-Id: Ibda4600b4d23b93cf79ff13bb934dfc396aa7d93
|
|
src/usb/Makefile.am:16: warning: variable 'libosmosim_la_LIBADD' is defined but no program or
src/usb/Makefile.am:16: library has 'libosmosim_la' as canonical name (possible typo)
src/usb/Makefile.am:15: warning: variable 'libosmosim_la_LDFLAGS' is defined but no program or
src/usb/Makefile.am:15: library has 'libosmosim_la' as canonical name (possible typo)
Change-Id: I062ea640a75f4521818ba71d5ffea2d08bf3052a
|
|
Change-Id: Ifc0133737627a8277635f8f3662b3f6e922be149
Closes: CID#207713
|
|
Thise two helper functions allow the user application to find
a unique match among the existing USB devices, using either a user-
provided iSerial string, or a user-provided physical USB path.
Change-Id: I8ff3fb3e1a77e10cb313473480ce5e7673749a93
|
|
'make distcheck' distributes the generated .c files, but it is good GPL
practice to also distribute the template.
Change-Id: I988acd3bc629e98985a99780d3142112125d13f7
|
|
Change-Id: I6b2a90fd8f4b042a1e38dbf8e99414a94a290375
|
|
Change-Id: Ia6780221174070cee408625e24513f2c11cc9dfc
|
|
Change-Id: I2474bbe99bf0aa35aab046a1987047a8368beff6
|
|
Change-Id: I629e71242cb6bafa3c1b1d65ae7ec6687ec203d1
|
|
Change-Id: I5698bfe45467a8b0e44549105aaf27b8da500de8
|
|
In some situations, we want to execute an external shell command
in a non-blocking way. Similar to 'system', but without waiting for
the child to complete. We also want to close all file descriptors
ahead of the exec() and filter + modify the environment.
Change-Id: Ib24ac8a083db32e55402ce496a5eabd8749cc888
Related: OS#4332
|
|
Those functions were originally developed as part of simtrace; let's
import them to libosmousb as they are truly generic.
Change-Id: I2c18b938e4e1ea5b8a521a386f00db3a7389e47a
Related: OS#4299
|
|
Osmocom applications typically use libosmocore select.[ch] event loop
code as their main event dispatch mechanism. When they want to deal
with libusb in a non-blocking/asynchronous way, they need to integrate
libusb into that select().
The new libosmousb is doing exactly that: Providing a shared utility
library for Osmocom programs that wish to use libusb. This is useful
for example in simtrace2 host utilitie as well as osmo-e1d.
Change-Id: I656a1a38cbb5b1f3a9145d2869d3b4d0adefcae3
Closes: OS#4299
|
|
gcc-9.2.1 issues the following errror when compiling with -Werror:
In function ‘tl16v_put’,
inlined from ‘tvlv_put’ at ../../include/osmocom/gsm/tlv.h:156:9,
inlined from ‘tvlv_put’ at ../../include/osmocom/gsm/tlv.h:147:24,
inlined from ‘msgb_tvlv_put’ at ../../include/osmocom/gsm/tlv.h:223:9,
inlined from ‘bssgp_tx_paging’ at gprs_bssgp.c:1250:2:
../../include/osmocom/gsm/tlv.h:131:2: error: ‘memcpy’ reading between 128 and 65535 bytes from a region of size 9 [-Werror=stringop-overflow=]
131 | memcpy(buf, val, len);
| ^~~~~~~~~~~~~~~~~~~~~
Unfortunately I've not been able to work around it with some nice GCC
#pragma GCC diagnostic ignored "-Wstringop-overflow"
Change-Id: I22a0c399c6c00eaf87277002096a82844c9e198e
|
|
Make build and external tests work with python3, so we can drop
the python2 dependency.
This should be merged shortly after osmo-python-tests was migrated to
python3, and the jenkins build slaves were (automatically) updated to
have the new osmo-python-tests installed.
Related: OS#2819
Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7
Change-Id: I84ef43f700e125c7a65f92347f12844e07e65655
|
|
Change-Id: I4b1abc8d8aae4bd9a32f927269d7ebfef902d7c5
|
|
This is a bit of a hack, as we want to maintain binary compatibility
without breaking existing users of libosmocore. To do so, we use the
'num_auth_vectors' field in two ways now:
* In the existing use case as part of SEND_AUTH_INFO_RESPONSE, it
indicates the number of vectors stored in the 'auth_vectors' field
* In the new use case as part of SEND_AUTH_INFO_REQUEST, it indicates
the number of vectors actually requested by the MSC/SGSN/MME.
Change-Id: Iaecc47280f8ce54f3e3a888c1cfc160735483d0f
|
|
Change-Id: I71f347a2f0376716e5f83d33a7931eb8a99aad77
|
|
On POSIX systems, standard I/O streams - stdin, stdout, and stderr,
always have default file descriptors 0, 1, and 2 respectively.
Change-Id: Ied35d142af0ba0f5ad78975b8f22c35b32d6ff71
|
|
Since we're using talloc_zero(), vty->fd is initialized with 0,
which corresponds to stdin. Let's set an invalid value to prevent
potential bugs like the one fixed by the recent change [1].
[1] Icdeaea67a06da3a2f07b252e455629559ecc1829
Change-Id: Iec15649781317a23e13d2c2840a8f672050f76c1
|
|
In July 2018 in commit Ide240279240322f643e142229eb7829f538c6314 we
introduced the successor gsm0480_gen_ussd_resp_7bit(), which is also
what both libosmogsm-internal code as well as osmo-hlr have been ported
to. For some reason it wasn't marked deprecated back then.
Change-Id: Iff4c91b5b98a73d9a30aa42f6b2a1ebcc8a45343
|
|
Change-Id: Iec448af02d28e6c5c573e68a0b4a86067ec7e561
|
|
Provide string escaping that
- returns the required buffer size, so it can be used with OSMO_STRBUF_APPEND().
- uses C compatible string constant escaping sequences.
This is intended as a replacement for all previous osmo_escape_str* and
osmo_quote_str* API. It pains me that I didn't get them right the first nor the
second time:
- The buffer functions do not return the chars needed, which is required for
allocating sufficient memory in the *_c versions of the functions.
- Because of that, these functions are accurately usable for
OSMO_STRBUF_APPEND(), producing truncated strings, for example when dumping a
GSUP message.
- They do not use the C equivalent string constant escaping: for some reason I
thought "\15" would be valid, but it should be "\x0f".
If I could, I would completely drop those mislead implementations ... but
backwards compat prohibits that.
A previous patch already provided internal static functions that accurately
return the required buffer size. Enhance these to also support C compatible
string escaping, and use them as implementation of the new functions:
osmo_escape_cstr_buf()
osmo_escape_cstr_c()
osmo_quote_cstr_buf()
osmo_quote_cstr_c()
In the tests for these, also test C string equivalence.
Naming: from API versions, it would be kind of logical to call them
osmo_escape_str_buf3() and osmo_escape_str_c2(). Since these anyway return a
different escaping, it makes sense to me to have distinct names instead.
Quasi missing are variants of the non-C-compatible weird legacy escaping that
return the required buffer size, but I refrain from adding those, because we
have enough API cruft as it is. Just always use these new cstr variants.
Change-Id: I3dfb892036e01000033dd8e7e4a6a0c32a3caa9b
|
|
Keep track of parent nodes and go back hierarchically, not only for .cfg file
reading, but also for telnet VTY sessions.
A long time ago cfg file parsing was made strictly hierarchical: node exits go
back to parent nodes exactly as they were entered. However, live telnet VTY
sessions still lacked this and depended on the go_parent_cb().
From this commit on, implementing a go_parent_cb() is completely optional. The
go_parent_cb() no longer has the task to determine the correct parent node,
neither for cfg files (as already the case before this patch) nor for telnet
VTY sessions (added by this patch). Instead, a go_parent_cb() implementation
can merely take actions it requires on node exits, for example applying some
config when leaving a specific node.
The node value that is returned by the go_parent_cb() and the vty->node and
vty->index values that might be set are completely ignored; instead the
implicit parent node tracking determines the parent and node object.
As a side effect, the is_config_node() callback is no longer needed, since the
VTY now always implicitly knows when to exit back to the CONFIG_NODE.
For example, osmo_ss7_is_config_node() could now be dropped, and the
osmo_ss7_vty_go_parent() could be shortened by five switch cases, does no
longer need to set vty->node nor vty->index and could thus be shortened to:
int osmo_ss7_vty_go_parent(struct vty *vty)
{
struct osmo_ss7_asp *asp;
struct osmo_xua_server *oxs;
switch (vty->node) {
case L_CS7_ASP_NODE:
asp = vty->index;
/* If no local addr was set */
if (!asp->cfg.local.host_cnt) {
asp->cfg.local.host[0] = NULL;
asp->cfg.local.host_cnt = 1;
}
osmo_ss7_asp_restart(asp);
break;
case L_CS7_XUA_NODE:
oxs = vty->index;
/* If no local addr was set, or erased after _create(): */
if (!oxs->cfg.local.host_cnt)
osmo_ss7_xua_server_set_local_host(oxs, NULL);
if (osmo_ss7_xua_server_bind(oxs) < 0)
vty_out(vty, "%% Unable to bind xUA server to IP(s)%s", VTY_NEWLINE);
break;
}
return 0;
}
Before parent tracking, every program was required to write a go_parent_cb()
which has to return every node's parent node, basically a switch() statement
that manually traces the way back out of child nodes. If the go_parent_cb() has
errors, we may wildly jump around the node tree: a common error is to jump
right out to the top config node with one exit, even though we were N levels
deep. This kind of error has been eliminated for cfg files long ago, but still
exists for telnet VTY sessions, which this patch fixes.
This came up when I was adding multi-level config nodes to osmo-hlr to support
Distributed GSM / remote MS lookup: the config file worked fine, while vty node
tests failed to exit to the correct nodes.
Change-Id: I2b32b4fe20732728db6e9cdac7e484d96ab86dc5
|
|
Follow up for patch I3cf150cc0cc06dd36039fbde091bc71b01697322
osmo_sockaddr_str_{from,to}_32n actually use host byte order. Deprecate these
and introduce a more accurately named version ending in h.
Change-Id: Ic7fc279bf3c741811cfc002538e28e8f8560e338
|
|
When finding a char in a string, I want to be able to limit the search area by
size, not only by nul terminator.
Change-Id: I48f8ace9f51f8a06796648883afcabe3b4e8b537
|
|
A couple of times recently I've needed to copy out a substring to a buffer with
limited size. Use of strncpy() or osmo_strlcpy() are nontrivial here.
I wanted to have a dedicated function.
After I wrote that function with a test, I noticed that I had already
implemented the same thing a while ago, as osmo_print_n() :P
So here is just the test.
Change-Id: Ia716abdc1f58af6065b84f4f567388a32a7b39fc
|