lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

December 2022

  • 1 participants
  • 1979 discussions
Change in libosmocore[master]: gsm0808: remove over-defensive assert()s for function parameters
by laforge 13 Dec '22

13 Dec '22
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30579 ) Change subject: gsm0808: remove over-defensive assert()s for function parameters ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30579 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0 Gerrit-Change-Number: 30579 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 13 Dec 2022 20:56:03 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gsm0808: remove redundant assert() in enc_speech_codec()
by laforge 13 Dec '22

13 Dec '22
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30578 ) Change subject: gsm0808: remove redundant assert() in enc_speech_codec() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30578 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iafb45ed66378f2c9c2480f81371e92c6d1da71a7 Gerrit-Change-Number: 30578 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 13 Dec 2022 20:55:28 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gsm0808: remove unneeded assignment in enc_speech_codec()
by laforge 13 Dec '22

13 Dec '22
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30577 ) Change subject: gsm0808: remove unneeded assignment in enc_speech_codec() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30577 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ifc6d109e27cdada0d08d2a8fc1c354f3de04f15c Gerrit-Change-Number: 30577 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 13 Dec 2022 20:55:09 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gsm0808: cosmetic: switch is not a function
by laforge 13 Dec '22

13 Dec '22
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30576 ) Change subject: gsm0808: cosmetic: switch is not a function ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30576 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1 Gerrit-Change-Number: 30576 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 13 Dec 2022 20:54:54 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gsm0808: add gsm0808_enc_speech_codec[_list]2()
by fixeria 13 Dec '22

13 Dec '22
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30574 ) Change subject: gsm0808: add gsm0808_enc_speech_codec[_list]2() ...................................................................... Patch Set 2: (11 comments) This change is ready for review. File include/osmocom/gsm/gsm0808_utils.h: https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/5d80956b_12346afc PS1, Line 114: ; > doesn't the DEPRECATED go before the comma? Ack https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/5e14294d_810d6406 PS1, Line 115: OSMO_DEPRECATED("use gsm0808_enc_speech_codec2() instead") > add […] It's the first time I see such a suggestion/requirement. Usually we don't explain why something is deprecated in the compiler warnings. One can always do git-blame and see why the new API should be used. Also, IMO this is the kind of API that should have not been made public... None of the Osmocom projects are using it directly, so I would keep this as-is if you don't insist. https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/77f06de8_cd7aedb1 PS1, Line 122: OSMO_DEPRECATED("use gsm0808_enc_speech_codec_list2() instead"); > same See above. File src/gsm/gsm0808_utils.c: https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/f271ce71_c6ea4ad5 PS1, Line 267: OSMO_ASSERT(sc->type < 0x0f); > to confirm this, this assert can be dropped because the switch() above does not leave any sc->type > […] Ack, but I believe it's better doing this change separately: https://gerrit.osmocom.org/q/Iafb45ed66378f2c9c2480f81371e92c6d1da71a7 https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/8155a96c_52d8d1ab PS1, Line 216: Helper > (I detest comments saying "helper function" SCNR) Not directly related to the changes I am making, so marking as resolved. https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/0a51598e_1cc32974 PS1, Line 224: = fals > (we could also drop this init) https://gerrit.osmocom.org/q/Ifc6d109e27cdada0d08d2a8fc1c354f3de04f15c https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/1bd63c61_c073f26d PS1, Line 299: \a > (using "\a" is wrong) This is not directly related to this patch, but could you explain why? https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/c548d10b_90dfdf0f PS1, Line 308: return -EINVAL; > These asserts would be fine, or can even be dropped without substitute. […] https://gerrit.osmocom.org/q/If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0 https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/cf83275d_305dfb56 PS1, Line 315: return rc; I thought about this too, but IMO trying to recover the given msgb would unnecessary complicate things here. And simply shifting the tail is not enough. This recovery behavior may be acceptable for decoding API, because there can be new values and/or IEs added by 3GPP in recent revisions. But for the encoding API I see no need to tolerate any errors. If we fail to encode any of the IEs correctly, does it make sense to keep going and send the resulting PDU without a problematic IE? IMO, it does not. The usual approach for functions using this API would be simply free()ing the msgb and returning NULL. And as I said, this API should have been not made public at all... > Actually actually, why do we even return the nr of bytes added at all, amount of data is tracked in the msgb anyway. How does it look in the rest of the gsm0808 API, can we just return 0 for success, negative on error? The rest of the gsm0808 API does not even check values returned by these functions, only the unit tests do. I will introduce some checks in the upcoming patch. https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/7a40d056_575fc6bf PS1, Line 439: return rc; > here the tiresome aspect, what if rc == 0. it will never happen, but still is an error. […] Ah, indeed I need to convert rc from uint to int. Thanks for noticing this! https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/dbdadb9b_05bbe43d PS1, Line 446: return *tlv_len + 2; > same as above, only return 0 or negative? I am afraid we don't have time for even more API changes... -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30574 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I199ffa0ba4a64813238519178155dfc767aa3975 Gerrit-Change-Number: 30574 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Tue, 13 Dec 2022 20:30:49 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gsm0808: remove unneeded assignment in enc_speech_codec()
by fixeria 13 Dec '22

