gsm48_cc_tx_call_proc_…: verify bcap.transfer

Fail if MNCC tries to switch the Information Transfer Capability from
CSD to speech, so it is obvious that something is wrong here. I ran into
this while writing a test.

Related: OS#4394
Change-Id: Ibb76d08cad1ac3bc3320391c89766150a2e605c3
This commit is contained in:
Oliver Smith 2023-08-23 14:26:23 +02:00
parent f3941518dc
commit 92caa1cd6d
1 changed files with 8 additions and 0 deletions

View File

@ -1047,6 +1047,14 @@ static int gsm48_cc_tx_call_proc_and_assign(struct gsm_trans *trans, void *arg)
/* bearer capability */
if (proceeding->fields & MNCC_F_BEARER_CAP) {
/* MNCC should not switch from e.g. CSD to speech */
if (proceeding->bearer_cap.transfer != trans->bearer_cap.transfer) {
LOG_TRANS(trans, LOGL_ERROR, "Unexpected Information Transfer Capability %d from MNCC,"
" transaction has %d\n",
proceeding->bearer_cap.transfer,
trans->bearer_cap.transfer);
return -EINVAL;
}
gsm48_encode_bearer_cap(msg, 0, &proceeding->bearer_cap);
memcpy(&trans->bearer_cap, &proceeding->bearer_cap, sizeof(trans->bearer_cap));
}