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

January 2022

  • 3 participants
  • 781 discussions
Change in libosmo-netif[master]: amr: Introduce APIs to convert BE to IuUP/IuFP format
by pespin 05 Jan '22

05 Jan '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/26717 ) Change subject: amr: Introduce APIs to convert BE to IuUP/IuFP format ...................................................................... amr: Introduce APIs to convert BE to IuUP/IuFP format These APIs allow for easy re-formatting of received AMR to forward between regular RTP and IuUP. Related: OS#1937 Change-Id: Id2bd32d5f2060abe581730996dc4251381bf7d4f --- M include/osmocom/netif/amr.h M src/amr.c M tests/amr/amr_test.c M tests/amr/amr_test.ok 4 files changed, 140 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified dexter: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/include/osmocom/netif/amr.h b/include/osmocom/netif/amr.h index 1a90af9..30e263c 100644 --- a/include/osmocom/netif/amr.h +++ b/include/osmocom/netif/amr.h @@ -115,5 +115,9 @@ int osmo_amr_oa_to_bwe(uint8_t *payload, unsigned int payload_len); int osmo_amr_bwe_to_oa(uint8_t *payload, unsigned int payload_len, unsigned int payload_maxlen); +int osmo_amr_bwe_to_iuup(uint8_t *payload, unsigned int payload_len); +int osmo_amr_iuup_to_bwe(uint8_t *payload, unsigned int payload_len, + unsigned int payload_maxlen); +int osmo_amr_bytes_to_ft(size_t bytes); #endif diff --git a/src/amr.c b/src/amr.c index 0cd1821..1cb2ccc 100644 --- a/src/amr.c +++ b/src/amr.c @@ -63,6 +63,17 @@ return amr_ft_to_bytes[amr_ft]; } +int osmo_amr_bytes_to_ft(size_t bytes) +{ + int ft; + + for (ft = 0; ft < AMR_FT_MAX; ft++) { + if (amr_ft_to_bytes[ft] == bytes) + return ft; + } + return -1; +} + int osmo_amr_ft_valid(uint8_t amr_ft) { /* @@ -207,3 +218,63 @@ memcpy(payload, buf, oa_payload_len); return oa_payload_len; } + +/*! Convert an AMR frame from bandwith-efficient mode to IuuP/IuFP payload. + * The IuuP/IuPF payload only contains the class a, b, c bits. No header. + * \param[inout] payload user provided memory containing the AMR payload. + * \param[in] payload_len overall length of the AMR payload. + * \param[in] payload_maxlen maximum length of the user provided memory. + * \returns resulting payload length, negative on error. */ +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; + uint8_t ft; + + if (payload_len < 2) + return -1; + + /* Calculate new payload length */ + ft = (payload[0] & 0xf0) >> 4; + if (!osmo_amr_ft_valid(ft)) + return -1; + + amr_speech_len = osmo_amr_bytes(ft); + if (payload_len < amr_speech_len + 2) + return -1; + + for (i = 0; i < amr_speech_len; 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; +} + +/*! Convert an AMR frame from IuuP/IuFP payload to bandwith-efficient mode. + * The IuuP/IuPF payload only contains the class a, b, c bits. No header. + * The resulting buffer has space at the start prepared to be filled by CMR, TOC. + * \param[inout] payload user provided memory containing the AMR payload. + * \param[in] payload_len overall length of the AMR payload. + * \param[in] payload_maxlen maximum length of the user provided memory (payload_len + 2 required). + * \returns resulting payload length, negative on error. */ +int osmo_amr_iuup_to_bwe(uint8_t *payload, unsigned int payload_len, + unsigned int payload_maxlen) +{ + /* shift all bits by 10 */ + int i; + + if (payload_maxlen < payload_len + 2) + return -1; + + i = payload_len + 1; + payload[i] = (payload[i - 2] << 6); + for (i = payload_len; i >= 2; 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); + } + payload[i] = (payload[i - 1] >> 2); + payload[0] = 0; + return payload_len + 2; +} diff --git a/tests/amr/amr_test.c b/tests/amr/amr_test.c index fabf948..fc579e9 100644 --- a/tests/amr/amr_test.c +++ b/tests/amr/amr_test.c @@ -63,6 +63,15 @@ "END", }; +/* Some IuUP payload containg AMR */ +char *iuup_amr_samples[] = { + "7a687b8b29ba02013d3cb863a5af4206869618fb5336d504968d7541663210", + "4482803977dc1880b56aab097728a6bbbb48a57e3affe41125838a5ce65fc0", + "2683c1d26e", + "END", +}; + + void dump_bits(uint8_t *buf, int len) { unsigned int i; @@ -185,6 +194,55 @@ } } +void osmo_amr_iuup_to_bwe_and_inverse_test(void) +{ + uint8_t buf[256]; + uint8_t buf_chk[256]; + unsigned int ft; + + unsigned int i = 0; + int len; + int rc; + + printf("\n\n"); + printf + ("Testing conversion from IuUP to bw-efficient and inverse:\n"); + + while (1) { + if (strcmp(iuup_amr_samples[i], "END") == 0) + return; + printf("Sample No.: %d...", i); + + len = osmo_hexparse(iuup_amr_samples[i], buf, sizeof(buf)); + OSMO_ASSERT(len > 0); + i++; + + ft = osmo_amr_bytes_to_ft(len); + if (ft < 0) { + printf(" skipping a sample with a wrong FT\n"); + continue; + } + printf(" AMR mode: %d, IuUP: %d bytes,", ft, len); + memcpy(buf_chk, buf, sizeof(buf)); + + rc = osmo_amr_iuup_to_bwe(buf, len, sizeof(buf)); + OSMO_ASSERT(rc > 0); + OSMO_ASSERT(rc == len + 2); + printf(" BE: %d bytes (%s),", rc, osmo_hexdump(buf, rc)); + + buf[0] = (ft << 4) & 0xf0; + rc = osmo_amr_bwe_to_iuup(buf, rc); + printf(" IuUP: %d bytes\n", rc); + OSMO_ASSERT(rc > 0); + OSMO_ASSERT(len == rc); + if (memcmp(buf, buf_chk, len) != 0) { + printf("Got: %s\n", osmo_hexdump(buf, len)); + printf("Expected:%s\n", osmo_hexdump(buf_chk, len)); + } + OSMO_ASSERT(memcmp(buf, buf_chk, len) == 0); + } +} + void osmo_amr_is_oa_test(void) { uint8_t buf[256]; @@ -239,6 +297,7 @@ osmo_amr_oa_to_bwe_test(); osmo_amr_bwe_to_oa_test(); osmo_amr_oa_to_bwe_and_inverse_test(); + osmo_amr_iuup_to_bwe_and_inverse_test(); osmo_amr_is_oa_test(); fprintf(stdout, "OK: Test passed\n"); diff --git a/tests/amr/amr_test.ok b/tests/amr/amr_test.ok index eea513b..7a762d9 100644 --- a/tests/amr/amr_test.ok +++ b/tests/amr/amr_test.ok @@ -234,6 +234,12 @@ Sample No.: 21... skipping a sample with a wrong FT +Testing conversion from IuUP to bw-efficient and inverse: +Sample No.: 0... AMR mode: 7, IuUP: 31 bytes, BE: 33 bytes (00 1e 9a 1e e2 ca 6e 80 80 4f 4f 2e 18 e9 6b d0 81 a1 a5 86 3e d4 cd b5 41 25 a3 5d 50 59 8c 84 00 ), IuUP: 31 bytes +Sample No.: 1... AMR mode: 7, IuUP: 31 bytes, BE: 33 bytes (00 11 20 a0 0e 5d f7 06 20 2d 5a aa c2 5d ca 29 ae ee d2 29 5f 8e bf f9 04 49 60 e2 97 39 97 f0 00 ), IuUP: 31 bytes +Sample No.: 2... AMR mode: 8, IuUP: 5 bytes, BE: 7 bytes (00 09 a0 f0 74 9b 80 ), IuUP: 5 bytes + + Testing detection of octet-aligned mode payloads: Sample No.: 0 ==>octet aligned Sample No.: 1 ==>octet aligned -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/26717 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Id2bd32d5f2060abe581730996dc4251381bf7d4f Gerrit-Change-Number: 26717 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-iuh[master]: Introduce dynamic log category for libosmo-rua/hnbap
by pespin 05 Jan '22

