Commit Graph

4252 Commits

Author SHA1 Message Date
Neels Hofmeyr dd6f13636e add RSL_IE_OSMO_TRAINING_SEQUENCE
This IE is explained in the Abis manual in osmo-bts commit
Ie583bd5969fdb45f772af198033e58d7c4077306
http://git.osmocom.org/osmo-bts/commit/?id=823cd529649b667af20bfa4e383255a8ed5931f1

Change-Id: I573c26b1431ee789e42f6fa620947b003c384dc0
2021-05-19 18:34:33 +02:00
Pau Espin 645aec8237 vty: Introduce API vty_read_config_filep
This new API doesn't use host_config_set(), and allows passing a FILE*
from any source, not only a filesystem path.

Related: SYS#5369
Change-Id: I720ac04386261628c0798a1bfcaa91e2490a86c3
2021-05-18 14:56:52 +02:00
Pau Espin ebb6c1fc4d vty: Implement missing public API host_config_file()
The API was defined in the header file but not implemented.

Change-Id: I69de9864fa7cd421557b9fc630beefea6d90b4cc
2021-05-17 18:54:23 +02:00
Harald Welte 24980baac9 osmo_sock_*_ofd(): Mark OSMO_FD_WRITE on non-blocking connect()
When we perform a non-blocking connect, the completion of the connect
will be signaled by marking the fd as WRITE-able.  So we should
automatically set OSMO_FD_WRITE to make sure the user gets notified
on completion.

Change-Id: I22964c5d5da849abcd97a900bd86ab5b4ada05da
2021-05-08 10:40:13 +00:00
Pau Espin a5af04477e gb: Fix missing exporting symbol bssgp_encode_rim_pdu
The symbol was not in the list of exported symbols.

Change-Id: I4c3792c3b22989571548e40aa4fbf26912e699df
2021-05-06 20:28:27 +02:00
Pau Espin adef546ff9 Revert "gb: Fix naming and export symbol bssgp_enc_rim_pdu"
This reverts commit 43ad616e4b.

 _enc_ functions are for some ies while the _encode_ and _decode_ are
for the full pdu.  so the old name is correct.

Change-Id: Ib0b4a6fd7f8c96e4647a373541e3cccb324c6a11
2021-05-06 18:28:12 +00:00
Vadim Yanitskiy f466a1592f gsm/abis_nm: add missing NM_OC_IPAC_* value-string entries
Change-Id: I2181af229e8e7da12d716c176ab9230f09e29eef
2021-05-06 16:32:29 +00:00
Pau Espin 43ad616e4b gb: Fix naming and export symbol bssgp_enc_rim_pdu
The symbol was not in the list of exported symbols.
Take the chance that it was not used anywhere outside libosmocore to
rename it in order to follow similar naming as other existing APIs.

Change-Id: I534db7d8bc5ceb19a2a6866f07d5f5c70e456c5c
2021-05-06 17:56:47 +02:00
Pau Espin a488639e42 osmo_timer_pending: Make arg const
Change-Id: I250c25c3ac61ac364335f81d8ba50cb32fd6976e
2021-04-29 20:14:51 +00:00
Harald Welte 5782fec9ff ns2: change the 'priority' setting name to 'socket-priority'
This has been changed based on feedback from Pau Espin in osmo-mgw,
and for consistency we also adjust it here.  No backwards compat
needed as it was just introduced yesterday.

Change-Id: I88989dc17c8996609b895c43012f8cca98aa81dc
2021-04-29 21:29:48 +02:00
Harald Welte a545842609 ipa_ccm_make_id_resp: Make it work at all
This could never possibly have worked.  When iterating over the
different IEs to encode, we must of course use the tag of the current
iterator item, and not the hard-coded value of the second tag in the
list.

Change-Id: I148799c5bdb95f70118691c1150330ebac4fdf21
2021-04-29 19:59:12 +02:00
Harald Welte b189b5f29c Fix ipa_ccm_make_id_resp_from_req to work at all
The parser was so horribly broken, it could not ever have possibly
worked.

