From b0c2f756653080a3b4d30f16bd7817f98a52e95c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 4 Apr 2022 19:37:19 +0200 Subject: [PATCH] jenkins: Validate gsm 08.58 IEs are added to tlv_definition It was recently found that several IEs which were added in the header file were not actually added to the tlv_definition, and hence the tlv parser failed to decode them. Let's make sure we don't foget to add new IEs in the future. Related: SYS#5915 Change-Id: Id8a679ca43eb0fcc4882780e9a95ec21c7f51972 --- contrib/jenkins_common.sh | 15 +++++++++++++++ include/osmocom/gsm/protocol/gsm_08_58.h | 4 ++-- src/gsm/rsl.c | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/contrib/jenkins_common.sh b/contrib/jenkins_common.sh index c39b3562f..82dd471a0 100644 --- a/contrib/jenkins_common.sh +++ b/contrib/jenkins_common.sh @@ -28,6 +28,21 @@ verify_gsm0808_tlv_definition() { } verify_gsm0808_tlv_definition +verify_gsm_08_05_tlv_definition() { + set +x; + enums=$(grep "RSL_IE_" include/osmocom/gsm/protocol/gsm_08_58.h | grep -e "=" -e ",$" | awk '{ print $1 }' | tr -d ',') + counted_enums=$(for f in $enums; do printf "%-60s %s\n" "$f" "$(grep -c "\[$f\]" src/gsm/rsl.c)"; done) + # TODO: Add RSL_IE_SIEMENS_* to the tlv struct definitions. + missing_enums=$(echo "$counted_enums" | grep -v RSL_IE_SIEMENS |grep "0$" || true) + if [ "x$missing_enums" != "x" ]; then + echo "Missing IEs in src/gsm/rsl.c!" + echo "$missing_enums" + exit 1 + fi + set -x; +} +verify_gsm_08_05_tlv_definition + prep_build() { _src_dir="$1" _build_dir="$2" diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h index 7a527ffa8..d1720faab 100644 --- a/include/osmocom/gsm/protocol/gsm_08_58.h +++ b/include/osmocom/gsm/protocol/gsm_08_58.h @@ -385,9 +385,9 @@ enum abis_rsl_ie { RSL_IE_IPAC_RTP_CSD_FMT = 0xf9, RSL_IE_IPAC_RTP_JIT_BUF = 0xfa, RSL_IE_IPAC_RTP_COMPR = 0xfb, - RSL_IE_IPAC_RTP_PAYLOAD2= 0xfc, + RSL_IE_IPAC_RTP_PAYLOAD2 = 0xfc, RSL_IE_IPAC_RTP_MPLEX = 0xfd, - RSL_IE_IPAC_RTP_MPLEX_ID= 0xfe, + RSL_IE_IPAC_RTP_MPLEX_ID = 0xfe, }; /* Ericsson specific IEs, clash with above partially, so they're not diff --git a/src/gsm/rsl.c b/src/gsm/rsl.c index dd5a116a1..0af366fd6 100644 --- a/src/gsm/rsl.c +++ b/src/gsm/rsl.c @@ -125,6 +125,7 @@ const struct tlv_definition rsl_att_tlvdef = { [RSL_IE_OSMO_REP_ACCH_CAP] = { TLV_TYPE_TLV }, [RSL_IE_OSMO_TRAINING_SEQUENCE] = { TLV_TYPE_TLV }, [RSL_IE_OSMO_TEMP_OVP_ACCH_CAP] = { TLV_TYPE_TLV }, + [RSL_IE_IPAC_SRTP_CONFIG] = { TLV_TYPE_TLV }, [RSL_IE_IPAC_PROXY_UDP] = { TLV_TYPE_FIXED, 2 }, [RSL_IE_IPAC_BSCMPL_TOUT] = { TLV_TYPE_TV }, [RSL_IE_IPAC_REMOTE_IP] = { TLV_TYPE_FIXED, 4 }, @@ -134,6 +135,7 @@ const struct tlv_definition rsl_att_tlvdef = { [RSL_IE_IPAC_SPEECH_MODE] = { TLV_TYPE_TV }, [RSL_IE_IPAC_LOCAL_IP] = { TLV_TYPE_FIXED, 4 }, [RSL_IE_IPAC_CONN_STAT] = { TLV_TYPE_TLV, 28 }, + [RSL_IE_IPAC_HO_C_PARMS] = { TLV_TYPE_TLV }, [RSL_IE_IPAC_CONN_ID] = { TLV_TYPE_FIXED, 2 }, [RSL_IE_IPAC_RTP_CSD_FMT] = { TLV_TYPE_TV }, [RSL_IE_IPAC_RTP_JIT_BUF] = { TLV_TYPE_FIXED, 2 },