Commit Graph

2831 Commits

Author SHA1 Message Date
Max cb02a391cd Update msgb Lx helpers
* add missing L1 and L4 hexdump
* add msgb_l4() for consistency and convert msgb_sms() into simple alias

Those will be used in follow-up patches for msgb debug/test helpers.

Change-Id: I8d6dd1b1ff3aa98a452711c692ca7dee0449203b
2018-12-03 16:11:58 +00:00
Philipp Maier 225bdf4779 gsm0808: add message generator for BSSMAP HANDOVER PERFORMED
We currently have no generator function that can generate BSSMAP
HANDOVER PERFORMED messages. Lets add function for this.

Change-Id: I825106858bd89afc9837811b8fed2e8accc82441
Related: OS#3645
2018-12-03 13:54:31 +00:00
Alexander Couzens a2f696fa5c configure.ac: check clock_gettime for glib < 2.17
glib < 2.17 doesn't support clock_gettime directly, it is available
via librt.

Change-Id: Ice853d85ffe859b1d4df48b91b050c24d85c861b
2018-12-03 13:52:29 +00:00
Max f69aa9cb6a Move BSSMAP_MSG_* defines to header file
This will be reused be several tests related to TS 48.008 and TS 29.205
in follow-up commits.

Change-Id: I4d8cc05b8df8e70c1f6257e53ae3acec7901681f
2018-11-30 17:45:57 +01:00
Max a66de71f8e ctrl: print textual error on IPA parsing failure
Change-Id: I49bb613b416d549f554fd9d23cd37b63954324db
2018-11-26 10:15:02 +01:00
Neels Hofmeyr 7ab5fc1f3b add contrib/struct_endianess.py
In libosmocore (and likely elsewhere) we have scores of packed structs with
sub-byte integer members that lack the necessary member reversal shims to be
able to work on big endian architectures.

Instead of manually editing each one of them and probably introduce errors in
the process, this script handles the change automatically, and in the future
allows us to verify correctness in gerrit verifications.

Change-Id: I8e75b17d8071c7b3a2a171ba776fb76854b28a53
2018-11-22 13:49:24 +00:00
Max 49c06680e7 Update gsm0808_create_ass() doxygen
* add spec reference
* remove LCLS note: CI parameter is optional but have nothing to do with
  LCLS

It's pretty hard to decipher from the spec what CI is useful for and we
have not used it anyway so let's just keep it as "Optional" for now.

Change-Id: I5552732afcec48047d993ae6ffb73a3e5d7c9202
2018-11-22 12:54:52 +00:00
Pau Espin c8772517d9 gsm: Deprecate buggy gsm_arfcn2band API and introduce gsm_arfcn2band_rc
ARFCNs are values in well defined ranges. Until this patch, ARFCNs not
belonging to any band were blindly assigned to DCS1800 by
gsm_arfcn2band, causing unnoticed bugs and misconfigurations in
osmo-bsc.

Previous API gsm_arfcn2band cannot accomodate this kind of check easily,
so let's deprecate it to tell people to use a new API gsm_arfcn2band_rc
which performs this kind of checks and allows callers to log failures,
misconfigurations, etc.
At the same time, modify implementation of gsm_arfcn2band to abort if an
invalid ARFCN is passed, this way users of this API can notice they are
passing wrong data to it that most probably will produce unexpected
results.

Related: OS#3063
Change-Id: I780d452dcebce385469e32ef2fd844df6033393a
2018-11-20 16:56:28 +00:00
Max 738782467f LCLS: add 48.008 parameter structure
It's convenient to hold all LCLS-related parameters from 3GPP TS 48.008
in a single structure.

This will be used in follow-up patch handling Assignment Request with
extended parameters as well as corresponding BSC code working with LCLS.

Change-Id: I4b873f9a3c5a5d33b438382971b3d92e40d48d62
Related: OS#2487
2018-11-20 12:32:56 +00:00
Stefan Sperling c6bfc63d10 document unblock-ack vs. signalling in gprs_ns_process_msg()
Since commit 797558ea17 we send the
NS_UNBLOCK_ACK message before dispatching the NS_UNBLOCK signal,
instead of afterwards.