13 Dec '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30577 ) Change subject: gsm0808: remove unneeded assignment in enc_speech_codec() ...................................................................... gsm0808: remove unneeded assignment in enc_speech_codec() Change-Id: Ifc6d109e27cdada0d08d2a8fc1c354f3de04f15c --- M src/gsm/gsm0808_utils.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/30577/1 diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 80d469e..026a923 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -221,7 +221,7 @@ /* See also 3GPP TS 48.008 3.2.2.103 Speech Codec List */ uint8_t header = 0; uint8_t *old_tail; - bool type_extended = false; + bool type_extended; /* Note: Extended codec types are codec types that require 8 instead * of 4 bit to fully specify the selected codec. In the following, -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30577 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ifc6d109e27cdada0d08d2a8fc1c354f3de04f15c Gerrit-Change-Number: 30577 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: gsm0808: cosmetic: switch is not a function
by fixeria 13 Dec '22

13 Dec '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30576 ) Change subject: gsm0808: cosmetic: switch is not a function ...................................................................... gsm0808: cosmetic: switch is not a function Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1 --- M src/gsm/gsm0808_utils.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/30576/1 diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index f1569c9..80d469e 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -227,7 +227,7 @@ * of 4 bit to fully specify the selected codec. In the following, * we check if we work with an extended type or not. We also check * if the codec type is valid at all. */ - switch(sc->type) { + switch (sc->type) { case GSM0808_SCT_FR1: case GSM0808_SCT_FR2: case GSM0808_SCT_FR3: -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30576 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1 Gerrit-Change-Number: 30576 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: gsm0808: remove redundant assert() in enc_speech_codec()
by fixeria 13 Dec '22

13 Dec '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30578 ) Change subject: gsm0808: remove redundant assert() in enc_speech_codec() ...................................................................... gsm0808: remove redundant assert() in enc_speech_codec() This assert can be dropped because the switch statement above does not leave any sc->type >= 0x0f for type_extended == false. Change-Id: Iafb45ed66378f2c9c2480f81371e92c6d1da71a7 --- M src/gsm/gsm0808_utils.c 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/30578/1 diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 026a923..5b7fff2 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -264,7 +264,6 @@ msgb_put_u8(msg, header); msgb_put_u8(msg, sc->type); } else { - OSMO_ASSERT(sc->type < 0x0f); header |= sc->type; msgb_put_u8(msg, header); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30578 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iafb45ed66378f2c9c2480f81371e92c6d1da71a7 Gerrit-Change-Number: 30578 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: gsm0808: remove over-defensive assert()s for function parameters
by fixeria 13 Dec '22

