diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-10-12 03:57:26 +0200 |
---|---|---|
committer | lynxis lazus <lynxis@fe80.eu> | 2020-10-12 14:15:50 +0000 |
commit | 8ebc1acbaa827a439c7e6724f5456075b9eeb5ea (patch) | |
tree | 9e3391ceead34af7259555c7e3b8582746993d4b /src | |
parent | 6cb5d5f2e03a70329ae60c405f46f993a1b520cf (diff) |
gprs_ns2: Partial revert 48f63867 allow to create NS_ALIVE NSVC
NS_ALIVE can't create new NS-VC. Those NS-VC can be only created
by SNS or by vty.
Also fixes a crash because the TLV parser tried to retrieve NSEI TLV
which doesn't exist on NS_ALIVE PDUs.
Related: OS#4792
Change-Id: I16b9d7b2eb7544a83ce871d894887c4b30605b34
Diffstat (limited to 'src')
-rw-r--r-- | src/gb/gprs_ns2.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c index 95736514..f65bea7a 100644 --- a/src/gb/gprs_ns2.c +++ b/src/gb/gprs_ns2.c @@ -681,16 +681,13 @@ enum gprs_ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind, return GPRS_NS2_CS_REJECTED; } } else { /* NS2_VC_MODE_ALIVE */ - /* Only the ALIVE procedure creates a new NSVC */ - if (nsh->pdu_type != NS_PDUT_ALIVE) { - rc = reject_status_msg(msg, &tp, reject, NS_CAUSE_PDU_INCOMP_PSTATE); + rc = reject_status_msg(msg, &tp, reject, NS_CAUSE_PDU_INCOMP_PSTATE); - if (rc < 0) { - LOGP(DLNS, LOGL_ERROR, "Failed to generate reject message (%d)\n", rc); - return rc; - } - return GPRS_NS2_CS_REJECTED; + if (rc < 0) { + LOGP(DLNS, LOGL_ERROR, "Failed to generate reject message (%d)\n", rc); + return rc; } + return GPRS_NS2_CS_REJECTED; } rc = ns2_tlv_parse(&tp, nsh->data, @@ -702,13 +699,11 @@ enum gprs_ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind, return GPRS_NS2_CS_REJECTED; } - if (bind->vc_mode == NS2_VC_MODE_BLOCKRESET) { - if (!TLVP_PRESENT(&tp, NS_IE_CAUSE) || - !TLVP_PRESENT(&tp, NS_IE_VCI) || !TLVP_PRESENT(&tp, NS_IE_NSEI)) { - LOGP(DLNS, LOGL_ERROR, "NS RESET Missing mandatory IE\n"); - rc = reject_status_msg(msg, &tp, reject, NS_CAUSE_MISSING_ESSENT_IE); - return GPRS_NS2_CS_REJECTED; - } + if (!TLVP_PRESENT(&tp, NS_IE_CAUSE) || + !TLVP_PRESENT(&tp, NS_IE_VCI) || !TLVP_PRESENT(&tp, NS_IE_NSEI)) { + LOGP(DLNS, LOGL_ERROR, "NS RESET Missing mandatory IE\n"); + rc = reject_status_msg(msg, &tp, reject, NS_CAUSE_MISSING_ESSENT_IE); + return GPRS_NS2_CS_REJECTED; } /* find or create NSE */ |