aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-09-12 02:19:19 +0200
committerAlexander Couzens <lynxis@fe80.eu>2020-09-15 13:55:24 +0200
commit48f63867170ed1294b31afaeeb6145b94597e573 (patch)
treea61b8e8b288c9a304b19985906eed6b8ac4bfebe /src/gb
parent6a161497cfd8cacfef10c2e81cff85a45447e107 (diff)
libgb/ns: allow to create NS_ALIVE NSVC
Diffstat (limited to 'src/gb')
-rw-r--r--src/gb/gprs_ns2.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index bae94386..0fa71975 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -625,15 +625,28 @@ enum gprs_ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
return GPRS_NS2_CS_SKIPPED;
}
- /* Only the RESET procedure creates a new NSVC */
- if (nsh->pdu_type != NS_PDUT_RESET) {
- 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;
+ if (bind->vc_mode == NS2_VC_MODE_BLOCKRESET) {
+ /* Only the RESET procedure creates a new NSVC */
+ if (nsh->pdu_type != NS_PDUT_RESET) {
+ 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;
+ }
+ } 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);
+
+ if (rc < 0) {
+ LOGP(DLNS, LOGL_ERROR, "Failed to generate reject message (%d)\n", rc);
+ return rc;
+ }
+ return GPRS_NS2_CS_REJECTED;
}
- return GPRS_NS2_CS_REJECTED;
}
rc = ns2_tlv_parse(&tp, nsh->data,
@@ -645,11 +658,13 @@ enum gprs_ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
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;
+ 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;
+ }
}
/* find or create NSE */