fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30581 )
Change subject: gsm0808: add logging for some IE encoding errors ......................................................................
gsm0808: add logging for some IE encoding errors
Change-Id: Idd9c490e7a2d37817004590629092c4bb6f2d758 Related: SYS#6229 --- M src/gsm/gsm0808.c 1 file changed, 50 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/30581/1
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index ec4c39b..3757c4e 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -21,6 +21,8 @@
#include <osmocom/core/byteswap.h> #include <osmocom/core/endian.h> +#include <osmocom/core/logging.h> + #include <osmocom/gsm/gsm0808.h> #include <osmocom/gsm/gsm0808_lcs.h> #include <osmocom/gsm/gsm0808_utils.h> @@ -101,8 +103,11 @@
/* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ if (scl) { - if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (BSS Supported) IE\n"); goto exit_free; + } }
/* push the bssmap header */ @@ -537,8 +542,11 @@
/* AoIP: Codec List (MSC Preferred) 3.2.2.103 */ if (scl) { - if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (MSC Preferred) IE\n"); goto exit_free; + } }
/* AoIP: Call Identifier 3.2.2.105 */ @@ -629,14 +637,20 @@
/* AoIP: Speech Codec (Chosen) 3.2.2.104 */ if (sc) { - if (gsm0808_enc_speech_codec2(msg, sc) < 0) + if (gsm0808_enc_speech_codec2(msg, sc) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Speech Codec (Chosen) IE\n"); goto exit_free; + } }
/* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ if (scl) { - if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (BSS Supported) IE\n"); goto exit_free; + } }
/* FIXME: write LSA identifier 3.2.2.15 - see 3GPP TS 43.073 */ @@ -714,8 +728,11 @@
/* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ if (scl) { - if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) + if (gsm0808_enc_speech_codec_list2(msg, scl) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (BSS Supported) IE\n"); goto exit_free; + } }
/* update the size */ @@ -1019,8 +1036,11 @@ gsm0808_enc_aoip_trasp_addr(msg, params->aoip_transport_layer);
if (params->codec_list_msc_preferred) { - if (gsm0808_enc_speech_codec_list2(msg, params->codec_list_msc_preferred) < 0) + if (gsm0808_enc_speech_codec_list2(msg, params->codec_list_msc_preferred) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (MSC Preferred) IE\n"); goto exit_free; + } }
if (params->call_id_present) { @@ -1081,14 +1101,20 @@ * (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) { - if (gsm0808_enc_speech_codec_list2(msg, ¶ms->codec_list_bss_supported) < 0) + if (gsm0808_enc_speech_codec_list2(msg, ¶ms->codec_list_bss_supported) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (BSS Supported) IE\n"); goto exit_free; + } }
/* AoIP: Speech Codec (Chosen) 3.2.2.104 */ if (params->speech_codec_chosen_present) { - if (gsm0808_enc_speech_codec2(msg, ¶ms->speech_codec_chosen) < 0) + if (gsm0808_enc_speech_codec2(msg, ¶ms->speech_codec_chosen) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Speech Codec (Chosen) IE\n"); goto exit_free; + } }
/* prepend header with final length */ @@ -1205,14 +1231,20 @@
/* AoIP: Speech Codec (Chosen) 3.2.2.104 */ if (params->speech_codec_chosen_present) { - if (gsm0808_enc_speech_codec2(msg, ¶ms->speech_codec_chosen) < 0) + if (gsm0808_enc_speech_codec2(msg, ¶ms->speech_codec_chosen) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Speech Codec (Chosen) IE\n"); goto exit_free; + } }
/* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ if (params->codec_list_bss_supported.len) { - if (gsm0808_enc_speech_codec_list2(msg, ¶ms->codec_list_bss_supported) < 0) + if (gsm0808_enc_speech_codec_list2(msg, ¶ms->codec_list_bss_supported) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (BSS Supported) IE\n"); goto exit_free; + } }
/* Chosen Encryption Algorithm 3.2.2.44 */ @@ -1255,8 +1287,11 @@
/* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ if (params->codec_list_bss_supported.len) { - if (gsm0808_enc_speech_codec_list2(msg, ¶ms->codec_list_bss_supported) < 0) + if (gsm0808_enc_speech_codec_list2(msg, ¶ms->codec_list_bss_supported) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Codec List (BSS Supported) IE\n"); goto exit_free; + } }
/* prepend header with final length */ @@ -1303,8 +1338,11 @@
/* AoIP: Speech Codec (chosen) 3.2.2.104 */ if (params->speech_codec_chosen_present) { - if (gsm0808_enc_speech_codec2(msg, ¶ms->speech_codec_chosen) < 0) + if (gsm0808_enc_speech_codec2(msg, ¶ms->speech_codec_chosen) < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, + "Failed to encode Speech Codec (Chosen) IE\n"); goto exit_free; + } }
/* LCLS-BSS-Status 3.2.2.119 */