Add comments which explain the intended order of events.

Suggested-by: Pau
Related: OS#2388

Change-Id: I4b93853c952a97302f8afc14f462f22c3e487564
2018-11-20 11:06:05 +01:00
Stefan Sperling 797558ea17 send NS_POUT_UNBLOCK_ACK before signalling S_NS_UNBLOCK
In gprs_ns_process_msg(), we were dispatching the S_NS_UNBLOCK
signal before sending out the NS_POUT_UNBLOCK_ACK message.

Signal handlers might send messages to the other side, assuming
that NS is now unblocked. However, since such messages will arrive
before the UNBLOCK_ACK message the receiver might discard them.
This problem has been observed with our TTCN3 BSSGP_Emulation
as a peer to osmo-pcu.

This patch makes TTCN3 PCU TC_paging() test pass regardless of
whether the test or osmo-pcu is started first. Before this patch,
this test would only pass if the test was started before osmo-pcu.
A remaining problem is that the test does not yet keep passing
reliably unless osmo-pcu is restarted between test runs.

Change-Id: I3af54a14bb6bcfa167c9a9d9f67835e7f5b9f1bb
Related: OS#2890
Related: OS#2388
2018-11-19 17:30:37 +01:00
Neels Hofmeyr 5a25c3ec4d gsm_44_318.h: remove #if 0 from struct gan_cch_desc_ie
These are actually parts of the struct in big endian order, which will soon be
done automatically by struct_endianess.py.

Change-Id: I9bc694f10fa9cef0bb7fc791bb40e7602459b16b
2018-11-19 14:38:45 +00:00
Max adc4172fe3 Add missing header include
That's necessary for 'struct tlv_parsed' definition although lack of it
does not cause build failure in libosmocore for me but does so for
osmo-bsc.

Change-Id: I3b2d3955d02b07dc7ec5e9f0c66cc477196703ed
2018-11-19 10:44:55 +01:00
Max ed651d2485 Support cipher mode reject with extended cause
* add function to generate cipher mode reject with extended (2-byte)
  Cause IE
* add function to get (extended) Cause value
* add corresponding (extended cause) test
* update existing (non-extended cause) test
* use enum as a parameter for existing non-extended version to make
  interface more unified

Change-Id: Id5509b94a18180a44f45300caaa02b843c166fa3
Related: OS#3187
2018-11-19 05:52:28 +00:00
Max 84fb5bb6a0 Move msgb_push helpers to public header
The msgb_wrap_with_TL() is generally useful so it make sense to make it
public to facilitate code re-use.

Other helpers can be implemented as trivial wrappers over existing tlv.h
functions. Update headers and code accordingly.

Change-Id: I37e91d031fba28cf1c6735b8069b0265746f55e6
2018-11-19 05:47:25 +00:00
Pau Espin d8d0c3e2d1 gsm48: gsm48_decode_freq_list: Improve documentation of paramter f
Change-Id: Id8e3afff737211ded3c5689f2c83b1a544b42f9d
2018-11-18 20:44:04 +00:00
Max 961db7c270 Update GSM0808_LCLS enums
Add values indicating that LCLS control/config/status value has not been
received yet.

Change-Id: I52dc6a52f5ee043ed2c1625ffecfd495e3c746b1
Related: OS#2487
2018-11-18 20:20:48 +00:00
Max aa93463053 Update 3GPP TS 08.08 Cause handling
* add Class definitions
* add helper to check for extended bit
* add helper to get Cause's Class
* use enum in gsm0808_cause_name() and gsm0808_create_cipher_reject() to
  avoid confusion between class and cause
* update gsm0808_create_cipher_reject() comments

