neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/27307 )
Change subject: BSSAP: HO Request Ack: add missing Codec List (BSS Supported)
......................................................................
BSSAP: HO Request Ack: add missing Codec List (BSS Supported)
Change-Id: Iab0a7b4d81592157fc111d1adb9e9f4cb53a94e9
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
2 files changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/07/27307/1
diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index c79da6a..b4c7803 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -246,8 +246,12 @@
const struct sockaddr_storage *aoip_transport_layer;
+ bool more_items; /*!< set this to true iff any fields below are used */
+
+ struct gsm0808_speech_codec_list codec_list_bss_supported; /*< omit when .len == 0 */
+
/* more items are defined in the spec and may be added later */
- bool more_items; /*!< always set this to false */
+ bool more_items2; /*!< always set this to false */
};
struct msgb *gsm0808_create_handover_request_ack2(const struct gsm0808_handover_request_ack *params);
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 4f9c687..7013d8d 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -1045,6 +1045,12 @@
if (params->aoip_transport_layer)
gsm0808_enc_aoip_trasp_addr(msg, params->aoip_transport_layer);
+ /* AoIP: add Codec List (BSS Supported) 3.2.2.103.
+ * (codec_list_bss_supported was added to struct gsm0808_handover_request_ack later than speech_codec_chosen
+ * below, but it needs to come before it in the message coding). */
+ if (params->more_items && params->codec_list_bss_supported.len)
+ gsm0808_enc_speech_codec_list(msg, ¶ms->codec_list_bss_supported);
+
/* AoIP: Speech Codec (Chosen) 3.2.2.104 */
if (params->speech_codec_chosen_present)
gsm0808_enc_speech_codec(msg, ¶ms->speech_codec_chosen);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/27307
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iab0a7b4d81592157fc111d1adb9e9f4cb53a94e9
Gerrit-Change-Number: 27307
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199 )
Change subject: ranap_rab_ass: add function to check if RAB is in ReleaseList
......................................................................
ranap_rab_ass: add function to check if RAB is in ReleaseList
A RANAP RAB-AssignmentRelease may contain a ReleaseList. In order to
detect that a RAB is about to be released we need to be able to check if
the RAB we are dealing with is contained in such a ReleaseList.
Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Related: OS#5152
---
M include/osmocom/hnbgw/ranap_rab_ass.h
M src/osmo-hnbgw/ranap_rab_ass.c
M tests/ranap_rab_ass/ranap_rab_ass_test.c
M tests/ranap_rab_ass/ranap_rab_ass_test.ok
4 files changed, 103 insertions(+), 0 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
dexter: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/hnbgw/ranap_rab_ass.h b/include/osmocom/hnbgw/ranap_rab_ass.h
index b3406f0..eb18de8 100644
--- a/include/osmocom/hnbgw/ranap_rab_ass.h
+++ b/include/osmocom/hnbgw/ranap_rab_ass.h
@@ -15,4 +15,5 @@
int ranap_rab_ass_resp_ies_replace_inet_addr(RANAP_RAB_AssignmentResponseIEs_t *ies, struct osmo_sockaddr *addr,
uint8_t rab_id);
+bool ranap_rab_ass_req_ies_check_release(RANAP_RAB_AssignmentRequestIEs_t *ies, uint8_t rab_id);
bool ranap_rab_ass_resp_ies_check_failure(RANAP_RAB_AssignmentResponseIEs_t *ies, uint8_t rab_id);
diff --git a/src/osmo-hnbgw/ranap_rab_ass.c b/src/osmo-hnbgw/ranap_rab_ass.c
index 030a1af..56886c7 100644
--- a/src/osmo-hnbgw/ranap_rab_ass.c
+++ b/src/osmo-hnbgw/ranap_rab_ass.c
@@ -135,6 +135,23 @@
return protocol_ie_field_pair;
}
+/* Pick the indexed item from the RAB release-list list and return a pointer to it */
+static RANAP_IE_t *release_item_from_ass_req_ies(const RANAP_RAB_AssignmentRequestIEs_t *ies, unsigned int index)
+{
+ /* Make sure we indeed deal with a setup-or-modify list */
+ if (!(ies->presenceMask & RAB_ASSIGNMENTREQUESTIES_RANAP_RAB_RELEASELIST_PRESENT)) {
+ RANAP_DEBUG
+ ("Decoding failed, the RANAP RAB AssignmentRequest did not contain a release list!\n");
+ return NULL;
+ }
+
+ /* Detect the end of the list */
+ if (index >= ies->raB_ReleaseList.raB_ReleaseList_ies.list.count)
+ return NULL;
+
+ return ies->raB_ReleaseList.raB_ReleaseList_ies.list.array[index];
+}
+
/* Pick the indexed item from the RAB setup-or-modified list and return a pointer to it */
static RANAP_IE_t *setup_or_modif_item_from_rab_ass_resp(const RANAP_RAB_AssignmentResponseIEs_t *ies,
unsigned int index)
@@ -261,6 +278,41 @@
}
}
+static int decode_rab_relitms_from_req_ies(RANAP_RAB_ReleaseItemIEs_t *items_ies,
+ RANAP_RAB_AssignmentRequestIEs_t *ies, uint8_t rab_id)
+{
+ RANAP_IE_t *release_list_ie;
+ RANAP_RAB_ReleaseItem_t *rab_release_item;
+ int rc;
+ uint8_t rab_id_decoded;
+ unsigned int index = 0;
+
+ while (1) {
+ release_list_ie = release_item_from_ass_req_ies(ies, index);
+ if (!release_list_ie)
+ return -EINVAL;
+
+ if (release_list_ie->id != RANAP_ProtocolIE_ID_id_RAB_ReleaseItem) {
+ RANAP_DEBUG("Decoding failed, the protocol IE is not of type RANAP RAB ReleaseItem!\n");
+ return -EINVAL;
+ }
+
+ rc = ranap_decode_rab_releaseitemies_fromlist(items_ies, &release_list_ie->value);
+ if (rc < 0)
+ return -EINVAL;
+
+ rab_release_item = &items_ies->raB_ReleaseItem;
+ /* The RAB-ID is defined as a bitstring with a size of 8 (1 byte),
+ * See also RANAP-IEs.asn, RAB-ID ::= BIT STRING (SIZE (8)) */
+ rab_id_decoded = rab_release_item->rAB_ID.buf[0];
+ if (rab_id_decoded == rab_id)
+ return index;
+
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_ReleaseItem, items_ies);
+ index++;
+ }
+}
+
/*! Extract IP address and port from RANAP_RAB_AssignmentRequestIEs.
* \ptmap[out] addr user provided memory to store extracted RTP stream IP-Address and port number.
* \ptmap[out] rab_id pointer to store RAB-ID (optional, can be NULL).
@@ -546,3 +598,25 @@
return result;
}
+
+/*! Check if a specific RAB is present in an RAB-ReleaseList inside RANAP_RAB_AssignmentRequestIEs.
+ * \ptmap[in] ies user provided memory with RANAP_RAB_AssignmentRequestIEs.
+ * \ptmap[in] rab_id expected rab id to look for.
+ * \returns true when RAB is intended for release; false otherwise */
+bool ranap_rab_ass_req_ies_check_release(RANAP_RAB_AssignmentRequestIEs_t *ies, uint8_t rab_id)
+{
+ RANAP_RAB_ReleaseItemIEs_t _rab_release_items_ies;
+ RANAP_RAB_ReleaseItemIEs_t *rab_release_items_ies = &_rab_release_items_ies;
+ int rc;
+ bool result = true;
+
+ /* If we can get a rlease list item for the specified RAB ID, then we know that the
+ * MSC intends to release the specified RAB */
+ rc = decode_rab_relitms_from_req_ies(rab_release_items_ies, ies, rab_id);
+ if (rc < 0)
+ result = false;
+
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_ReleaseItem, rab_release_items_ies);
+
+ return result;
+}
diff --git a/tests/ranap_rab_ass/ranap_rab_ass_test.c b/tests/ranap_rab_ass/ranap_rab_ass_test.c
index 5bb4efc..f7664e9 100644
--- a/tests/ranap_rab_ass/ranap_rab_ass_test.c
+++ b/tests/ranap_rab_ass/ranap_rab_ass_test.c
@@ -295,6 +295,31 @@
ranap_cn_rx_co_free(&message);
}
+void test_ranap_rab_ass_req_ies_check_release(void)
+{
+ int rc;
+ ranap_message message;
+ bool rab_release_req;
+ uint8_t testvec[] = {
+ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x01, 0x00,
+ 0x29, 0x40, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x28,
+ 0x40, 0x03, 0x05, 0xd0, 0x00
+ };
+
+ rc = ranap_ran_rx_co_decode(talloc_asn1_ctx, &message, testvec, sizeof(testvec));
+ OSMO_ASSERT(rc == 0);
+
+ rab_release_req =
+ ranap_rab_ass_req_ies_check_release(&message.msg.raB_AssignmentRequestIEs, 23);
+ printf("ranap_rab_ass_req_ies_check_release rab_release_req=%u (RAB ID 23)\n", rab_release_req);
+
+ rab_release_req =
+ ranap_rab_ass_req_ies_check_release(&message.msg.raB_AssignmentRequestIEs, 44);
+ printf("ranap_rab_ass_req_ies_check_release rab_release_req=%u (RAB ID 44, which is not in the message)\n", rab_release_req);
+
+ ranap_ran_rx_co_free(&message);
+}
+
static const struct log_info_cat log_cat[] = {
[DRANAP] = {
.name = "RANAP", .loglevel = LOGL_DEBUG, .enabled = 1,
@@ -356,6 +381,7 @@
test_ranap_rab_ass_req_replace_inet_addr();
test_ranap_rab_ass_resp_replace_inet_addr();
test_ranap_rab_ass_resp_ies_check_failure();
+ test_ranap_rab_ass_req_ies_check_release();
test_cleanup();
return 0;
diff --git a/tests/ranap_rab_ass/ranap_rab_ass_test.ok b/tests/ranap_rab_ass/ranap_rab_ass_test.ok
index d372550..688925c 100644
--- a/tests/ranap_rab_ass/ranap_rab_ass_test.ok
+++ b/tests/ranap_rab_ass/ranap_rab_ass_test.ok
@@ -16,3 +16,5 @@
after: addr=1.2.3.4, port=1234
ranap_rab_ass_resp_ies_check_failure rab_failed_at_hnb=1 (RAB ID 23)
ranap_rab_ass_resp_ies_check_failure rab_failed_at_hnb=0 (RAB ID 44, which is not in the message)
+ranap_rab_ass_req_ies_check_release rab_release_req=1 (RAB ID 23)
+ranap_rab_ass_req_ies_check_release rab_release_req=0 (RAB ID 44, which is not in the message)
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Gerrit-Change-Number: 27199
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: fixeria.
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199 )
Change subject: ranap_rab_ass: add function to check if RAB is in ReleaseList
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Gerrit-Change-Number: 27199
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Feb 2022 14:56:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria, dexter.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199 )
Change subject: ranap_rab_ass: add function to check if RAB is in ReleaseList
......................................................................
Patch Set 4: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Gerrit-Change-Number: 27199
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Feb 2022 14:53:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: pespin, fixeria.
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199 )
Change subject: ranap_rab_ass: add function to check if RAB is in ReleaseList
......................................................................
Patch Set 4:
(1 comment)
File tests/ranap_rab_ass/ranap_rab_ass_test.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199/comment/89e1d373_448e077b
PS3, Line 305: ranap_rab_ass_req_ies_check_release(&message.msg.raB_AssignmentRequestIEs, 23);
> Same as previous patch. Add a test with a different ID not found.
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Gerrit-Change-Number: 27199
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 23 Feb 2022 14:52:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin, fixeria.
Hello Jenkins Builder, laforge, pespin, fixeria, daniel,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199
to look at the new patch set (#4).
Change subject: ranap_rab_ass: add function to check if RAB is in ReleaseList
......................................................................
ranap_rab_ass: add function to check if RAB is in ReleaseList
A RANAP RAB-AssignmentRelease may contain a ReleaseList. In order to
detect that a RAB is about to be released we need to be able to check if
the RAB we are dealing with is contained in such a ReleaseList.
Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Related: OS#5152
---
M include/osmocom/hnbgw/ranap_rab_ass.h
M src/osmo-hnbgw/ranap_rab_ass.c
M tests/ranap_rab_ass/ranap_rab_ass_test.c
M tests/ranap_rab_ass/ranap_rab_ass_test.ok
4 files changed, 103 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/99/27199/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/27199
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I5b67cc2d35d11de7a09e66c181a1fdd5a58c75bb
Gerrit-Change-Number: 27199
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset
dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/27139 )
Change subject: ranap_rab_ass: add function to check if RAB is in FailureList
......................................................................
ranap_rab_ass: add function to check if RAB is in FailureList
A RANAP RAB-AssignmentResponse may contain a FailedList. In order to
detect that a RAB Assignment failed at the HNB we need to be able to
check if the RAB we are dealing with is contained an such a FailedList.
Change-Id: I4319f7caa45ea758ccd792cc8570521df075cf45
Related: OS#5152
---
M include/osmocom/hnbgw/ranap_rab_ass.h
M src/osmo-hnbgw/ranap_rab_ass.c
M tests/ranap_rab_ass/ranap_rab_ass_test.c
M tests/ranap_rab_ass/ranap_rab_ass_test.ok
4 files changed, 102 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
dexter: Looks good to me, approved
diff --git a/include/osmocom/hnbgw/ranap_rab_ass.h b/include/osmocom/hnbgw/ranap_rab_ass.h
index f4d5cb6..b3406f0 100644
--- a/include/osmocom/hnbgw/ranap_rab_ass.h
+++ b/include/osmocom/hnbgw/ranap_rab_ass.h
@@ -14,3 +14,5 @@
uint8_t rab_id);
int ranap_rab_ass_resp_ies_replace_inet_addr(RANAP_RAB_AssignmentResponseIEs_t *ies, struct osmo_sockaddr *addr,
uint8_t rab_id);
+
+bool ranap_rab_ass_resp_ies_check_failure(RANAP_RAB_AssignmentResponseIEs_t *ies, uint8_t rab_id);
diff --git a/src/osmo-hnbgw/ranap_rab_ass.c b/src/osmo-hnbgw/ranap_rab_ass.c
index 5edbd3d..030a1af 100644
--- a/src/osmo-hnbgw/ranap_rab_ass.c
+++ b/src/osmo-hnbgw/ranap_rab_ass.c
@@ -141,8 +141,7 @@
{
/* Make sure we indeed deal with a setup-or-modified list */
if (!(ies->presenceMask & RAB_ASSIGNMENTRESPONSEIES_RANAP_RAB_SETUPORMODIFIEDLIST_PRESENT)) {
- RANAP_DEBUG
- ("Decoding failed, the RANAP RAB AssignmentResponse did not contain a setup-or-modified list!\n");
+ RANAP_DEBUG("RANAP RAB AssignmentResponse did not contain a setup-or-modified list!\n");
return NULL;
}
@@ -153,6 +152,23 @@
return ies->raB_SetupOrModifiedList.raB_SetupOrModifiedList_ies.list.array[index];
}
+/* Pick the indexed item from the RAB failed list and return a pointer to it */
+static RANAP_IE_t *failed_list_item_from_rab_ass_resp(const RANAP_RAB_AssignmentResponseIEs_t *ies,
+ unsigned int index)
+{
+ /* Make sure we indeed deal with a failed list */
+ if (!(ies->presenceMask & RAB_ASSIGNMENTRESPONSEIES_RANAP_RAB_FAILEDLIST_PRESENT)) {
+ RANAP_DEBUG("RANAP RAB AssignmentResponse did not contain a failed list!\n");
+ return NULL;
+ }
+
+ /* Detect the end of the list */
+ if (index >= ies->raB_FailedList.raB_FailedList_ies.list.count)
+ return NULL;
+
+ return ies->raB_FailedList.raB_FailedList_ies.list.array[index];
+}
+
/* find the RAB specified by rab_id in ies and when found, decode the result into items_ies */
static int decode_rab_smditms_from_resp_ies(RANAP_RAB_SetupOrModifiedItemIEs_t *items_ies,
RANAP_RAB_AssignmentResponseIEs_t *ies, uint8_t rab_id)
@@ -184,6 +200,37 @@
}
}
+/* See comment above decode_rab_smditms_from_resp_ies() */
+static int decode_rab_flitms_from_resp_ies(RANAP_RAB_FailedItemIEs_t *items_ies,
+ RANAP_RAB_AssignmentResponseIEs_t *ies, uint8_t rab_id)
+{
+ RANAP_IE_t *failed_list_ie;
+ RANAP_RAB_FailedItem_t *rab_failed_item;
+ int rc;
+ uint8_t rab_id_decoded;
+ unsigned int index = 0;
+
+ while (1) {
+ failed_list_ie = failed_list_item_from_rab_ass_resp(ies, index);
+ if (!failed_list_ie)
+ return -EINVAL;
+
+ rc = ranap_decode_rab_faileditemies_fromlist(items_ies, &failed_list_ie->value);
+ if (rc < 0)
+ return -EINVAL;
+
+ rab_failed_item = &items_ies->raB_FailedItem;
+ /* The RAB-ID is defined as a bitstring with a size of 8 (1 byte),
+ * See also RANAP-IEs.asn, RAB-ID ::= BIT STRING (SIZE (8)) */
+ rab_id_decoded = rab_failed_item->rAB_ID.buf[0];
+ if (rab_id_decoded == rab_id)
+ return index;
+
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_FailedItem, items_ies);
+ index++;
+ }
+}
+
/* find the RAB specified by rab_id in ies and when found, decode the result into item */
static int decode_rab_smditms_from_req_ies(RANAP_RAB_SetupOrModifyItemFirst_t *item,
RANAP_RAB_AssignmentRequestIEs_t *ies, uint8_t rab_id)
@@ -477,3 +524,25 @@
return rc;
}
+
+/*! Check if a specific RAB is present in an RAB-Failed-Item-List inside RANAP_RAB_AssignmentResponseIEs.
+ * \ptmap[in] ies user provided memory with RANAP_RAB_AssignmentResponseIEs.
+ * \ptmap[in] rab_id expected rab id to look for.
+ * \returns true when RAB could be identified as failed; false otherwise */
+bool ranap_rab_ass_resp_ies_check_failure(RANAP_RAB_AssignmentResponseIEs_t *ies, uint8_t rab_id)
+{
+ RANAP_RAB_FailedItemIEs_t _rab_failed_items_ies;
+ RANAP_RAB_FailedItemIEs_t *rab_failed_items_ies = &_rab_failed_items_ies;
+ int rc;
+ bool result = true;
+
+ /* If we can get a failed item for the specified RAB ID, then we know that the
+ * HNB reported the RAB Assignment as failed */
+ rc = decode_rab_flitms_from_resp_ies(rab_failed_items_ies, ies, rab_id);
+ if (rc < 0)
+ result = false;
+
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_RAB_FailedItem, rab_failed_items_ies);
+
+ return result;
+}
diff --git a/tests/ranap_rab_ass/ranap_rab_ass_test.c b/tests/ranap_rab_ass/ranap_rab_ass_test.c
index d7bee09..5bb4efc 100644
--- a/tests/ranap_rab_ass/ranap_rab_ass_test.c
+++ b/tests/ranap_rab_ass/ranap_rab_ass_test.c
@@ -269,6 +269,32 @@
ranap_cn_rx_co_free(&message);
}
+void test_ranap_rab_ass_resp_ies_check_failure(void)
+{
+ int rc;
+ ranap_message message;
+ bool rab_failed_at_hnb;
+ uint8_t testvec[] = {
+ 0x60, 0x00, 0x00, 0x11, 0x00, 0x00, 0x01, 0x00,
+ 0x23, 0x40, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x22,
+ 0x40, 0x03, 0x05, 0xd0, 0x00
+ };
+
+ rc = ranap_cn_rx_co_decode(talloc_asn1_ctx, &message, testvec, sizeof(testvec));
+ OSMO_ASSERT(rc == 0);
+
+ rab_failed_at_hnb =
+ ranap_rab_ass_resp_ies_check_failure(&message.msg.raB_AssignmentResponseIEs, 23);
+ printf("ranap_rab_ass_resp_ies_check_failure rab_failed_at_hnb=%u (RAB ID 23)\n", rab_failed_at_hnb);
+
+ rab_failed_at_hnb =
+ ranap_rab_ass_resp_ies_check_failure(&message.msg.raB_AssignmentResponseIEs, 44);
+ printf("ranap_rab_ass_resp_ies_check_failure rab_failed_at_hnb=%u (RAB ID 44, which is not in the message)\n",
+ rab_failed_at_hnb);
+
+ ranap_cn_rx_co_free(&message);
+}
+
static const struct log_info_cat log_cat[] = {
[DRANAP] = {
.name = "RANAP", .loglevel = LOGL_DEBUG, .enabled = 1,
@@ -329,6 +355,7 @@
test_ranap_rab_ass_resp_extract_inet_addr();
test_ranap_rab_ass_req_replace_inet_addr();
test_ranap_rab_ass_resp_replace_inet_addr();
+ test_ranap_rab_ass_resp_ies_check_failure();
test_cleanup();
return 0;
diff --git a/tests/ranap_rab_ass/ranap_rab_ass_test.ok b/tests/ranap_rab_ass/ranap_rab_ass_test.ok
index 97756cb..d372550 100644
--- a/tests/ranap_rab_ass/ranap_rab_ass_test.ok
+++ b/tests/ranap_rab_ass/ranap_rab_ass_test.ok
@@ -14,3 +14,5 @@
before: addr=10.9.1.164, port=1034
ranap_rab_ass_resp_replace_inet_addr rc=0
after: addr=1.2.3.4, port=1234
+ranap_rab_ass_resp_ies_check_failure rab_failed_at_hnb=1 (RAB ID 23)
+ranap_rab_ass_resp_ies_check_failure rab_failed_at_hnb=0 (RAB ID 44, which is not in the message)
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/27139
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I4319f7caa45ea758ccd792cc8570521df075cf45
Gerrit-Change-Number: 27139
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged