Commit Graph

723 Commits

Author SHA1 Message Date
Harald Welte fc08927fd2 hnbap_common: Make error message more verbose (which type failed)
Change-Id: I3d263a2a50afbe1a2a99e52b16e983e0aae22edf
2024-03-27 21:43:50 +01:00
Harald Welte c16281f5e7 constify {hnbap_rua}_cause_str() argument
ranap_cause_str() already had a const input argument, but the
HNBAP and RUA equivalents for some reason had a non-const input.

Change-Id: I7db92b51847c282d23d568970dfd2bedecdea486
2024-03-27 12:44:46 +01:00
Harald Welte da6d72b47a ranap_common: fix pointer type in ranap_decode_rab_releaseitemies_fromlist()
This looked like a copy+paste mistake in Change-Id I4fc88402a863bc1482947985f759d3a26eea4164

Related: OS#5152
Change-Id: I16286c6f13dc4e8d5c6a7f0efacd22bafe04b0a5
2024-03-15 20:37:38 +01:00
Harald Welte 6c1857a113 Add ranap_decode_rab_releaseditemies_fromlist()
This function is analogous to existing ranap_decode_*_itemies_fromlist()
which we already had.

This is needed in an upcoming osmo-hnbgw patchset where we need to parse
the ReleasedItems in order to track RAB release progess in order to
gather KPIs on RAB release.

Change-Id: I328819c650fc6cefe735093a846277b4f03e6b29
2024-03-15 20:36:34 +01:00
Harald Welte 50a0675cde Fix license headers: Should have been AGPLv3+, not GPLv2+
I'm not sure why one files (written by Philipp)
did contain a GPLv2+ header, instead of the AGPLv3+ which is the
actual overall project license.  I consider it a mistake.

In any case, any copyrightable contribution to those files was done by
sysmocom employees, so I as managing directory can legally make a
license change, whther or not it was a mistake early on or not.

Change-Id: Ie28c32022a9cbc42b55195f7dbb513228857a3cd
2024-02-17 10:28:29 +01:00
Vadim Yanitskiy a251647639 build: include git-version-gen into the release tarball
Change-Id: I2e8e1b186ee35ae7ff761a98ddb601f1f1292337
2024-01-26 23:34:19 +07:00
Oliver Smith 06daf81a92 Bump version: 1.5.0.3-a99b → 1.5.1
Change-Id: I01d1cebfe4fdd0bce53260d69e3f037068194ea8
2023-12-15 15:14:19 +01:00
Daniel Willmann a99b82b82c iu_client: Handle empty CR and InitialUE Message in DATA.ind
Related: OS#6307
Change-Id: I749ede737b9ac15bca37bbb16f3988b0db1125c1
2023-12-13 18:01:37 +01:00
Daniel Willmann 2c909d1e8b iu_client: Use local variable to track conn_id
Change-Id: I967a311e2ad5af585c032426cc6b0680c3313b0f
2023-12-13 15:22:56 +01:00
Pau Espin 5484d958c6 ranap_transp_layer_addr_decode2(): Fix decoding X.213 IPv4 address len=7
It was found in the field that some peers sends an X.213 IP address
consisting of 7 bytes (1byte IDP/AFI, 2byte ICP, 4 byte IPv4 address) insetad
of 20 bytes.

This is indeed possible when reading ITU Rec X.213 A.5.2.3, where it
states that Table A5 defining the 17 bytes DSP len for IANA ICP
"gives the maximum length of the DSP". So smaller values are still
possible/acceptable.

Related: SYS#6623
Change-Id: I507fb1605d976bd8573162e4fa81721245330184
2023-11-03 17:57:32 +01:00
Pau Espin 20b9eeb310 Bump version: 1.4.0.10-801d-dirty → 1.5.0
Change-Id: I11b3737b2d5447f1c35693a2cf37ab59adff57d3
2023-09-12 14:14:07 +02:00
Harald Welte 801d8b0e73 hnb-test.c: Update to libosmocore osmo_auth_gen_vec2
libosmogsm has recently deprecated the use of osmo_auth_gen_vec
and the osmo_sub_auth_data structure in favor of newer versions
of this API. Let's migrate to it

