pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/26788 )
Change subject: amr: Fix length check in osmo_amr_bwe_to_iuup
......................................................................
amr: Fix length check in osmo_amr_bwe_to_iuup
The check was wrong for format types containing extra bits not aligned
to byte boundaries, such as FT7 (AMR Code 12.20, 244 bits, 31 bytes).
if the source has 1-6 extra bits, they can be fit with one less byte
when shifting 10 bits to the left.
Change-Id: I0552d727585886d25f613e64ca815fb6dcd53f25
---
M src/amr.c
1 file changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/88/26788/1
diff --git a/src/amr.c b/src/amr.c
index 2df6967..ed92f30 100644
--- a/src/amr.c
+++ b/src/amr.c
@@ -228,8 +228,8 @@
int osmo_amr_bwe_to_iuup(uint8_t *payload, unsigned int payload_len)
{
/* The header is only valid after shifting first two bytes to OA mode */
- unsigned int i;
- unsigned int amr_speech_len;
+ unsigned int i, required_len;
+ unsigned int amr_speech_len_bytes, amr_speech_len_bits;
uint8_t ft;
if (payload_len < 2)
@@ -240,16 +240,19 @@
if (!osmo_amr_ft_valid(ft))
return -1;
- amr_speech_len = osmo_amr_bytes(ft);
- if (payload_len < amr_speech_len + 2)
+ amr_speech_len_bits = osmo_amr_bits(ft);
+ amr_speech_len_bytes = osmo_amr_bytes(ft);
+
+ required_len = amr_speech_len_bits + 10; /* shift of 10 bits */
+ if (payload_len < (required_len + 7)/8)
return -1;
- for (i = 0; i < amr_speech_len; i++) {
+ for (i = 0; i < amr_speech_len_bytes; i++) {
/* we have to shift the payload by 10 bits to get only the Class A, B, C bits */
payload[i] = (payload[i + 1] << 2) | ((payload[i + 2]) >> 6);
}
- return amr_speech_len;
+ return amr_speech_len_bytes;
}
/*! Convert an AMR frame from IuuP/IuFP payload to bandwith-efficient mode.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/26788
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I0552d727585886d25f613e64ca815fb6dcd53f25
Gerrit-Change-Number: 26788
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26781 )
Change subject: tests/dummy_cn_sua.c: Drop no longer existing include
......................................................................
tests/dummy_cn_sua.c: Drop no longer existing include
This one was unspotted during last patches dropping hnbgw since this
file is actually not compiled currently.
Change-Id: I94ed20c42bcc9619d80757c6ff4a661c360bfb4f
---
M src/tests/dummy_cn_sua.c
1 file changed, 0 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/81/26781/1
diff --git a/src/tests/dummy_cn_sua.c b/src/tests/dummy_cn_sua.c
index 6e14562..cf71608 100644
--- a/src/tests/dummy_cn_sua.c
+++ b/src/tests/dummy_cn_sua.c
@@ -24,7 +24,6 @@
#include <osmocom/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_common_cn.h>
#include <osmocom/ranap/ranap_msg_factory.h>
-#include <osmocom/iuh/hnbgw.h>
const char *cmdline_bind_addr = "127.0.0.1";
--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26781
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I94ed20c42bcc9619d80757c6ff4a661c360bfb4f
Gerrit-Change-Number: 26781
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26722 )
Change subject: iu_helpers: make new_transp_info_(rtp|gtp) public
......................................................................
Patch Set 1:
(1 comment)
https://gerrit.osmocom.org/c/osmo-iuh/+/26722/1/include/osmocom/ranap/iu_he…
File include/osmocom/ranap/iu_helpers.h:
https://gerrit.osmocom.org/c/osmo-iuh/+/26722/1/include/osmocom/ranap/iu_he…
PS1, Line 16: RANAP_TransportLayerInformation_t *new_transp_info_rtp(uint32_t ip, uint16_t port, bool use_x213_nsap);
> Thanks for the input, yes we seem to support IPv4 at the moment. I think changing this makes sense. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26722
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I1e369718de8c4c7db1f1af1e6864562164ada6cf
Gerrit-Change-Number: 26722
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 05 Jan 2022 14:35:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: comment