13 Dec '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30579 ) Change subject: gsm0808: remove over-defensive assert()s for function parameters ...................................................................... gsm0808: remove over-defensive assert()s for function parameters I believe the gsm0808_* API is mature enough to avoid assert()ing pointers accepted via function parameters. We can assume the caller never passes NULL, as we do in almost all public API. Change-Id: If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0 --- M src/gsm/gsm0808_utils.c 1 file changed, 0 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/30579/1 diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 5b7fff2..a1f51eb 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -90,8 +90,6 @@ const uint8_t len_tl = 2; uint8_t len_v = sizeof(port); - OSMO_ASSERT(msg); - OSMO_ASSERT(ss); OSMO_ASSERT(ss->ss_family == AF_INET || ss->ss_family == AF_INET6); switch (ss->ss_family) { @@ -141,7 +139,6 @@ struct sockaddr_in6 sin6; const uint8_t *old_elem = elem; - OSMO_ASSERT(ss); if (!elem) return -EINVAL; if (len == 0) @@ -189,7 +186,6 @@ * \returns number of bytes parsed */ int gsm0808_dec_osmux_cid(uint8_t *cid, const uint8_t *elem, uint8_t len) { - OSMO_ASSERT(cid); if (!elem) return -EINVAL; if (len != 1) @@ -303,9 +299,6 @@ uint8_t *old_tail; uint8_t *tlv_len; - OSMO_ASSERT(msg); - OSMO_ASSERT(sc); - msgb_put_u8(msg, GSM0808_IE_SPEECH_CODEC); tlv_len = msgb_put(msg, 1); old_tail = msg->tail; @@ -328,7 +321,6 @@ uint8_t header; const uint8_t *old_elem = elem; - OSMO_ASSERT(sc); if (!elem) return -EINVAL; if (len == 0) @@ -411,9 +403,6 @@ uint8_t rc; unsigned int bytes_used = 0; - OSMO_ASSERT(msg); - OSMO_ASSERT(scl); - msgb_put_u8(msg, GSM0808_IE_SPEECH_CODEC_LIST); tlv_len = msgb_put(msg, 1); old_tail = msg->tail; @@ -443,7 +432,6 @@ int rc; uint8_t decoded = 0; - OSMO_ASSERT(scl); if (!elem) return -EINVAL; @@ -480,8 +468,6 @@ uint8_t *old_tail; uint8_t *tlv_len; - OSMO_ASSERT(msg); - OSMO_ASSERT(ct); OSMO_ASSERT(ct->perm_spch_len <= CHANNEL_TYPE_ELEMENT_MAXLEN - 2); /* FIXME: Implement encoding support for Data @@ -522,7 +508,6 @@ uint8_t byte; const uint8_t *old_elem = elem; - OSMO_ASSERT(ct); if (!elem) return -EINVAL; if (len < 3 || len > 11) @@ -711,8 +696,6 @@ uint8_t *old_tail; uint8_t *tlv_len; - OSMO_ASSERT(msg); - OSMO_ASSERT(ei); OSMO_ASSERT(ei->key_len <= ARRAY_SIZE(ei->key)); OSMO_ASSERT(ei->perm_algo_len <= ENCRY_INFO_PERM_ALGO_MAXLEN); @@ -751,7 +734,6 @@ unsigned int perm_algo_len = 0; const uint8_t *old_elem = elem; - OSMO_ASSERT(ei); if (!elem) return -EINVAL; if (len == 0) @@ -1011,9 +993,6 @@ unsigned int i; uint8_t id_discr; - OSMO_ASSERT(msg); - OSMO_ASSERT(cil); - msgb_put_u8(msg, GSM0808_IE_CELL_IDENTIFIER_LIST); tlv_len = msgb_put(msg, 1); old_tail = msg->tail; @@ -1055,9 +1034,6 @@ uint8_t *tlv_len; unsigned int i; - OSMO_ASSERT(msg); - OSMO_ASSERT(cil); - msgb_put_u8(msg, GSM0808_IE_CELL_IDENTIFIER_LIST); tlv_len = msgb_put(msg, 1); old_tail = msg->tail; @@ -1233,7 +1209,6 @@ size_t bytes_elem = 0; int list_len = 0; - OSMO_ASSERT(cil); if (!elem) return -EINVAL; if (len == 0) @@ -1301,7 +1276,6 @@ const uint8_t *old_elem = elem; unsigned int item_count = 0; - OSMO_ASSERT(cil); if (!elem) return -EINVAL; if (len == 0) @@ -1459,9 +1433,6 @@ .id_list_len = 1, }; - OSMO_ASSERT(msg); - OSMO_ASSERT(ci); - ie_tag = msg->tail; rc = gsm0808_enc_cell_id_list2(msg, &cil); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30579 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0 Gerrit-Change-Number: 30579 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: gsm0808: use new gsm0808_enc_speech_codec[_list]2() API
by fixeria 13 Dec '22

