This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18694 ) Change subject: gsm0808: fix endieness of call identifier ...................................................................... gsm0808: fix endieness of call identifier The call identifier in the ASSIGNMENT COMMAND is encoded in the wrong endieness. 3GPP TS 48.008, section 3.2.2.105 specifies that the least significant byte should be transmitted first, which means that the endieness here is little endian. Lets make sure that the endieness is correctly transmitted, regardless of the host byte order. Change-Id: I6468e502f552f99ab54aec9d4b1c169fdc0adfb8 Related: OS#4582 --- M src/gsm/gsm0808.c M tests/gsm0808/gsm0808_test.c 2 files changed, 14 insertions(+), 4 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 23468c3..9fdf379 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -24,6 +24,7 @@ #include <string.h> #include <osmocom/core/byteswap.h> +#include <osmocom/core/endian.h> #include <osmocom/gsm/gsm0808.h> #include <osmocom/gsm/gsm0808_utils.h> #include <osmocom/gsm/protocol/gsm_08_08.h> @@ -515,7 +516,16 @@ /* AoIP: Call Identifier 3.2.2.105 */ if (ci) { - ci_sw = osmo_htonl(*ci); + /* NOTE: 3GPP TS 48.008, section 3.2.2.105 specifies that + the least significant byte should be transmitted first. + On x86, this would mean that the endieness is already + correct, however a platform independed implementation + is required: */ +#ifndef OSMO_IS_LITTLE_ENDIAN + ci_sw = osmo_swab32(*ci); +#else + ci_sw = *ci; +#endif msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, sizeof(ci_sw), (uint8_t *) & ci_sw); } diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index d9640aa..5c1a931 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -438,8 +438,8 @@ 0x04, GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17, 0x04, 0xd2, GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50, 0xef, 0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f, - GSM0808_SCT_CSD | 0x90, 0xc0, GSM0808_IE_CALL_ID, 0xaa, 0xbb, - 0xcc, 0xdd }; + GSM0808_SCT_CSD | 0x90, 0xc0, GSM0808_IE_CALL_ID, 0xdd, 0xcc, + 0xbb, 0xaa }; struct msgb *msg; struct gsm0808_channel_type ct; @@ -499,7 +499,7 @@ GSM0808_SCT_CSD | 0x90, 0xc0, GSM0808_IE_CALL_ID, - 0xde, 0xad, 0xfa, 0xce, /* CallID */ + 0xce, 0xfa, 0xad, 0xde, /* CallID */ 0x83, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, /* Kc */ GSM0808_IE_GLOBAL_CALL_REF, 0x0d, /* GCR, length */ 0x03, 0x44, 0x44, 0x44, /* GCR, Net ID */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18694 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I6468e502f552f99ab54aec9d4b1c169fdc0adfb8 Gerrit-Change-Number: 18694 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200609/61cba96d/attachment.htm>