05 Jan '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26769 ) Change subject: Introduce dynamic log category for libosmo-rua/hnbap ...................................................................... Introduce dynamic log category for libosmo-rua/hnbap Same as already done for libosmo-ranap. This allows applications setting the cateogy dynamically, and will allow untangling library tests using hnbgw log categories in this repo. Change-Id: I5d09b67b115ad8938e5162a23accfcbafab139d4 --- M include/osmocom/hnbap/hnbap_common.h M include/osmocom/ranap/ranap_common.h M include/osmocom/rua/rua_common.h M src/hnbap_common.c M src/ranap_common_cn.c M src/rua_common.c M src/rua_msg_factory.c M src/tests/Makefile.am M src/tests/hnb-test.h M src/tests/test-helpers.c M src/tests/test-hnbap.c M src/tests/test-ranap.c M src/tests/test_common.c M src/tests/test_common.h 14 files changed, 49 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/69/26769/1 diff --git a/include/osmocom/hnbap/hnbap_common.h b/include/osmocom/hnbap/hnbap_common.h index 69a5383..af619e2 100644 --- a/include/osmocom/hnbap/hnbap_common.h +++ b/include/osmocom/hnbap/hnbap_common.h @@ -124,7 +124,8 @@ #include <osmocom/core/logging.h> -#define HNBAP_DEBUG(x, args ...) DEBUGP(1, x, ## args) +extern int _hnbap_DHNBAP; +#define HNBAP_DEBUG(x, args ...) DEBUGP(_hnbap_DHNBAP, x, ## args) extern int asn1_xer_print; @@ -149,3 +150,5 @@ asn_TYPE_descriptor_t *type, void *sptr); char *hnbap_cause_str(HNBAP_Cause_t *cause); + +void hnbap_set_log_area(int log_area); diff --git a/include/osmocom/ranap/ranap_common.h b/include/osmocom/ranap/ranap_common.h index 8899bd5..23359e1 100644 --- a/include/osmocom/ranap/ranap_common.h +++ b/include/osmocom/ranap/ranap_common.h @@ -593,8 +593,8 @@ struct gprs_ra_id; -#define RANAP_DEBUG(x, args ...) DEBUGP(_ranap_DRANAP, x, ## args) extern int _ranap_DRANAP; +#define RANAP_DEBUG(x, args ...) DEBUGP(_ranap_DRANAP, x, ## args) extern int asn1_xer_print; diff --git a/include/osmocom/rua/rua_common.h b/include/osmocom/rua/rua_common.h index 9b3a65c..7967c91 100644 --- a/include/osmocom/rua/rua_common.h +++ b/include/osmocom/rua/rua_common.h @@ -44,7 +44,8 @@ #include <osmocom/core/logging.h> -#define RUA_DEBUG(x, args ...) DEBUGP(0, x, ## args) +extern int _rua_DRUA; +#define RUA_DEBUG(x, args ...) DEBUGP(_rua_DRUA, x, ## args) extern int asn1_xer_print; @@ -69,3 +70,5 @@ asn_TYPE_descriptor_t *type, void *sptr); char *rua_cause_str(RUA_Cause_t *cause); + +void rua_set_log_area(int log_area); diff --git a/src/hnbap_common.c b/src/hnbap_common.c index ac42959..be7d570 100644 --- a/src/hnbap_common.c +++ b/src/hnbap_common.c @@ -24,7 +24,9 @@ #include <osmocom/core/msgb.h> #include <osmocom/hnbap/hnbap_common.h> -#include <osmocom/iuh/hnbgw.h> + +int _hnbap_DHNBAP = 0; +#define DHNBAP _hnbap_DHNBAP static const struct value_string hnbap_cause_radio_vals[] = { { HNBAP_CauseRadioNetwork_overload, "overload" }, @@ -242,3 +244,8 @@ return buff; } + +void hnbap_set_log_area(int log_area) +{ + _hnbap_DHNBAP = log_area; +} diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index d2c875e..03ce9ea 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -29,7 +29,7 @@ #include <osmocom/ranap/ranap_common_cn.h> #include <osmocom/ranap/ranap_ies_defs.h> -#include <osmocom/iuh/hnbgw.h> +#define DRANAP _ranap_DRANAP static int cn_ranap_rx_initiating_msg_co(void *ctx, RANAP_InitiatingMessage_t *imsg, ranap_message *message) diff --git a/src/rua_common.c b/src/rua_common.c index 77ac591..f21bf8f 100644 --- a/src/rua_common.c +++ b/src/rua_common.c @@ -24,10 +24,12 @@ #include <osmocom/core/msgb.h> #include <osmocom/rua/rua_common.h> -#include <osmocom/iuh/hnbgw.h> extern int asn1_xer_print; +int _rua_DRUA = 0; +#define DRUA _rua_DRUA + static const struct value_string rua_cause_radio_vals[] = { { RUA_CauseRadioNetwork_normal, "normal" }, { RUA_CauseRadioNetwork_connect_failed, "connect failed" }, @@ -224,3 +226,8 @@ return buff; } + +void rua_set_log_area(int log_area) +{ + _rua_DRUA = log_area; +} diff --git a/src/rua_msg_factory.c b/src/rua_msg_factory.c index 7a6bebd..e974793 100644 --- a/src/rua_msg_factory.c +++ b/src/rua_msg_factory.c @@ -5,8 +5,10 @@ #include <osmocom/rua/rua_ies_defs.h> #include <osmocom/rua/rua_msg_factory.h> #include "asn1helpers.h" -#include <osmocom/iuh/hnbgw.h> +#define DRUA _rua_DRUA + +#define IUH_PPI_RUA 19 struct msgb *rua_new_udt(struct msgb *inmsg) { @@ -31,7 +33,7 @@ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_ConnectionlessTransfer, &out); - DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); + DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); msgb_sctp_ppid(msg) = IUH_PPI_RUA; @@ -68,7 +70,7 @@ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Connect, &out); - DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); + DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); msgb_sctp_ppid(msg) = IUH_PPI_RUA; @@ -104,7 +106,7 @@ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_DirectTransfer, &out); - DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); + DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); msgb_sctp_ppid(msg) = IUH_PPI_RUA; @@ -146,7 +148,7 @@ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Disconnect, &out); - DEBUGP(DMAIN, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); + DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg)); msgb_sctp_ppid(msg) = IUH_PPI_RUA; diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 2063524..1fca2a4 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -14,7 +14,7 @@ test_helpers_SOURCES = test-helpers.c test_common.c test_helpers_LDADD = $(COMMON_LIBS) $(top_builddir)/src/libosmo-ranap.la -test_hnbap_SOURCES = $(top_srcdir)/src/hnbap_common.c $(top_builddir)/src/hnbap_decoder.c test-hnbap.c test_common.c +test_hnbap_SOURCES = test-hnbap.c test_common.c test_hnbap_LDADD = $(COMMON_LIBS) $(top_builddir)/src/libosmo-hnbap.la $(top_builddir)/src/libosmo-ranap.la hnb_test_SOURCES = hnb-test.c test_common.c hnb-test-ranap.c hnb-test-rua.c diff --git a/src/tests/hnb-test.h b/src/tests/hnb-test.h index 4af50a7..02efce0 100644 --- a/src/tests/hnb-test.h +++ b/src/tests/hnb-test.h @@ -7,10 +7,7 @@ #define DEBUG #include <osmocom/core/logging.h> -enum { - DMAIN, - DHNBAP, -}; +#include "test_common.h" /* 25.467 Section 7.1 */ diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c index cfe2140..5c617e5 100644 --- a/src/tests/test-helpers.c +++ b/src/tests/test-helpers.c @@ -209,6 +209,7 @@ asn1_xer_print = 0; test_common_init(); + ranap_set_log_area(DRANAP); test_iu_helpers(); test_asn1_helpers(); diff --git a/src/tests/test-hnbap.c b/src/tests/test-hnbap.c index 2343c2d..48cca2b 100644 --- a/src/tests/test-hnbap.c +++ b/src/tests/test-hnbap.c @@ -173,6 +173,8 @@ int rc; test_common_init(); + ranap_set_log_area(DRANAP); + hnbap_set_log_area(DHNBAP); log_set_log_level(osmo_stderr_target, LOGL_INFO); diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c index a6df186..b3ea4cb 100644 --- a/src/tests/test-ranap.c +++ b/src/tests/test-ranap.c @@ -32,8 +32,6 @@ #include "test_common.h" -#include <osmocom/iuh/hnbgw.h> - extern void *tall_msgb_ctx; static void test_aper_int(uint32_t inp) @@ -98,6 +96,7 @@ //asn_debug = 1; test_common_init(); + ranap_set_log_area(DRANAP); test_aper_int(1); test_aper_int(2); diff --git a/src/tests/test_common.c b/src/tests/test_common.c index bfe487f..899c73a 100644 --- a/src/tests/test_common.c +++ b/src/tests/test_common.c @@ -33,14 +33,14 @@ #include <netinet/sctp.h> #include <arpa/inet.h> +#include <asn1c/asn_internal.h> + #include <osmocom/core/application.h> #include <osmocom/core/talloc.h> #include <osmocom/core/logging.h> #include <osmocom/core/msgb.h> -#include <osmocom/ranap/ranap_common.h> - -#include <osmocom/iuh/hnbgw.h> +#include "test_common.h" static const struct log_info_cat log_cat[] = { [DMAIN] = { @@ -83,8 +83,6 @@ if (rc < 0) exit(1); - ranap_set_log_area(DRANAP); - log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); log_set_use_color(osmo_stderr_target, 0); log_set_print_category(osmo_stderr_target, 0); diff --git a/src/tests/test_common.h b/src/tests/test_common.h index 836d999..fdcac05 100644 --- a/src/tests/test_common.h +++ b/src/tests/test_common.h @@ -1,4 +1,11 @@ #pragma once +enum { + DMAIN, + DHNBAP, + DRUA, + DRANAP, +}; + int test_common_init(void); void test_common_cleanup(void); -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26769 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I5d09b67b115ad8938e5162a23accfcbafab139d4 Gerrit-Change-Number: 26769 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
3 4
0 0
Change in osmo-iuh[master]: tests/tests_common.c: Add missing header
by pespin 05 Jan '22