Change-Id: Ibed0ff7f8d36504ef783f2653c9982d4e25e874f
2021-04-29 19:59:09 +02:00
Harald Welte 539272dd8e Fix ipa_ccm_make_id_resp_from_req
In 2018, I4723361e1094b358310541a7dc4c5c921c778a15 introuced a
check against an integer unterflow.  However, the fheck got the
logic wrong, with the result of breaking the function completely:
It would always only detect the first tag within the IPA request
and then take the branch that assumes an integer underflow.

Change-Id: I344975d0bda565ff196a1c0c69305cd349b98a19
2021-04-29 19:55:43 +02:00
Harald Welte d99e4eee2b ns2: Allow setting the socket priority for a UDP bind
Change-Id: Ifdfa086ce1c8d62b256abb3454b70cf53da9dcdb
2021-04-29 19:55:34 +02:00
Harald Welte 915caf75e2 gprs_ns: Fix another DSCP vs. TOS mistake in old NS code
DSCP is a 6-bit value stored in the upper 8 bit of what was used to
be known as TOS.  Let's use the newly introduced OSMO_SOCK_F_DSCP()
to prevent having to worry about this in higher level code.

Change-Id: I6b9848fd0752d99d3df5346313618d5847d64fb8
Related: OS#5136
2021-04-29 15:54:59 +02:00
Harald Welte 485b3f7c85 ns2: migrate from osmo_sock_set_dscp() to OSMO_SOCK_F_DSCP()
The latter is much more compact than the former.

Change-Id: I2a24c0cbb17fad8ed84297267dcd63730efbc014
2021-04-29 15:54:59 +02:00
Harald Welte f8a4e133d5 gprs_ns2_frgre: Ensure DSCP is sin premitted value range
gors_ns2_udp has this check, but gprs_ns2_frgre was missing it.

Change-Id: I9bb9c6bdfe81fa6f02b11a02550ac9a54d3bfeaf
2021-04-29 15:54:59 +02:00
Harald Welte 628f534817 gprs_ns2: Fix yet another DSCP vs. TOS mix-up
This is a follow-up to I64fee56b04d0ecd128bf661699d5071817ea96ec,
due to code duplication there was another code path that manually set
the IP_TOS socekt option that I missed in the first patch.

Related: OS#5136
Change-Id: I4bb22d0f67984077706b694eb7e75327b41b6fcf
2021-04-29 09:02:25 +00:00
Neels Hofmeyr 87fa1caf4b fix default_timeout type of osmo_tdef_fsm_inst_state_chg default_timeout
The api doc indicates the possibility to pass -1, and calling
osmo_tdef_get() actually casts the arg to a signed long. To end the
confusion, change default_timeout from unsigned long to long.

Change-Id: I51b9172603984839448346c9836e43c8c802fcf8
2021-04-28 18:31:31 +00:00
Harald Welte 903e670c54 socket: IPv6 support for osmo_sock_set_dscp()
IPv6 has the analogous to DSCP: The "traffic class" field.

See https://tools.ietf.org/html/draft-itojun-ipv6-tclass-api-03

Change-Id: Ib31b977f67d60aa7f30ca4ab6eceba3d1d5eeee1
Related: SYS#5427
2021-04-28 14:39:19 +02:00
Harald Welte c545ff6f3e socket: QoS support for all our socket init functions
Every socket function that can be passed a 'flags' argument now
supports the following two additional macros that can be or-ed in
with the flags:
* OSMO_SOCK_F_DSCP(x) -- specify the IP DSCP of the socket
* OSMO_SOCK_F_PRIO(x) -- specify the priority of the socket

The existing osmo_sock_set_{dscp,priority}() functions are useful,
but  you cannot call them in between the socket creation and the
connect() operation when using our socket helpers.  This means that
the first packet sent will have the default DSCP/priority, and only
later packets would have the desired values.