Change-Id: I31b31dfc22eb4b6b07089e1255246ac458125340
Related: OS#3187
2018-11-18 20:14:06 +00:00
Max c0d1de36f3 Add helper wrapper for BSSAP TLV parsing
Change-Id: Ib228368901ce90a02a5664f2510593371c7d29cd
2018-11-18 20:13:15 +00:00
Philipp Maier af6710f4d4 fsm: fix apidoc of osmo_fsm_state_name()
The api documentation of osmo_fsm_state_name() refers to an FSM
instance, but it really means the state of an FSM.

Change-Id: I88ddd6048426d380c49170e66f57b3843398c046
2018-11-16 17:45:40 +01:00
Philipp Maier 086b345414 gsm29118: add value strings for SGSAP IEI
The value strings for the SGSAP IEI are missing, lets add a set of value
strings and a function to retrieve them.

Change-Id: I2787303174f74ffba86675bce2c12f680d8ea708
Related: OS#3615
2018-11-16 17:42:38 +01:00
Martin Hauke e63b887358 gsm/protocol/gsm_08_58.h: Fix typo
Fix a typo that prevents building on ppc64 (Power8, Big Endian).
Tested with gcc version: 8.2.1+r265487

/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I../include -I../include  -DBUILDING_LIBOSMOCORE -Wall -Wall  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DBUILDING_LIBOSMOCORE -Wall -c -o panic.lo panic.c
 In file included from ../include/osmocom/gsm/rsl.h:6,
                  from gsmtap_util.c:37:
 ../include/osmocom/gsm/protocol/gsm_08_58.h:60:4: error: expected specifier-qualifier-list before 'sapi'
     sapi:3;
    ^~~~

Change-Id: I4a40fc68cb6dfdfadfcc34213c4ecdabbbc356f2
2018-11-15 14:53:13 +01:00
Oliver Smith 4c9d1479a6 merge_doc.xsl: move to osmo-gsm-manuals.git
Allows building the manuals without the checked out libosmocore source.

Related: OS#3385
Depends: I8e7036fae062ee783cb132b14608827a82c5e7c7 (osmo-gsm-manuals)
Change-Id: Ifb81b18422987cdf36b75993d2782abf93b5f48c
2018-11-12 14:07:05 +01:00
Philipp Maier 534a4b2897 gsm_29_118: add missing include to header file
The header file gsm_29_118.h is defining variables of type struct
value_string, which is declared in core/utils.h. We should add an
include to utils.h to prevent confusion when the header is used.

Change-Id: I9f9bb62d29cd068820ad5aa677717bd448de3f4a
Related: OS#3615
2018-11-07 11:35:21 +00:00
Oliver Smith 860651ebd8 socket.c: fix IP and port buffer sizes
Use INET6_ADDRSTRLEN (46) instead of 64 for IP address buffers, and 6
instead of 16 for port buffers (the highest possible port number is
65535).

Change-Id: Ia25e2f3277ad2f60df31c08d12f42c1e6d2a14a6
2018-11-06 21:44:28 +00:00
Neels Hofmeyr ba2bd2eeb1 jenkins: print gcc version in log
Change-Id: I8dfac78868f64213413e80cc52ac585d9d4a2c93
2018-11-06 21:43:16 +00:00
Vadim Yanitskiy e521edefda core/msgb.h: introduce msgb_l4len() helper
There is already a group of similar functions for L1, L2 and L3,
but L4 was missing. The L4 is usually used for parsing of complex
L3 messages, such as SS/USSD and SMS.

This change introduces a similar halper for L4.

Change-Id: I755f2d654bbdad2a8b4f94df9023bdd370b07ae6
2018-11-07 03:58:10 +07:00
Max fa3b482277 Fix deprecation warning in gsm0808_test
Use gsm0808_create_layer3_2() directly instead of deprecated wrapper.

Change-Id: I44772666c929dfd94d25953379cf51b371ce202c
2018-11-06 17:25:57 +00:00
Vadim Yanitskiy 5a7b465b09 gsm/gsup.h: cosmetic: use tab for comment alignment
Change-Id: Id71d4b45e2b9f42da5e23e709ad97d4d0abfc3d9
2018-11-06 18:24:49 +07:00
Philipp Maier a75e349b28 gsm48: correct apidoc for gsm48_generate_mid()
The API documentation lacks the the description for the last parameter,
lets add a description for it.