05 Jan '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26768 ) Change subject: tests/tests_common.c: Add missing header ...................................................................... tests/tests_common.c: Add missing header The header is probably indirectly added by osmocom/iuh/hnbgw.h, but once that's dropped, really weird stuff happens, like talloc crashing in talloc_total_blocks() because the compiled code incorrectly fills msgb_ctx variable in return of msgb_talloc_ctx_init. Change-Id: I7dab8d18d316632989406a9f22917e00a7fd68bf --- M src/tests/test_common.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/68/26768/1 diff --git a/src/tests/test_common.c b/src/tests/test_common.c index 9663157..bfe487f 100644 --- a/src/tests/test_common.c +++ b/src/tests/test_common.c @@ -36,6 +36,7 @@ #include <osmocom/core/application.h> #include <osmocom/core/talloc.h> #include <osmocom/core/logging.h> +#include <osmocom/core/msgb.h> #include <osmocom/ranap/ranap_common.h> -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26768 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I7dab8d18d316632989406a9f22917e00a7fd68bf Gerrit-Change-Number: 26768 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
3 4
0 0
Change in libosmocore[master]: conv: Fix the traceback for tail biting codes
by tnt 05 Jan '22

05 Jan '22
tnt has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26657 ) Change subject: conv: Fix the traceback for tail biting codes ...................................................................... Patch Set 3: Heh, I don't like the linter comments and it makes it inconsistent with the surrouding code :/ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26657 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I87e51d3880c0fe7bf3d6cd08fd46517a424a230c Gerrit-Change-Number: 26657 Gerrit-PatchSet: 3 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 05 Jan 2022 10:06:06 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: conv: Fix the traceback for tail biting codes
by laforge 05 Jan '22