When using the functionality introduced by this patch, we can ensure
that even the very first packet of e.g. a TCP or SCTP connect()
will have the correct DSCP/priority applied.

Change-Id: If22988735fe05e51226c6b091a5348dcf1208cdf
Related: SYS#5427
2021-04-28 13:15:20 +02:00
Harald Welte faf6b70b0e socket: reduce code duplication, introduce socket_helper_tail()
Common bits shared by various functions (currently setting
non-blocking) should not be copy+pasted around.

Change-Id: I95056940ddc26b65f63eedaeaab6882edaef6317
2021-04-28 13:15:20 +02:00
Harald Welte ecc0bd8d42 socket: Introduce osmo_sock_set_priority() helper function
In some situations we want to set the SO_PRIORITY socket option
to determine the in-kernel priority of packets generated by this
socket.

Change-Id: I89abffcd125e6d073338a5c6437b9433220e1823
Related: SYS#5427
2021-04-27 22:25:13 +02:00
Harald Welte c96d716606 ns2: Fix setting the DSCP value.
DSCP is a 6-bit value (0..63) stored in the upper 6 bits of what was
formerly known as TOS bits.  We must
* make sure the user can only specify 0..63
* shift the value by two bits when using the IP_TOS socket option

We achieve the latter by using the recently-added osmo_sock_set_dscp()
helper.

Change-Id: I64fee56b04d0ecd128bf661699d5071817ea96ec
Closes: OS#5136
2021-04-27 21:57:52 +02:00
Harald Welte ce53e03dc9 socket: Introduce osmo_sock_set_dscp() to set socket DSCP value
At least on Linux, sockets have a IP_TOS socket option that can be
configured to set the TOS.  However, TOS (of RFC791) was replaced
by the DSCP (of RFC2474) in 1998.

As the DCSP bits are only the upper 6 bits of the TOS bits, let's
introduce a helper to get, mask and set the DSCP values in the TOS
bits.

Related: OS#5136, SYS#5427
Change-Id: Ia4ba389a5b7e3e9d5f17a742a900d6fd68c08e40
2021-04-27 21:53:32 +02:00
Harald Welte 069967be86 ns2: Dump frame relay state to VTY during "show ns"
When doing a "show ns", let's also dump the state of the frame
relay network, with all its links and DLCs (if any).

Change-Id: I798af3e97dc014b6e0fcde86560a1809852f7510
Related: OS#4877
2021-04-25 21:09:23 +02:00
Harald Welte 47cc55ceac frame_relay: Export osmo_fr_network_free()
The function already existed, it was just not declared and not
exported.

Change-Id: I3f2a7e2fd1a4eda6bbed8510cf82951d73bb3f84
2021-04-25 21:09:23 +02:00
Harald Welte a912d192f1 sim: Remove 'printf' from library code
Those were really meant as an early debugging aid and should not
have survived this long.

Change-Id: I4e9a80ced15686734d4485c232c5936f566cfd76
2021-04-25 21:09:23 +02:00
Harald Welte 22117a7164 sim: Obtain card ATR when opening the card
Change-Id: I42e387535c40f371b06f384af0ca5dc1e42ed00e
2021-04-25 21:09:23 +02:00
Neels Hofmeyr a0f2b21c6d gsm48_mr_cfg_from_gsm0808_sc_cfg(): drop bitmask without effect
GSM0808_SC_CFG_AMR_4_75_5_90_7_40_12_20 has value 0x0002, so the
'& 0xff' had exactly no effect.

Change-Id: Ia25ac20539e8ac70fb5f70c1191bd58825151c68
2021-04-22 18:49:44 +00:00
Pau Espin cde47795d1 gsm0808: Introduce gsm0808_old_bss_to_new_bss_info_att_tlvdef
Introduce TLV attribute definition for "Old BSS to New BSS Information"
container.