Change-Id: I8646caf14783833c4ebea041339c3056e4ac2dea
Depends: libosmocore.git Ie775fedba4a3fa12314c0f7c8a369662ef6a40df
2023-06-21 11:03:57 +00:00
Vadim Yanitskiy d6bde3f6a6 copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: I3476791a3a6a429f89df92db209acacd2ba5c79d
2023-05-18 17:22:26 +07:00
Pau Espin 0ded29a701 Move testdir src/tests/ -> tests/
Move tests to usual directory in most projects.

Change-Id: Ib9ca59d1dffbbb13fcb9ae2e597b3f114f77524e
2023-05-15 10:01:45 +00:00
Neels Hofmeyr 520c406b85 add ranap_new_msg_reset2() with GlobalRNC-ID
So far we are omitting the GlobalRNC-ID from all of our RANAP RESET
messages, because clearly, in 3GPP TS 25.413 9.1.39, the Global RNC-ID
is listed as optional.

OTOH, section 8.26.2.1 says
"The RNC shall include the Global RNC-ID IE in the RESET message."
Apparently an RNC must include this ID, while a CN omits it.

Related: SYS#6441
Change-Id: Iec70c3054333f01bc27ca0e69bfa325bbe36edd0
2023-05-11 22:26:07 +02:00
Neels Hofmeyr d90552df8a fix leak in ranap_new_transp_layer_addr()
Like BIT_STRING_fromBuf(), free any buffer previously kept in the target
BIT_STRING_t.

Context: osmo-hnbgw calls ranap_new_transp_layer_addr() to replace an
address in a decoded message, before re-encoding it. So far doing so
leaked the previous buffer.

Change-Id: Ic92fa317644c3a1f2be9badf455d34fe0b8ea2a4
2023-05-05 00:26:02 +02:00
Neels Hofmeyr a33955ce8f asn1tostruct.py: fix leak in error paths of iesDefs
Related: SYS#6297
Change-Id: I424c4ea2681f5c9a5eec99396502615de5eab841
2023-04-27 16:41:49 +00:00
Neels Hofmeyr 29d7e780fc fix PDU leaks in rua_generate_*() functions
Related: SYS#6297
Change-Id: I04eb1455e1fd43c239f352470bf971b73eb8b205
2023-04-27 16:41:49 +00:00
Oliver Smith be0b55e047 debian: set compat level to 10
Related: OS#5958
Change-Id: If00d77a3b83fa7ba000a346f087a6baf1966fdff
2023-04-25 16:48:29 +02:00
Oliver Smith c61a74f6c4 test-ranap: don't use libosmocore's tall_msgb_ctx
Use msgb_ctx from test_common.c instead, which is the same pointer after
test_common_init() ran. tall_msgb_ctx from libosmocore is no longer
getting exported since I13169c00a59fb59513dfc598de5a71d094492422.