05 Jan '22
laforge has uploaded a new patch set (#3) to the change originally created by tnt. ( https://gerrit.osmocom.org/c/libosmocore/+/26657 ) Change subject: conv: Fix the traceback for tail biting codes ...................................................................... conv: Fix the traceback for tail biting codes When picking the end state, looking only at the path metric is highly suboptimal because in a tail biting code, we _know_ that whatever treillis path is correct, it must start and end at the same state. So we only consider path meeting that condition. We know any path that doesn't isn't the right one. We only fallback to only path metric if no path met that condition. Fixes OS#4508 Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I87e51d3880c0fe7bf3d6cd08fd46517a424a230c --- M include/osmocom/core/conv.h M src/conv.c M src/conv_acc.c 3 files changed, 89 insertions(+), 22 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/26657/3 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26657 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I87e51d3880c0fe7bf3d6cd08fd46517a424a230c Gerrit-Change-Number: 26657 Gerrit-PatchSet: 3 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in libosmocore[master]: VTY: implement 'no log gsmtap [HOSTNAME]' command
by fixeria 05 Jan '22

05 Jan '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26708 ) Change subject: VTY: implement 'no log gsmtap [HOSTNAME]' command ...................................................................... VTY: implement 'no log gsmtap [HOSTNAME]' command Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4 --- M include/osmocom/core/gsmtap_util.h M src/gsmtap_util.c M src/logging.c M src/vty/logging_vty.c 4 files changed, 43 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/core/gsmtap_util.h b/include/osmocom/core/gsmtap_util.h index 1cc8d75..33ade95 100644 --- a/include/osmocom/core/gsmtap_util.h +++ b/include/osmocom/core/gsmtap_util.h @@ -44,6 +44,7 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port, int ofd_wq_mode); +void gsmtap_source_free(struct gsmtap_inst *gti); int gsmtap_source_add_sink(struct gsmtap_inst *gti); diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 671a6c3..2571b85 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -486,6 +486,22 @@ return gti; } +void gsmtap_source_free(struct gsmtap_inst *gti) +{ + if (gti->ofd_wq_mode) { + osmo_fd_unregister(&gti->wq.bfd); + osmo_wqueue_clear(&gti->wq); + + if (gti->sink_ofd.fd != -1) { + osmo_fd_unregister(&gti->sink_ofd); + close(gti->sink_ofd.fd); + } + } + + close(gti->wq.bfd.fd); + talloc_free(gti); +} + #endif /* HAVE_SYS_SOCKET_H */ const struct value_string gsmtap_gsm_channel_names[] = { diff --git a/src/logging.c b/src/logging.c index 24b5553..7f6dbb5 100644 --- a/src/logging.c +++ b/src/logging.c @@ -67,6 +67,7 @@ #include <osmocom/core/thread.h> #include <osmocom/core/select.h> #include <osmocom/core/write_queue.h> +#include <osmocom/core/gsmtap_util.h> #include <osmocom/vty/logging.h> /* for LOGGING_STR. */ @@ -1313,6 +1314,9 @@ talloc_free((void *)target->tgt_file.fname); target->tgt_file.fname = NULL; break; + case LOG_TGT_TYPE_GSMTAP: + gsmtap_source_free(target->tgt_gsmtap.gsmtap_inst); + break; #ifdef HAVE_SYSLOG_H case LOG_TGT_TYPE_SYSLOG: closelog(); diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index 4e5725b..c83dafd 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -830,6 +830,27 @@ RET_WITH_UNLOCK(CMD_SUCCESS); } +DEFUN(cfg_no_log_gsmtap, cfg_no_log_gsmtap_cmd, + "no log gsmtap [HOSTNAME]", + NO_STR LOG_STR "Logging via GSMTAP\n" + "Host name to send the GSMTAP logging to (UDP port 4729)\n") +{ + const char *hostname = argc ? argv[0] : "127.0.0.1"; + struct log_target *tgt; + + log_tgt_mutex_lock(); + tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); + if (tgt == NULL) { + vty_out(vty, "%% Unable to find GSMTAP log target for %s%s", + hostname, VTY_NEWLINE); + RET_WITH_UNLOCK(CMD_WARNING); + } + + log_target_destroy(tgt); + + RET_WITH_UNLOCK(CMD_SUCCESS); +} + DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, "log stderr [blocking-io]", LOG_STR "Logging via STDERR of the process\n" @@ -1245,4 +1266,5 @@ install_lib_element(CONFIG_NODE, &cfg_log_systemd_journal_cmd); install_lib_element(CONFIG_NODE, &cfg_no_log_systemd_journal_cmd); install_lib_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); + install_lib_element(CONFIG_NODE, &cfg_no_log_gsmtap_cmd); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26708 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4 Gerrit-Change-Number: 26708 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: VTY: implement 'no log gsmtap [HOSTNAME]' command
by laforge 05 Jan '22

05 Jan '22
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26708 ) Change subject: VTY: implement 'no log gsmtap [HOSTNAME]' command ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26708 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4 Gerrit-Change-Number: 26708 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 05 Jan 2022 09:49:51 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: logging: Fix Not enough tailroom msgb_put in _output_buf callers
by laforge 05 Jan '22