13 Dec '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30580 ) Change subject: gsm0808: use new gsm0808_enc_speech_codec[_list]2() API ...................................................................... gsm0808: use new gsm0808_enc_speech_codec[_list]2() API The motivation behind adding and using the new API is explained in the preceeding change [1]. Whenever any of the encoding functions fails to encode either a Speech Codec or a Codec List IE, free() the msgb and return NULL. Change-Id: I28219b61b9347f0652f9fd0c717f6cdf3c63e8f9 Related: [1] I199ffa0ba4a64813238519178155dfc767aa3975 Related: SYS#6229 --- M src/gsm/gsm0808.c M tests/gsm0808/gsm0808_test.c 2 files changed, 89 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/30580/1 diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 89a8874..ec4c39b 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -100,13 +100,19 @@ msgb_l3len(msg_l3), msg_l3->l3h); /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ - if (scl) - gsm0808_enc_speech_codec_list(msg, scl); + if (scl) { + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + goto exit_free; + } /* push the bssmap header */ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create "Complete L3 Info" for A, legacy implementation. @@ -530,8 +536,10 @@ } /* AoIP: Codec List (MSC Preferred) 3.2.2.103 */ - if (scl) - gsm0808_enc_speech_codec_list(msg, scl); + if (scl) { + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + goto exit_free; + } /* AoIP: Call Identifier 3.2.2.105 */ if (ci) { @@ -552,6 +560,10 @@ msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP Assignment Request message, 3GPP TS 48.008 §3.2.1.1. @@ -616,12 +628,16 @@ gsm0808_enc_aoip_trasp_addr(msg, ss); /* AoIP: Speech Codec (Chosen) 3.2.2.104 */ - if (sc) - gsm0808_enc_speech_codec(msg, sc); + if (sc) { + if (gsm0808_enc_speech_codec2(msg, sc) < 0) + goto exit_free; + } /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ - if (scl) - gsm0808_enc_speech_codec_list(msg, scl); + if (scl) { + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + goto exit_free; + } /* FIXME: write LSA identifier 3.2.2.15 - see 3GPP TS 43.073 */ @@ -632,6 +648,10 @@ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP Assignment Completed message @@ -693,13 +713,19 @@ /* Circuit pool list 3.2.2.46 */ /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ - if (scl) - gsm0808_enc_speech_codec_list(msg, scl); + if (scl) { + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + goto exit_free; + } /* update the size */ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP Assignment Failure message @@ -992,8 +1018,10 @@ if (params->aoip_transport_layer) gsm0808_enc_aoip_trasp_addr(msg, params->aoip_transport_layer); - if (params->codec_list_msc_preferred) - gsm0808_enc_speech_codec_list(msg, params->codec_list_msc_preferred); + if (params->codec_list_msc_preferred) { + if (gsm0808_enc_speech_codec_list2(msg, params->codec_list_msc_preferred) < 0) + goto exit_free; + } if (params->call_id_present) { uint8_t val[4]; @@ -1013,6 +1041,10 @@ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP HANDOVER REQUEST ACKNOWLEDGE message, 3GPP TS 48.008 3.2.1.10. @@ -1048,17 +1080,25 @@ /* 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, &params->codec_list_bss_supported); + if (params->more_items && params->codec_list_bss_supported.len) { + if (gsm0808_enc_speech_codec_list2(msg, &params->codec_list_bss_supported) < 0) + goto exit_free; + } /* AoIP: Speech Codec (Chosen) 3.2.2.104 */ - if (params->speech_codec_chosen_present) - gsm0808_enc_speech_codec(msg, &params->speech_codec_chosen); + if (params->speech_codec_chosen_present) { + if (gsm0808_enc_speech_codec2(msg, &params->speech_codec_chosen) < 0) + goto exit_free; + } /* prepend header with final length */ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Same as gsm0808_create_handover_request_ack2() but with less parameters. @@ -1164,12 +1204,16 @@ msgb_tlv_put(msg, GSM0808_IE_RR_CAUSE, 1, &params->rr_cause); /* AoIP: Speech Codec (Chosen) 3.2.2.104 */ - if (params->speech_codec_chosen_present) - gsm0808_enc_speech_codec(msg, &params->speech_codec_chosen); + if (params->speech_codec_chosen_present) { + if (gsm0808_enc_speech_codec2(msg, &params->speech_codec_chosen) < 0) + goto exit_free; + } /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ - if (params->codec_list_bss_supported.len) - gsm0808_enc_speech_codec_list(msg, &params->codec_list_bss_supported); + if (params->codec_list_bss_supported.len) { + if (gsm0808_enc_speech_codec_list2(msg, &params->codec_list_bss_supported) < 0) + goto exit_free; + } /* Chosen Encryption Algorithm 3.2.2.44 */ if (params->chosen_encr_alg_present && params->chosen_encr_alg > 0) @@ -1183,6 +1227,10 @@ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP HANDOVER FAILURE message, 3GPP TS 48.008 3.2.1.16. @@ -1206,13 +1254,19 @@ msgb_tlv_put(msg, GSM0808_IE_RR_CAUSE, 1, &params->rr_cause); /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ - if (params->codec_list_bss_supported.len) - gsm0808_enc_speech_codec_list(msg, &params->codec_list_bss_supported); + if (params->codec_list_bss_supported.len) { + if (gsm0808_enc_speech_codec_list2(msg, &params->codec_list_bss_supported) < 0) + goto exit_free; + } /* prepend header with final length */ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP HANDOVER PERFORMED message, 3GPP TS 48.008 3.2.1.25. @@ -1248,8 +1302,10 @@ msgb_tv_put(msg, GSM0808_IE_SPEECH_VERSION, params->speech_version_chosen); /* AoIP: Speech Codec (chosen) 3.2.2.104 */ - if (params->speech_codec_chosen_present) - gsm0808_enc_speech_codec(msg, &params->speech_codec_chosen); + if (params->speech_codec_chosen_present) { + if (gsm0808_enc_speech_codec2(msg, &params->speech_codec_chosen) < 0) + goto exit_free; + } /* LCLS-BSS-Status 3.2.2.119 */ if (params->lcls_bss_status_present) @@ -1259,6 +1315,10 @@ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; + +exit_free: + msgb_free(msg); + return NULL; } /*! Create BSSMAP COMMON ID message, 3GPP TS 48.008 3.2.1.68. diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 2734f91..ab9f29b 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -959,7 +959,7 @@ int rc_dec; msg = msgb_alloc(1024, "output buffer"); - rc_enc = gsm0808_enc_speech_codec(msg, &enc_sc); + rc_enc = gsm0808_enc_speech_codec2(msg, &enc_sc); OSMO_ASSERT(rc_enc == 3); rc_dec = gsm0808_dec_speech_codec(&dec_sc, msg->data + 2, msg->len - 2); @@ -985,7 +985,7 @@ int rc_dec; msg = msgb_alloc(1024, "output buffer"); - rc_enc = gsm0808_enc_speech_codec(msg, &enc_sc); + rc_enc = gsm0808_enc_speech_codec2(msg, &enc_sc); OSMO_ASSERT(rc_enc == 5); rc_dec = gsm0808_dec_speech_codec(&dec_sc, msg->data + 2, msg->len - 2); @@ -1010,7 +1010,7 @@ int rc_dec; msg = msgb_alloc(1024, "output buffer"); - rc_enc = gsm0808_enc_speech_codec(msg, &enc_sc); + rc_enc = gsm0808_enc_speech_codec2(msg, &enc_sc); OSMO_ASSERT(rc_enc == 5); rc_dec = gsm0808_dec_speech_codec(&dec_sc, msg->data + 2, msg->len - 2); @@ -1053,7 +1053,7 @@ int rc_dec; msg = msgb_alloc(1024, "output buffer"); - rc_enc = gsm0808_enc_speech_codec_list(msg, &enc_scl); + rc_enc = gsm0808_enc_speech_codec_list2(msg, &enc_scl); OSMO_ASSERT(rc_enc == 9); rc_dec = gsm0808_dec_speech_codec_list(&dec_scl, msg->data + 2, msg->len - 2); @@ -1075,7 +1075,7 @@ int rc_dec; msg = msgb_alloc(1024, "output buffer"); - rc_enc = gsm0808_enc_speech_codec_list(msg, &enc_scl); + rc_enc = gsm0808_enc_speech_codec_list2(msg, &enc_scl); OSMO_ASSERT(rc_enc == 2); rc_dec = gsm0808_dec_speech_codec_list(&dec_scl, msg->data + 2, msg->len - 2); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30580 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I28219b61b9347f0652f9fd0c717f6cdf3c63e8f9 Gerrit-Change-Number: 30580 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • ...
  • 198
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.