Fix for:
  /usr/bin/ld: test-ranap.o: in function `main':
  /build/src/tests/test-ranap.c:201: undefined reference to `tall_msgb_ctx'
  /usr/bin/ld: /build/src/tests/test-ranap.c:201: undefined reference to `tall_msgb_ctx'

Change-Id: I7d0b3068760c2cd7067e2a5d929f03c7e7d1decb
2023-02-28 10:19:58 +00:00
arehbein 409d497eea Transition to use of 'telnet_init_default'
Related: OS#5809
Change-Id: Icc57c68337d55c6594c1c36e9bf41624d11dab0a
2023-02-25 17:48:58 +01:00
Pau Espin f0b84cc200 Bump version: 1.3.0.16-a319-dirty → 1.4.0
Change-Id: I1fa8e30166bb9dce402b636d20985946dee159aa
2023-02-07 16:39:50 +01:00
Oliver Smith a3193e4daa contrib/jenkins.sh: werror with WITH_MANUALS too
Change-Id: I6f1bbbc8d3ac04e8a82fb954c59ec30d6be46c13
2022-12-21 16:21:05 +01:00
Oliver Smith 69bb2fab2b asn1tostruct: don't use f-strings
Make the script work with python < 3.6 again by not using f-strings.

Fix for:
  SyntaxError: invalid syntax
    File "../../git/asn1/utils/asn1tostruct.py", line 94
      f" IE {ie}. Found another entry in ies {ie_other}" \
      ^

Fixes: 1d19c8e2 ("asn1tostruct: fix defines getting redefined")
Change-Id: I3a19b8a1147532b41d3ed7b802de595302ff8f44
2022-11-16 10:27:52 +01:00
Oliver Smith bee7ce3f6f contrib/jenkins.sh: use --enable-werror
Change-Id: Idf0ecd012071b5786773643fc71cc44ec070aa05
2022-11-15 11:16:40 +01:00
Oliver Smith 1d19c8e21e asn1tostruct: fix defines getting redefined
Do not write the same define twice for two files in a struct, e.g.:

  #define ENHANCEDRELOCATIONCOMPLETEREQUESTIES_RANAP_EXTENDEDRNC_ID_PRESENT                   (1 << 0)
  #define ENHANCEDRELOCATIONCOMPLETEREQUESTIES_RANAP_EXTENDEDRNC_ID_PRESENT                   (1 << 1)
  #define ENHANCEDRELOCATIONCOMPLETEREQUESTIES_RANAP_RAB_SETUPLIST_ENHANCEDRELOCCOMPLETEREQ_PRESENT (1 << 2)

  typedef struct RANAP_EnhancedRelocationCompleteRequestIEs_s {
      uint16_t                                 presenceMask;
      RANAP_IuSignallingConnectionIdentifier_t oldIuSigConId;
      RANAP_IuSignallingConnectionIdentifier_t iuSigConId;
      RANAP_GlobalRNC_ID_t                     relocation_SourceRNC_ID;
      RANAP_ExtendedRNC_ID_t                   relocation_SourceExtendedRNC_ID; ///< Optional field
      RANAP_GlobalRNC_ID_t                     relocation_TargetRNC_ID;
      RANAP_ExtendedRNC_ID_t                   relocation_TargetExtendedRNC_ID; ///< Optional field
      RANAP_RAB_SetupList_EnhancedRelocCompleteReq_t raB_SetupList_EnhancedRelocCompleteReq; ///< Optional field
  } RANAP_EnhancedRelocationCompleteRequestIEs_t;

The problem is that the type is used and it may not be unique inside a
struct. Change the code to use the name of the field if the type is not
unique. Keep using the type otherwise so existing code doesn't need to
be modified a lot to fix this.

Fix for:
../include/osmocom/ranap/ranap_ies_defs.h:514: warning: "RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_IUSIGNALLINGCONNECTIONIDENTIFIER_PRESENT" redefined

Change-Id: I2ecae6789899952d1dc5691ab76907abeaa71c12
2022-11-15 11:16:38 +01:00
Oliver Smith 8d3f18888b hnbap_common: hnbap_cause_str: handle nothing val
Fix for:
../../../src/osmo-iuh/src/hnbap_common.c:85:9: error: enumeration value ‘HNBAP_Cause_PR_NOTHING’ not handled in switch [-Werror=switch]

Change-Id: Icab3052e27d1951129e3809e61357ee23c4cb588
2022-11-15 11:16:22 +01:00
Oliver Smith 8073e5195c test-hnbap: fix defined but not used error
../../../../src/osmo-iuh/src/tests/test-hnbap.c:53:28: error: ‘hnbap_reg_acc’ defined but not used [-Werror=unused-const-variable=]
   53 | static const unsigned char hnbap_reg_acc[] = {
      |                            ^~~~~~~~~~~~~

Change-Id: I1fda405af9d4f1f43377ee0a81710e6e2668da13
2022-11-15 11:16:22 +01:00
Oliver Smith b3a8345189 tests/hnb-test-rua: fix incompat pointer type
Adjust the first argument of hnb_test_rua_dt_handle_ranap and
hnb_test_rua_cl_handle_ranap to be "void *priv", as it is private user
data.

Fix for:
../../../../src/osmo-iuh/src/tests/hnb-test-rua.c:19:29: error: passing argument 1 of ‘ranap_cn_rx_co’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   19 |         rc = ranap_cn_rx_co(hnb_test_rua_dt_handle_ranap, hnb, ies.ranaP_Message.buf, ies.ranaP_Message.size);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             void (*)(struct hnb_test *, struct ranap_message_s *)

Change-Id: Id930a7f0d3d05cfcc8ba9734dd922de885853c8c
2022-11-15 11:16:22 +01:00
Oliver Smith 05bb6ad563 ranap_common_cn: rename ctx -> priv
Rename the "ctx" argument of ranap_cn_rx_co and ranap_cn_rx_cl to "priv"
as it is private user data passed to the callback.

Change-Id: I929548e9224298be94f7d3ed4cdca0580147721d
2022-11-15 11:16:21 +01:00
Oliver Smith 8b6dad3331 ranap_common_cn: remove unused ctx args
ranap_cn_rx_co and ranap_cn_rx_cl both have a void *ctx argument, that
gets passed to:
* a callback function and
* to various decode functions in the same file.

As it is named "ctx", it looks like a talloc context. But the decode
functions don't use ctx at all and so in reality it is private userdata
for the callback. It is used as such by test/hnb-test-rua and in
osmo-msc.

Start cleaning this up by removing the unused ctx args, a future patch
will rename it to priv and yet another patch will fix a compiler warning
in test/hnb-test-rua by properly using it as userdata arg.

Change-Id: I8936197d7ae7ffddbe8ee99d909d74ac5b3ab227
2022-11-15 11:14:56 +01:00
Oliver Smith 3de4055839 tests/test-ranap: fix missing (void **) cast
Use the function like everywhere else in the code.

Fix for:
  tests/test-ranap.c:73:49: error: passing argument 3 of ‘aper_decode’ from incompatible pointer type [-Werror=incompati
ble-pointer-types]

Change-Id: I9d8a3ab70accc6a1401fe11a6d2ceef96d3b8c22
2022-11-14 09:52:31 +01:00
Oliver Smith 535ada7cff tests/test-hnbap: add missing include
Fix for:
  test-hnbap.c:174:9: error: implicit declaration of function ‘ranap_set_log_area’

Change-Id: I57fe460b511bccd14e0d0d110104511292963525
2022-11-14 09:52:31 +01:00
Oliver Smith 0b19040eb0 tests/hnb-test-rua: add missing include
Fix for:
  error: implicit declaration of function ‘ranap_cn_rx_co’ [-Werror=implicit-function-declaration]

Change-Id: I3dbadb63058edc990b49ec803a123292e5eea10f
2022-11-14 09:52:31 +01:00
Oliver Smith 48c038d399 asn1: fix visibility warnings from generated code
Fix warnings from generated asn1 code in order to build osmo-iuh with
werror in a future patch:

../../include/osmocom/hnbap/HNBAP_CriticalityDiagnostics-IE-List.h:29:23: error: ‘struct HNBAP_CriticalityDiagnostics_IE_List__Member’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]

These visibility warnings come from "SEQUENCE … OF SEQUENCE" definitions
in the asn1 source files, as described in detail here:
https://github.com/vlm/asn1c/issues/430

It is not possible to tell gcc to just ignore these warnings since they
don't have their own type (unlike e.g. -Wuninitialized). Also it seems
like a huge effort to patch this in asn1c.

So work around the problem the same way the author of the issue worked
around it by rewriting the lines to "SEQUENCE … OF …-Value" and adding
a "…-Value ::= SEQUENCE" line below. Add a script in
asn1/utils/asn1_restructure_sequence_of_sequence.py for the
transformation and apply it.

Related: OS#4462
Change-Id: If84445ed2e0df604b581684dcf83f8520b7da84c
2022-11-14 09:52:14 +01:00
Oliver Smith 0c04a7e03f move-asn1-header-files: error for wrong asn1c
Add a helpful error message if the user doesn't have the expected asn1c
version installed. Link to a new wiki page that explains which branch
one needs to build.

Without this patch, it just complains that HNBAP_Criticality.h can't be
moved.

Change-Id: I11980bf868055bccc05c5338ea330b70022cd874
2022-11-11 17:40:13 +01:00
Vadim Yanitskiy a9c380afae libosmo-{hnbap,ranap,rua,sabp}: add -no-undefined to *_la_LDFLAGS
Make sure that there is no undefined references in shared libraries.

Change-Id: I659d277049173e8fc86934140d552f6a494971a1
2022-08-04 05:32:55 +07:00
Vadim Yanitskiy c62adff36b libosmo-rua: fix copy-pasted -version-info: {HNBAP->RUA}_LIBVERSION
Change-Id: I71b859d3c9ecfaf9bffa6341291267ddef071448
2022-08-04 05:31:41 +07:00
Pau Espin f5a5e01feb Bump version: 1.2.0.24-de3c-dirty → 1.3.0
Change-Id: I7da0cc95d7b1a7198f1ae5ad5a4c0174dfd7381d
2022-06-28 18:59:56 +02:00
Harald Welte de3c2e54f1 README.md: remove obsolete notice from 7 years ago
Change-Id: If6e08325ae9e7b681d1cbb4ea0e13e5eea0a251f
2022-06-18 14:01:45 +02:00
Harald Welte 23f9c3701d update git URLs (git -> https; gitea)
Change-Id: Ifc796c7d3f6ee5e4878618f2f236024d1caeb9d4
2022-06-18 14:01:45 +02:00
Neels Hofmeyr 3ae6e812f1 move new_transp_layer_addr to public API
osmo-hnbgw will use this function in
Ic9bc30f322c4c6c6e82462d1da50cb15b336c63a.

Related: SYS#5859
Change-Id: Icc61620b4d11c4ba6823b40abc7c300f0533c058
2022-06-10 14:15:20 +02:00
Pau Espin 753a48141e Make logging message about received RANAP message more meaningful
The message being used previously seemed to indicate something was
wrong with the message. The reality is that we are simply not handling
most of them, and they will end up being forwarded as they come in
osmo-hnbgw.

Related: SYS#5573
Change-Id: If63d942496491f1e9ee454034ec97d25764fde65
2022-06-08 14:36:10 +02:00
Philipp Maier c6e118af7a ranap_common: log decoder errors to LOGL_ERROR
Some of the custom ranap decoders use RANAP_DEBUG to log decoding
errors. This is a problem since decoder errors usually mean that a RANAP
message was somehow incompatible or wrongly formatted, which is a
serious problem. Lets log those messages to LOGL_ERROR instead.

Change-Id: Ic94cbba65719df7618c650a394e53cc59ab4e0b9
Related: OS#5152
2022-02-14 16:52:39 +01:00
Philipp Maier 55e573ca33 ranap_common: add decoder for RAB-ReleaseList
There is currently no decoder to decode RAB-ReleaseList objects properly.
Lets add one.

Change-Id: I4fc88402a863bc1482947985f759d3a26eea4164
Related: OS#5152
2022-02-14 16:44:20 +01:00
Philipp Maier 7755801cf5 ranap_common: add decoder for RAB-FailedList
There is currently no decoder to decode RAB-FailedList objects properly.
Lets add one.

Change-Id: I0f42487968f2a39f2425068c001950509a3bd28f
Related: OS#5152
2022-02-14 16:44:20 +01:00
Philipp Maier d97f94a7ea ranap_msg_factory: add missing apidoc
The functions ranap_new_msg_iu_rel_req and ranap_new_msg_rab_rel_req
lack apidoc strings.

Change-Id: I7484413980acdf17fde9ed0f97cf7f97e0ef3ae4
2022-02-10 10:47:25 +01:00
Philipp Maier 63a0cfe04e ranap_common_ran: add decoder for CN/MSC originated messages
Lets add a counterpart for ranap_common_cn that works the same, but
decodes CN/MSC originated messages.

Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98
Related: OS#5152
2022-01-31 17:40:49 +01:00
Philipp Maier ca6054ef8c ranap_common_cn: add functions for direct access to decoder
The message encoder functions that decode a message to a struct
ranap_message are only accessible via a callback function that is passed
to ranap_cn_rx_cx The decoded ranap_message only lives inside the callback
since it is freed by ranap_cn_rx_cx when the callback is done. In some
situations this might make using the decoder incredibly difficult since
it is not possible to keep the decoding results for an extended amount
of time. Lets put the decoding into a separate function and use this
function in ranap_cn_rx_cx. Then lets make the decoder and the free
function public so that the decoder can be used in a more open way.

Change-Id: I14d2ed8e597a5d12024a6a6c72ff011dbeb2549d
Related: OS#5152
2022-01-28 13:21:40 +01:00
Philipp Maier fb58a448b1 test-ranap: put message gen tests into function
This unit test generats a lot of ranap messages for test, but the code
for that is in the main() function. Lets seperate this test code into
its own function like we do it in all other unit tests.

Change-Id: I7021e48b051afb6f13fdd54843d4cd92a499de2a
2022-01-13 17:20:30 +00:00