Change-Id: Ibcd25d3a7ddd7075eb15daff6dba42236d14d945
2018-11-02 22:06:34 +00:00
Max 2b4a67a412 Update cipher reject function
* add note about (yet) unsupported standard feature
* use enum constant instead of hex value

Change-Id: I5cc5fc1ae8d5474dbc8d3385a493adf6420a3c98
Related: OS#3187
2018-11-02 16:12:03 +01:00
Philipp Maier 1a146c89e2 gsm0808: cosmetic: rename parameter "reason" to "cause"
The function that generates the clear command takes a parameter
"reason", which is the cause code. Lets give it the name "cause" to have
a coherent naming scheme that matches the other functions and the 3gpp
specs.

Change-Id: I7b6c15e8fa8db13deef5041095944ca1c58fb99f
2018-10-30 09:36:49 +01:00
Philipp Maier b254daf64f gsm0808: fix doxygen apidoc
The api documentation names a parametery by a different name than it is
listed in the parameter list of the function. Lets make the apidoc
coherent.

Change-Id: Id21ed1e920fb64522a734f206efbe2871ec05b06
2018-10-30 09:34:57 +01:00
Stefan Sperling 84eb1ab153 make 'show rate-counters' show group index
Show each rate counter group's index in the output of the
'show rate-counters' command, to provide some way of telling
apart distinct instances of the same rate counter group.

This is not a very user-friendly UI because these indices are
generated internally by libosmocore and/or applications, so
users cannot easily assign meaning to these indices. However,
the current rate counter implementation doesn't allow for more.

Change-Id: Ieb151239407e4b2f8859fefec8d0670f5ddf908a
Related: OS#3674
2018-10-29 17:50:30 +01:00
Stefan Sperling 7c75ffb563 stop printing group description in vty_out_rate_ctr_group_fmt()
When vty_out_rate_ctr_group_fmt() prints the description of a
counter group, it assumes this description should appear at
the beginning of a line. However, the caller might be printing
counters in an indented context. So just let the caller worry
about printing the group title if necessary (there is currently
only one known caller, which is updated in this commit).

Note that printing of the group title was an undocumented feature.

Change-Id: I2c55cb54e8b7a7c8c6cf72f22287083767ed0201
Related: OS#2660
2018-10-29 13:48:47 +00:00
Harald Welte de1da35d51 gsm23003: Add MME domain name related helper functions
osmo_gen_mme_group_domain(), osmo_gen_mme_group_domain() and
osmo_gen_home_network_domain()

Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb
2018-10-28 14:16:18 +01:00
Oliver Smith 7acd5d0394 add osmo_sock_get_{local,remote}_ip{,_port}()
Return only the IP or port of either the local or remote connection,
not the whole set of IP and port of both the local and remote
connection like osmo_sock_get_name() does it. This is needed for
OS#2841, where we only want to print the remote IP.

Related: OS#2841
Change-Id: I6803c204771c59a2002bc6a0e6b79c83c35f87e1
2018-10-26 17:54:16 +00:00
Oliver Smith e74f49d973 cosmetic: fix typo (soocket -> socket)
Change-Id: I2184bf12398902d933f3744bc094418cc6961e86
2018-10-25 11:56:19 +02:00
Daniel Willmann 0c878fd4f5 stats_statsd: Send all stat_items as gauges
When sending a statsd metric we need to specify a type which can be a
"g"auge, "c"ounter, "t"imer, "h"istogram, and "m"eter.

We used to just pass the stat_item unit into this field, but that is the
unit of the metric (Seconds for a timer, % for utilization, ...).

Change the type field so stat_items are sent as "g"auges. Note that
negative values don't seem to be supported by statsd.

Change-Id: Ia16270d36c9a14521594de4b99a48c83e4ac07d4
2018-10-24 16:37:05 +02:00
Max 7a2ec6e118 vty: adjust telnet log
Adjust wording so telnet command can be directly copy-pasted from the log to access
the interface without the need for further editing.