Related: SYS#5337
Change-Id: I0e55e947b6fef6dad0cf1a6c16b781bef4cc76c5
2021-04-21 19:02:31 +02:00
Neels Hofmeyr 4b44ac4012 RR: add missing Extended TSC Set IE
Defined in 48.018 10.5.2.82.
This will be used by Channel Mode Modify for VAMOS.

Related: SYS#4895 SYS#5315
Change-Id: I9bad6e7121af43dfa9706635e58279ce672a4e14
2021-04-20 02:43:40 +02:00
Neels Hofmeyr a9da9f7640 RR: add VAMOS channel modes
Also add functions to convert between VAMOS and non-VAMOS speech modes.

Related: SYS#4895 SYS#5315
Change-Id: Ie0ea592da5610ae70290106d004e549cf3212a89
2021-04-20 02:42:42 +02:00
Pau Espin 49766ab1b6 cosmetic: fix typo in comment
Change-Id: I43cb7b88a4e867836a67928e361253ce0f02a329
2021-04-19 12:14:36 +02:00
Pau Espin 1b625cb134 gsm: Support Sending Last EUTRAN PLMN Id in Handover Required
Related: SYS#5337
Change-Id: I6280ce1abc283f1491bc6f391b2dd952df33a16b
2021-04-19 10:55:43 +02:00
Vadim Yanitskiy e731a7da05 protocol/gsm_08_58.h: add asymmetric CSD data rates
The new values are present in 3GPP TS 48.058, V16.0.0 (2020-09).

Change-Id: Icf4c83fa443b8410f4362c119b0a85419036b9cd
2021-04-19 05:02:37 +02:00
Vadim Yanitskiy 307b201e8e protocol/gsm_08_58.h: add more 'Channel rate and type' values
The new values are present in 3GPP TS 48.058, V16.0.0 (2020-09).

Change-Id: I0aaea1549e6de01c374d6b46353312e6246078e0
2021-04-19 04:43:30 +02:00
Vadim Yanitskiy 99f6cd5f54 protocol/gsm_08_58.h: add RSL_CMOD_SP_{GSM4,GSM5,GSM6}
The new values are present in 3GPP TS 48.058, V16.0.0 (2020-09):

 * RSL_CMOD_SP_GSM4 - OFR AMR-WB or OHR AMR-WB,
 * RSL_CMOD_SP_GSM5 - FR AMR-WB,
 * RSL_CMOD_SP_GSM6 - OHR AMR.

Change-Id: I40eca759380c8895d7923b2b4259d37a50978160
2021-04-19 04:27:53 +02:00
Alexander Couzens 27a5592205 gprs_ns2: add functions for SNS add/del/change-weight messages
Related: OS#5036
Change-Id: Ib9492e213e82c18c7dcce6ba7d64e897b4c74796
2021-04-18 06:38:34 +00:00
Alexander Couzens 0a7c5eea22 gprs_ns2: SNS: allow transition missing transition GPRS_SNS_ST_UNCONFIGURED
A transistion from GPRS_SNS_ST_UNCONFIGURED -> GPRS_SNS_ST_UNCONFIGURED.

Related: OS#5036
Change-Id: I125e7e5a08ea6aff6e0308a18b5c0a6d0392ad32
2021-04-18 06:38:34 +00:00
Pau Espin 4da98cc943 cosmetic: Fix trailing whitespace
Change-Id: Ib79b0e0c728a7f4de0b3884785c73ab2d0d44f4e
2021-04-14 21:28:19 +02:00
Pau Espin d110529972 cosmetic: tlv_parser: fix typo in func description
Change-Id: I27f28376a88f00d86a0f65595f61f6026f7e0fd4
2021-04-14 17:21:02 +02:00
Pau Espin 8b913af11e gsm_08_08.h: Add extra field elements defined in other sections
The Signalling Field Element Coding list defined in 3.2.3 is used in
"Old BSS to New BSS Information" and "New BSS to old BSS Information"
IEs. However, the former IE (Old->New Info) defines 2 extra Field
Elements in 3.2.2.58 (3GPP TS 48.008 version 16.0.0 Release 16) not
present in 3.2.3.