05 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26726 ) Change subject: logging: Fix Not enough tailroom msgb_put in _output_buf callers ...................................................................... logging: Fix Not enough tailroom msgb_put in _output_buf callers The function clearly specified in its documentation that the number of bytes written to the out buffer were being returned. However, the value returned was "the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available.", aka snprintf-style. The 2 callers of that function were not expecting it, so if a long enough buffer was passed, the program asserted. Closes: OS#5383 Change-Id: I8d71bd1a0dad37606acb8302b05c2ae338112e57 --- M src/logging.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/src/logging.c b/src/logging.c index e5c66f2..24b5553 100644 --- a/src/logging.c +++ b/src/logging.c @@ -601,7 +601,8 @@ OSMO_SNPRINTF_RET(ret, rem, offset, len); } err: - buf[buf_len-1] = '\0'; + len = OSMO_MIN(buf_len - 1, len); + buf[len] = '\0'; return len; } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26726 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I8d71bd1a0dad37606acb8302b05c2ae338112e57 Gerrit-Change-Number: 26726 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(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: lynxis lazus <lynxis(a)fe80.eu> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: logging: Fix Not enough tailroom msgb_put in _output_buf callers
by laforge 05 Jan '22

05 Jan '22
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26726 ) Change subject: logging: Fix Not enough tailroom msgb_put in _output_buf callers ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26726 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I8d71bd1a0dad37606acb8302b05c2ae338112e57 Gerrit-Change-Number: 26726 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(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: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Wed, 05 Jan 2022 09:49:33 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ttcn3-hacks[master]: RTP IuUP Emulation: Avoid spamming with retransmitted Init
by laforge 05 Jan '22

05 Jan '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26685 ) Change subject: RTP IuUP Emulation: Avoid spamming with retransmitted Init ...................................................................... RTP IuUP Emulation: Avoid spamming with retransmitted Init Until now, an Init was sent on each RTP transmit period, clogging the pcap files. Moreover, this is break by design, since transmitting another Init so close the the previous one would give no time to the transmitter to receive the Init ACk and move state, which means the other end would potentially be reconfigured each time (for each Init). Change-Id: I8e299a3fe49f9d31cae182f7ed4dc0ea3fc22ba2 --- M library/IuUP_Emulation.ttcn M library/RTP_Emulation.ttcn 2 files changed, 11 insertions(+), 2 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/IuUP_Emulation.ttcn b/library/IuUP_Emulation.ttcn index b35602c..19c2c84 100644 --- a/library/IuUP_Emulation.ttcn +++ b/library/IuUP_Emulation.ttcn @@ -105,6 +105,7 @@ } else if (match(pdu, tr_IuUP_INIT_ACK)) { if (st.cfg.active_init == true) { log("IuUP INIT_ACK Received"); + st.pending_tx_pdu := omit; /* Drop pending Init retrans */ st.state := ST_DATA_TRANSFER_READY; } else { setverdict(fail, "INIT_ACK received in PASSIVE role"); @@ -124,8 +125,12 @@ select (st.state) { case (ST_INIT) { if (st.cfg.active_init) { - /* send INIT */ - pdu := valueof(ts_IuUP_INIT('160051673C01270000820000001710000100'O)); + if (not isvalue(st.pending_tx_pdu)) { + /* send INIT */ + pdu := valueof(ts_IuUP_INIT('160051673C01270000820000001710000100'O)); + st.pending_tx_pdu := pdu; + } /* else: wait for INIT-ACK return ''O at the end */ + } else { /* wait for INIT */ if (isvalue(st.pending_tx_pdu)) { diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn index b2360dc..bdca75d 100644 --- a/library/RTP_Emulation.ttcn +++ b/library/RTP_Emulation.ttcn @@ -345,6 +345,10 @@ private function f_tx_rtp(octetstring payload, BIT1 marker := '0'B) runs on RTP_Emulation_CT { if (g_cfg.iuup_mode) { payload := f_IuUP_Em_tx_encap(g_iuup_ent, payload); + if (lengthof(payload) == 0) { + /* Nothing to transmit, waiting for INIT-ACK */ + return; + } } var PDU_RTP rtp := valueof(ts_RTP(g_cfg.tx_ssrc, g_cfg.tx_payload_type, g_tx_next_seq, g_tx_next_ts, payload, marker)); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26685 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I8e299a3fe49f9d31cae182f7ed4dc0ea3fc22ba2 Gerrit-Change-Number: 26685 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(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: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • ...
  • 79
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.