Change-Id: I1876447f9285adcd1b09937a6121afabd0b32e52
2018-10-24 11:29:31 +02:00
Vadim Yanitskiy ee86b04883 libosmogsm/gsup.c: fix error code in osmo_gsup_encode()
Missing (unset) type of to be encoded message is not a memory
allocation failure (-ENOMEM), this is definitely a mistake.

Change-Id: Ibbac18e2b68b765c17c2bc959c4c085037953a7f
2018-10-21 12:56:54 +00:00
Harald Welte 6721144c80 SGsAP protocol definitions (header + C file)
Change-Id: Idddfc9b851eb4c2fa7dd661a9ce1b03a04883109
2018-10-21 12:35:34 +00:00
Pau Espin fb97e72e52 gsm_08_58.h: Introduce struct abis_rsl_chan_nr
It will allow to make code handling chan_nr values more easier to read
and less prone to errors.
union is used to be able to get the full octet in
case we need to pass it somewhere else or encode it.

An extra union is used in struct abis_rsl_common_hdr and others to allow
using fields directly while keeping API compatibility.

Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9
2018-10-21 12:25:13 +00:00
Harald Welte 2e0a945d3d vty.c: Set vty->fd to -1 after closing the FD
Change-Id: I07d105f4a810dd809fbf6feb5c04e7410020c887
2018-10-21 13:46:07 +02:00
Harald Welte e8e4322bc9 telnet_interface: avoid double-close of fd()
Change-Id: Ibd81f29fa22d53553bd73c055d6a1f5255a69bad
Fixes: Coverity CID#135238
2018-10-21 13:46:07 +02:00
Harald Welte 37608f911d timerfd_create(): Fix error handling of osmo_fd_register()
Change-Id: Ia2528cc3e3155bbc9cb32dee0e3af99cc6e1c654
Closes: Coverity CID#188853
2018-10-21 13:46:07 +02:00
Harald Welte 41b6b5e3fc osmo-config-merge: fclose() what we fopen()
Change-Id: Ib44f902e5bca2277f1b340d34fabbd2a298d683e
Fixes: Coverity CID#188851
2018-10-21 10:58:33 +02:00
Philipp Maier f6c369fb8c gsm0808: allow decoding of zero length speech codec lists.
3GPP_TS_48.008, 3.2.2.103 Speech Codec List states the following:

"The length indicator (octet 2) is a binary number indicating the
absolute length of the contents after the length indicator.
The length depends on the number and type of Speech Codec Elements
to be included. The minimum length of one Speech Codec Element is 1
octet and the maximum length is 3 octets. The maximum number of
Speech Codec Elements within the Speech Codec List is not defined."

This clearly refers only to the length of a single speech codec
element but not on the overall list. So speech codec lists with
length 0 are indeed permitted by the spec.

- Remove the assertion that checks on zero length speech codec
  lists.

Change-Id: I1eb1f4466b98bdd26d765b0e4cc690b5e89e9dd6
Related: OS#3657
2018-10-16 16:41:45 +02:00
Stefan Sperling e484d42bf2 add support for ipaccess messages on the ctrl interface
In ctrl_handle_msg(), check for IPACCESS protocol messages and respond
to such messages in the same way as ipa_ccm_rcvmsg_base() does. This will
allow the TTCN3 IPA "chopped ping" test to pass on control interfaces.

Change-Id: I9d7137c830981ccad03806b30b776e2b1f1b4699
Related: OS#2010
2018-10-15 11:53:20 +00:00
Pau Espin 4290803d89 gsm_08_58.h: Introduce struct abis_rsl_link_id
It will allow to make code handling link_id values more easier to read
and less prone to errors.
union is used to be able to get the full octet in
case we need to pass it somewhere else or encode it.

An extra union is used in struct abis_rsl_common_hdr to allow using fields
directly while keeping API compatibility.

Change-Id: Ibd75a493bcfdf46c028ea466867d0c0d83d46343
2018-10-10 20:43:25 +00:00