Related: SYS#5337
Change-Id: I4db3f7974887e4c798a30c5b51a19472ceeee27d
2021-04-14 16:30:32 +02:00
Alexander Couzens 79a3a84b15 gprs_ns2: fix nsvc block and unblock vty command
e7dfeac8dc introduced a regression in the block/unblock check
as it was using the priv->initiate_block instead of priv->om_blocked.
The initiate_block tracks who is responsible to unblock the NSVC.

Fixes: e7dfeac8dc ("gprs_ns2_vty: print a response to vty `nsvc <nsvci> (block|unblock|reset)")
Change-Id: I516faea223e30b120a297faed10636daa554be8a
2021-04-13 12:38:44 +02:00
Vadim Yanitskiy 4b46b7eb53 vty/logging: logp: properly handle library specific sub-systems
The library specific sub-systems are kind of special, because their
position in the 'osmo_log_info' may vary depending on the number of
application specific sub-systems.  This is why their associated
constant values (like DLGLOBAL) are negative, and this is what
the LOGP() macro expects as the first argument.

Before this change, invoking 'logp' command with any library
specific logging sub-system would result in getting messages
printed with the fall-back DLGLOBAL sub-systems.

Change-Id: If86563e169fe1243adfa7b09c9d65d9f88c8a99e
2021-04-12 12:15:17 +00:00
Neels Hofmeyr 47c7b4fc24 add osmo_bts_features_names: short BTS feature strings
This will be used by osmo-bts-omldummy to parse features strings from
the cmdline.

Note that osmo_bts_feature_name() already exists to return the longer
descriptive value_strings from osmo_bts_features_descs (_descs!).
Luckily that misses the plural 'features' in the name, so that I can
still add a properly named osmo_bts_features_name() function that only
returns the name, matching the common pattern used in osmocom code.

Related: SYS#4895
Change-Id: I699cd27512887d64d824be680303e70fff3677c1
2021-04-09 00:10:44 +02:00
Neels Hofmeyr 524b4f802f deprecate osmo_bts_feature_name(), add osmo_bts_features_desc()
The function osmo_bts_feature_name() is ill-named for two reasons:
- it returns descriptive text instead of just a string representation of
  the name.
- The enum is named "osmo_bts_features", so the function name lacks the
  "s" for "features".

Rationale: An upcoming patch adds a function to return just the name,
properly called osmo_bts_features_name(), so deprecate the weirdly named
one first.

Change-Id: I9dfdb5e81037b6000effbd340af4e5db0dcfd69c
2021-04-08 23:11:45 +02:00
Oliver Smith d4393608a4 stats: have_value is a bool, not int
Change-Id: Id92c63f4e54ec1bf3411205be1bd268e1d184b03
2021-04-07 18:39:05 +00:00
Oliver Smith 2623fca8ad stats: log error when missing stats values (v2)
Related: SYS#4877
Change-Id: I5140d967c2f1d36dadf93b03e52b9bbd42e2a3a6
2021-04-07 18:38:54 +00:00
Oliver Smith c7930589fd stats_test: restore stat_item_get_next asserts
This is a partial revert of b27b352e ("stats: Use a global index for
stat item values"). Now that osmo_stat_item_get_next correctly returns
how many values have been skipped, we can use the accurate asserts on
its return value again.

Fix the initial values of next_id_a,b (1 instead of 0), so we don't get
a skipped value on the first read. This is needed, because b27b352e
refactored osmo_stat_item_get_next to have the next id as parameter
instead of the last read one, and the initial value was not adjusted in
the tests.

Related: OS#5088
Change-Id: I9d4cda2487a62f52361c24058363dfa90e502c63
2021-04-07 18:38:54 +00:00