| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace osmo_gsup_get_err_msg_type() with a wrapper to
OSMO_GSUP_TO_MSGT_ERROR(). This macro assumes, that all error messages
are (request message | 0x000001). Add a big comment header for
osmo_gsup_message_type, describing this already implicitly followed rule
and therefore making it explicit.
With this change, we don't need to maintain the request -> error message
mapping in osmo_gsup_get_err_msg_type() anymore.
Related: Iec1b4ce4b7d8eb157406f006e1c4241e8fba2cd6 (osmo-gsm-manuals)
Change-Id: I46d9f2327791978710e2f90b4d28a3761d723d8f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During testing of the upcoming tdef API, it became apparent that passing very
large timeout values to osmo_fsm_inst_state_chg() wraps back in the number
range, and might actually result in effectively very short timeouts instead.
Since time_t's range is not well defined across platforms, use a reasonable
maximum value of signed 32 bit integer. Hence this will be safe at least on
systems with an int32_t for struct timeval.tv_sec and larger.
Clamp the osmo_fsm_inst_state_chg() timeout_secs argument to a maximum of
0x7fffffff, which amounts to just above 68 years:
float(0x7fffffff) / (60. * 60 * 24 * 365.25) = 68.04965038532715
(In upcoming patch Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5, this can be
verified to work by invoking tdef_test manually with a cmdline argument passed
to enable the range check.)
Change-Id: I35ec4654467b1d6040c8aa215049766089e5e64a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch, if timeout_secs == 0 was passed to
osmo_fsm_inst_state_chg(), the previous T value remained set in the
osmo_fsm_inst->T.
For example:
osmo_fsm_inst_state_chg(fi, ST_X, 23, 42);
// timer == 23 seconds; fi->T == 42
osmo_fsm_inst_state_chg(fi, ST_Y, 0, 0);
// no timer; fi->T == 42!
Instead, always set to the T value passed to osmo_fsm_inst_state_chg().
Adjust osmo_fsm_inst_state_chg() API doc; need to rephrase to accurately
describe the otherwise unchanged behaviour independently from T.
Verify in fsm_test.c.
Rationale: it is confusing to have a T number remaining from some past state,
especially since the user explicitly passed a T number to
osmo_fsm_inst_state_chg(). (Usually we are passing timeout_secs=0, T=0).
I first thought this behavior was introduced with
osmo_fsm_inst_state_chg_keep_timer(), but in fact osmo_fsm_inst_state_chg()
behaved this way from the start.
This shows up in the C test for the upcoming tdef API, where the test result
printout was showing some past T value sticking around after FSM state
transitions. After this patch, there will be no such confusion.
Change-Id: I65c7c262674a1bc5f37faeca6aa0320ab0174f3c
|
|
|
|
|
|
|
|
|
| |
It was recently discovered that logging_vty_test.vty was missing from
EXTRA_DIST. To make sure we don't forget similar files in the future, add
python tests to 'make distcheck', by means of DISTCHECK_CONFIGURE_FLAGS.
Related: I1bcedf3097f02b2adc679560d1cbceb27dbc345e
Change-Id: Id569b2a932c1428cabb4d7ff17822cff8eee02af
|
|
|
|
|
|
|
|
|
|
| |
It was introduced and forgotten to add to EXTRA_DIST in:
"logging vty: add VTY transcript test"
commit 3a9ff11e574fa7ee19b1062b2c90151dbf7f0e27
change-Id I948e832a33131f8eab98651d6010ceb0ccbc9a9c
Change-Id: I1bcedf3097f02b2adc679560d1cbceb27dbc345e
|
|
|
|
| |
Change-Id: I61d4f7dfada2763948f330745ac886405d889a12
|
|
|
|
|
|
|
|
|
| |
osmo-bsc and osmo-msc implement identical Classmark structures. It makes sense
to define once near the gsm48 protocol definitions.
Also move along some generic Classmark API from osmo-msc.
Change-Id: Ifd27bab0380f7ad0c44c719aa6c8bd62cf7b034c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add osmo_hexdump_buf() as an all-purpose hexdump function, which all other
osmo_hexdump_*() implementations now call. It absorbs the static
_osmo_hexdump(). Add tests for osmo_hexdump_buf().
Rationale: recently during patch review, a situation came up where two hexdumps
in a single printf would have been useful. Now I've faced a similar situation
again, in ongoing development. So I decided it is time to provide this API.
The traditional osmo_hexdump() API returns a non-const char*, which should
probably have been a const instead. Particularly this new function may return a
string constant "" if the buf is NULL or empty, so return const char*. That is
why the older implementations calling osmo_hexdump_buf() separately return the
buffer instead of the const return value directly.
Change-Id: I590595567b218b24e53c9eb1fd8736c0324d371d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add
* osmo_lai_cmp() (to use in gsm0808_cell_id_u_matches())
* osmo_cgi_cmp() (to use in gsm0808_cell_id_u_matches())
* gsm0808_cell_id_u_match() (to re-use for single IDs and lists)
* gsm0808_cell_ids_match()
* gsm0808_cell_id_matches_list()
* Unit tests in gsm0808_test.c
Rationale:
For inter-BSC handover, it is interesting to find matches between *differing*
Cell Identity kinds. For example, if a cell as CGI 23-42-3-5, and a HO for
LAC-CI 3-5 should be handled, we need to see the match.
This is most interesting for osmo-msc, i.e. to direct the BSSMAP Handover
Request towards the correct BSC or MSC.
It is also interesting for osmo-bsc's VTY interface, to be able to manage
cells' neighbors and to trigger manual handovers by various Cell Identity
handles, as the user would expect them.
Change-Id: I5535f0d149c2173294538df75764dd181b023312
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gcc-8.2 is printing the following warning, which is an error
when used -Werror like our --enable-werror:
In file included from gprs_bssgp.c:34:
In function ‘tl16v_put’,
inlined from ‘tvlv_put.part.3’ at ../../include/osmocom/gsm/tlv.h:156:9,
inlined from ‘tvlv_put’ at ../../include/osmocom/gsm/tlv.h:147:24,
inlined from ‘msgb_tvlv_push’ at ../../include/osmocom/gsm/tlv.h:386:2,
inlined from ‘bssgp_tx_dl_ud’ at gprs_bssgp.c:1162:4:
../../include/osmocom/gsm/tlv.h:131:2: error: ‘memcpy’ forming offset [12, 130] is out of the bounds [0, 11] of object ‘mi’ with type ‘uint8_t[11]’ {aka ‘unsigned char[11]’} [-Werror=array-bounds]
memcpy(buf, val, len);
Where "130" seems to be the maximum value of uint8_t, shifted right one +
2. But even as we use strnlen() with "16" as maximum upper bound, gcc
still believes there's a way that the return value of gsm48_generate_mid_from_imsi()
could be 130. In fact, even the newly-added OSMO_ASSERT() inside
gsm48_generate_mid() doesn't help and gcc still insists there is a problem :(
Change-Id: I0a06daa19b7b5b5badbb8b3d81a54c45b88a60ec
|
|
|
|
|
|
|
|
|
|
|
| |
The longest BCd-digit type identity is the IMEISV with 16, so there's
no point in trying to parse up to 255 decimal digits, which will do
nothing but to overflow the caller-provided output buffer.
Let's also clearly define the required minimum size of the output
buffer and add a reltead #define for it.
Change-Id: Ic8488bc7f77dc9182e372741b88f0f06100dddc9
|
|
|
|
|
|
|
|
| |
The IMEI-SV is speified as a 16 digit number: 14 digits of IMEI plus
two digits of software version. Let's not try to feed 18 digit long
numbers into our functions, as the resulting behavior is unspecified.
Change-Id: I6fb85a0516dc387902ad9de4fe8c1ba82d68cae6
|
|\
| |
| |
| |
| |
| | |
Release v1.0.1 on 2019-01-21.
Change-Id: I2b92a7cfcdc7ed9d6f835bd17c6b5d2ec939b568
|
| |
| |
| |
| | |
Change-Id: I51696a3ace219ab69c294b0e3637371c5460291f
|
| |
| |
| |
| | |
Change-Id: I51696a3ace219ab69c294b0e3637371c5460291f
|
|/
|
|
|
|
|
| |
Add new define for the 14 digit IMEI without the Luhn checksum, as it
is used in OsmoHLR.
Change-Id: I02b54cf01a674a1911c5c897fbec02240f88b521
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This resolves an issue introduced in 84fb5bb6a09a6a358f98c654c84c3b99a0f24eef
when msgb_wrap_with_TL() was introduced as an inline function with
*exactly the same name* as in osmo-msc.git and openbsc.git. We *NEVER*
do something like this. Functions moved from applications to library
*MUST* always be renamed. This has been the case for almost a decade
now.
With this subsequent change we make sure the libosmocore function
has a different name and doesn't clash. After this commit, old
openbsc.git and osmo-bsc.git should again build fine.
Change-Id: If1e851ac605c8d2fde3da565b0bd674ea6350c2e
|
|
|
|
| |
Change-Id: I1bd973754b1ebc42283f6a07defa60f58523f5a3
|
|
|
|
|
|
|
|
| |
They only make sense in the context of LCLS so far - let's make sure
they're not used by external projects directly instead of gsm0808_*()
counterparts.
Change-Id: I4ae5a3472a20492d5f76170b722e4e2274a5c433
|
|
|
|
|
|
|
|
|
| |
Most of the time we'll have GCR filled anyway so it make sense to have
it as static parameter instead of a pointer to separately allocated
structure. Update tests to cover both static and dynamic osmo_lcls
allocation variants.
Change-Id: I905c36d8455911c68c30bc429379b7313dd46aea
|
|
|
|
|
|
|
|
|
|
| |
* add gsm0808_create_ass_compl2() with additional gsm0808_lcls_status
parameter and make gsm0808_create_ass_compl() into trivial wrapper
around it
* update tests accordingly
Change-Id: I547c6b8707123aa8c1ef636db88908df112d90a4
Related: OS#2487
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function msgb_sgsap_name_put() assignes the return code of
osmo_apn_from_str() directly to len. Len is an uint8_t and the return
code an int. If osmo_apn_from_str() returns -1. Len would become 0xFF
causing a buffer overrun with msgb_tlv_put. Lets use the proper type to
catch the return code and check it before using it as length.
Change-Id: Ic0bc5114eee47bdcf2300a6e4b0df473d3d1903a
Fixes: CID#190405
Fixes: CID#190401
Related: OS#3615
|
|
|
|
|
|
|
|
|
|
|
| |
The function osmo_sock_get_name_buf() can be used to write a string
representation to a user provided memory. Unfortunately the proper
length for the user provided memory is not obvious. To make using
osmo_sock_get_name_buf() more practical, add a define constant that
defines the length of the required memory. Also use this define in
socket.c.
Change-Id: If8be8c2c0d4935da17ab13b2c2127b719ceefbcc
|
|
|
|
| |
Change-Id: I9e3b5560a058b976638d03cb819415d237ae9984
|
|
|
|
| |
Change-Id: I8ed87f26216104d34c7bd11c1527b203843760a2
|
|
|
|
| |
Change-Id: I3ab94f362866d752099000afe62922288b3dd118
|
|
|
|
|
|
|
| |
Prepare handling multiple CM Service Requests in osmo-msc: an enum is more
clear than an int and #defines for passing around and count CM Service types.
Change-Id: I9c2a7adc45ab7a1a7519168e965e7d805e1481ff
|
|
|
|
|
|
|
|
|
|
|
| |
Verify 14 digit and 15 digit IMEI strings. OsmoHLR will use the 14
digit version to check IMEIs before writing them to the DB.
Place the Luhn checksum code in a dedicated osmo_luhn() function, so
it can be used elsewhere.
Related: OS#2541
Change-Id: Id2d2a3a93b033bafc74c62e15297034bf4aafe61
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of fixing issue OS#3075, we want to migrate support
for encoding system information from osmo-bsc to libosmocore.
This change ports osmo-bsc code for encoding SI rest octets.
The conversion was a bit tricky in some places because some
functions receive a 'struct gsm_bts' parameter in osmo-bsc.
In this libosmocore version, such functions expect parameters
which correspond to the individual fields of 'struct gsm_bts'
which are used by these functions.
Several structs from osmo-bsc's system_information.h are now
also declared in libosmocore headers, with an added osmo_ prefix
to avoid collisions with existing definitions in osmo-bsc.
Some helpers were ported from osmo-bsc's system_information.c
to libosmocore's gsm48_rest_octets.c. Contrary to osmo-bsc's
implementation they are now only visible within this file.
Unfortunately, this code ported from osmo-bsc lacks unit tests.
Change-Id: I47888965ab11bba1186c21987f1365c9270abeab
Related: OS#3075
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As part of fixing issue OS#3075, we want to migrate support
for encoding system information from osmo-bsc to libosmocore.
This change ports one of the prerequisites for doing so:
osmo-bsc code for range-encoding ARFCNs, including tests.
An osmo_gsm48_ prefix has been prepended to public symbols in
order to avoid clashes with existing symbols in osmo-bsc code.
Change-Id: Ia220764fba451be5e975ae7c5eefb1a25ac2bf2c
Related: OS#3075
|
|
|
|
| |
Change-Id: I0f47a610e06ac99bd60a5aad6f50f3658480165e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note that OSMO_GSUP_IMEI_RESULT_ACK is 0 on the wire, although the
enum value is 1. Same with NACK (1 on wire, enum 2).
I had implemented enum osmo_gsup_imei_result after
enum osmo_gsup_cancel_type above, where this comment exists as well,
and I incorrectly assumed that enum osmo_gsup_cn_domain in the middle
was also implemented this way and therefore adding the comments to each
enum would be redundant. But for cn_domain, the values on the wire are
the same as the enum values.
Change-Id: If97c34f117bfaab2232bbb625e9d118c8f390e58
|
|
|
|
|
|
|
|
| |
Since osmo_hexdump() use static buffers we can't re-use pointers to it
after subsequent osmo_hexdump() calls. Let's print data used for
comparison directly instead.
Change-Id: I24dc3fad6f64ef788da9b7d790f9d5f689190c42
|
|
|
|
|
|
| |
Move lupd_names[] from osmo-msc to libosmo-gsm.
Change-Id: Ica25919758ef6cba8348da199b0ae7e0ba628798
|
|
|
|
|
|
|
|
| |
We have gsm48_mi_to_string() and osmo_bcd2str(), but still lack a function that
conveniently prints both MI type and value in one function call.
Related: http://people.osmocom.org/neels/mi_mi_mi.jpg
Change-Id: I7798c3ef983c2e333b2b9cbffef6f366f370bd81
|
|
|
|
|
|
|
|
|
|
|
| |
Previously it could encode both incorrect values as well as incorrect
message. Let's fix this by explicitly checking for invalid values and
ensuring that at least one of the parameters is valid.
This function have no external or internal users so it's better to fix
type signature as well to match the rest of gsm0808_create_lcls_*().
Change-Id: I7b33a771acbd391c5f9a494d6450edb18511433f
|
|
|
|
|
|
|
|
|
| |
Disable GnuTLS fallback if sufficient glibc version detected. Previously
GnuTLS fallback was used regardless of getrandom() availability in
glibc. Fix this by automatically disabling it when not needed. This does
not affect the ability to manually disable it unconditionally.
Change-Id: Ibe2117afc050261668a4d5a590044aabcd08aefe
|
|
|
|
|
|
|
|
|
|
| |
* use macro for version check
* report glibc version upon random.h detection
* comment where various #endif belongs to
* explicitly check for embedded build (our target toolchain don't use
libc so there's no point in checking its version)
Change-Id: Ia54f0b7a861f955be65bb0cf06eb10af9372d062
|
|
|
|
|
|
|
|
| |
Both session state and session ID IEs were left from the initial
version of Ibe325c64ae2d6c626b232533bb4cbc65fc2b5d71. There is
no need to use them (as we use SM-RP-MR), so let's clean up.
Change-Id: I0d910b87f15ffbc0aeeca9cb4fcbef32bdf3ef88
|
|
|
|
|
|
| |
Keep #defines to still support previous wrong spelling.
Change-Id: Id4cf812f0bc3cd40f6bfa05166f817a07a647f71
|
|
|
|
|
|
|
| |
osmo-msc is about to implement the SGs interface and requires a RAT indicator
for that.
Change-Id: I00588396bfe03feba38ecb0717d584594f0b2b46
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the MSC, we have RAN types GERAN_A and UTRAN_IU, now we need a similar enum
in osmo-hlr's GSUP client.
Naming: in the MAP specifications, the RAN type is mostly called RAT type,
(Radio Access Network vs. Radio Access Technology?). Since GSUP is more about
MAP messages, I'm calling the enum osmo_rat_type.
Rationale: osmo-msc and osmo-sgsn want to tell the osmo-hlr which RAT a
subscriber is calling on. A subsequent patch will extend the GSUP protocol and
add a RAT types IE.
Change-Id: I659687aef7a4d67ca372a39fef31dee07aed7631
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using an FSM instace's logging context is very useful. Sometimes it makes sense
to log something on a different logging category than the FSM definition's
default category.
For example, an MSC conn has aspects concerning MM, CC, RR, MGCP, ..., and
currently all of those log on DMM.
This came up in I358cfbaf0f44f25148e8b9bafcb9257b1952b35a, where I want to log
an MGCP event using a ran_conn context, and used the conn->fi->id. That of
course omits context like the current conn FSM state...
I remember at least one other place where I recently added logging using some
fi->id as context, so it might turn out useful in various places.
Change-Id: I11b182a03f5ecb6df7cd8f260757d3626c8e945d
|
|
|
|
|
|
|
|
| |
The LOGPFSM macros are in such wide use that they should guard against a NULL
fi pointer. In case of NULL, default to subsys = DLGLOBAL, loglevel =
LOGL_ERROR and state = "fi=NULL".
Change-Id: I9eaf8b7e2cf1e450ae626cb2fc928862008f6233
|
|
|
|
| |
Change-Id: I3bf6500889aa58195f50a726dec0876c0c2baec3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to the man page, vsnprintf() returns:
- a negative value in case of error;
- the number of characters written (excluding '\0');
- the number of characters which *would have been written*
if enough space had been available (excluding '\0').
We need to detect if the output was truncated, and properly
limit the amount of bytes to be reserved within a msgb.
Change-Id: Ifa822edf900ed925ba935c54a28c797c4657358a
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In 3GPP TS 48.008 the Global Call Reference IE is only used in HANDOVER
REQUEST (§3.2.1.8) and ASSIGNMENT REQUEST (§3.2.1.1) messages which
also include LCLS Config and CSC parameters. Hence, there's no point in
using GCR encode/decode functions alone.
Introduce gsm0808_dec_lcls() and gsm0808_enc_lcls() as trivial wrappers
on top of GCR enc/dec routines which are made static. Adjust tests
accordingly. Test output intentionally left unchanged.
Change-Id: Icfbb2404e1a1d500243e2071173299b557369335
|
|
|
|
|
|
|
|
|
| |
Instead of duplicating the fmt and args in LOGPFSML and LOGPFSMLSRC, rather
make LOGPFSML invoke LOGPFSMLSRC with __FILE__ and __LINE__.
This is a cosmetic preparation for more tweaks coming up.
Change-Id: I2f23c57ebfdb5355919c06ac5ded7732e3b17a97
|
|
|
|
|
|
|
|
|
| |
In 99ae401e490e60fc07bef7eacc478be7bdcc9f5a we introduced the ability
to specify the TCP port to which the VTY should bind. However, the VTY
dcumentation wasn't extended accordingly, causing virtually all master
build jobs to fail.
Change-Id: I54fb0ca0d3a884a64a349b22de70f3d9bd1a6d54
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extend the vty_bind_cmd VTY command to allow to optionally specify
a port in addition to the IPv4 address.
Introduce telnet_init_default to relieve client code from having
to query the bind IPv4 address (and now the TCP port). Instead a
client only needs to pass the default TCP port to use.
Client code should use it like:
int rc = telnet_init_default(ctx, priv, OSMO_VTY_PORT_SGSN);
Change-Id: Id5fb2faaf4311bd7284ee870526a6f87b7e260f3
|