Several messages shall not be answered when a RESET hasn't been
received on a NS-VC:
- NS_RESET_ACK (see 3GPP TS 08.16, 7.3.1)
- NS_ALIVE_ACK (see 3GPP TS 08.16, 7.4.1)
- NS_STATUS (see 3GPP TS 08.16, 7.5.1)
Sponsored-by: On-Waves ehf
---
tests/gb/gprs_ns_test.c | 28 ++++++++++++++++++++++++++++
tests/gb/gprs_ns_test.ok | 27 +++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c
index c88792c..c90d752 100644
--- a/tests/gb/gprs_ns_test.c
+++ b/tests/gb/gprs_ns_test.c
@@ -486,6 +486,33 @@ static void test_nsvc()
alarm(0);
}
+static void test_ignored_messages()
+{
+ struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
+ struct sockaddr_in peer[1] = {{0},};
+
+ peer[0].sin_family = AF_INET;
+ peer[0].sin_port = htons(1111);
+ peer[0].sin_addr.s_addr = htonl(REMOTE_BSS_ADDR);
+
+ printf("--- Send unexpected NS STATUS (should not be answered)---\n\n");
+ /* Do not respond, see 3GPP TS 08.16, 7.5.1 */
+ gprs_process_message(nsi, "STATUS", &peer[0],
+ gprs_ns_status_invalid_alive,
+ sizeof(gprs_ns_status_invalid_alive));
+
+ printf("--- Send unexpected NS ALIVE ACK (should not be answered)---\n\n");
+ /* Ignore this, see 3GPP TS 08.16, 7.4.1 */
+ send_ns_alive_ack(nsi, &peer[0]);
+
+ printf("--- Send unexpected NS RESET ACK (should not be answered)---\n\n");
+ /* Ignore this, see 3GPP TS 08.16, 7.3.1 */
+ send_ns_reset_ack(nsi, &peer[0], 0xe001, 0xe000);
+
+ gprs_ns_destroy(nsi);
+ nsi = NULL;
+}
+
static void test_bss_port_changes()
{
struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
@@ -832,6 +859,7 @@ int main(int argc, char **argv)
printf("===== NS protocol test START\n");
test_nsvc();
+ test_ignored_messages();
test_bss_port_changes();
test_bss_reset_ack();
test_sgsn_reset();
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 8a61450..23c9e5f 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -85,6 +85,33 @@ Current NS-VCIs:
--- Process timers ---
+--- Send unexpected NS STATUS (should not be answered)---
+
+PROCESSING STATUS from 0x01020304:1111
+08 00 81 0a 02 81 0a
+
+result (STATUS) = 0
+
+--- Send unexpected NS ALIVE ACK (should not be answered)---
+
+PROCESSING ALIVE_ACK from 0x01020304:1111
+0b
+
+MESSAGE to BSS, msg length 7
+08 00 81 0a 02 81 0b
+
+result (ALIVE_ACK) = 0
+
+--- Send unexpected NS RESET ACK (should not be answered)---
+
+PROCESSING RESET_ACK from 0x01020304:1111
+03 01 82 e0 01 04 82 e0 00
+
+MESSAGE to BSS, msg length 15
+08 00 81 0a 02 89 03 01 82 e0 01 04 82 e0 00
+
+result (RESET_ACK) = 0
+
--- Setup, send BSSGP RESET ---
Setup NS-VC: remote 0x01020304:1111, NSVCI 0x1122(4386), NSEI 0x1122(4386)
--
1.7.9.5
Show replies by thread
Currently those messages are answered by a NS_STATUS message when
received on an uninitialised (no NS_RESET hat been seen yet) NS_VC
which violates GPP TS 08.16 7.3.1 and 7.4.1.
This patch adds checks to gprs_ns_vc_create() and eventually returns
before the error NS_STATUS message is generated.
Sponsored-by: On-Waves ehf
---
src/gb/gprs_ns.c | 17 +++++++++++++++++
tests/gb/gprs_ns_test.ok | 6 ------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 0e9156a..55535ad 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1127,12 +1127,29 @@ int gprs_ns_vc_create(struct gprs_ns_inst *nsi, struct msgb *msg,
int rc;
if (nsh->pdu_type == NS_PDUT_STATUS) {
+ /* Do not respond, see 3GPP TS 08.16, 7.5.1 */
LOGP(DNS, LOGL_INFO, "Ignoring NS STATUS from %s "
"for non-existing NS-VC\n",
gprs_ns_ll_str(fallback_nsvc));
return GPRS_NS_CS_SKIPPED;
}
+ if (nsh->pdu_type == NS_PDUT_ALIVE_ACK) {
+ /* Ignore this, see 3GPP TS 08.16, 7.4.1 */
+ LOGP(DNS, LOGL_INFO, "Ignoring NS ALIVE ACK from %s "
+ "for non-existing NS-VC\n",
+ gprs_ns_ll_str(fallback_nsvc));
+ return GPRS_NS_CS_SKIPPED;
+ }
+
+ if (nsh->pdu_type == NS_PDUT_RESET_ACK) {
+ /* Ignore this, see 3GPP TS 08.16, 7.3.1 */
+ LOGP(DNS, LOGL_INFO, "Ignoring NS RESET ACK from %s "
+ "for non-existing NS-VC\n",
+ gprs_ns_ll_str(fallback_nsvc));
+ return GPRS_NS_CS_SKIPPED;
+ }
+
/* Only the RESET procedure creates a new NSVC */
if (nsh->pdu_type != NS_PDUT_RESET) {
/* Since we have no NSVC, we have to use a fake */
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 23c9e5f..13d5f36 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -97,9 +97,6 @@ result (STATUS) = 0
PROCESSING ALIVE_ACK from 0x01020304:1111
0b
-MESSAGE to BSS, msg length 7
-08 00 81 0a 02 81 0b
-
result (ALIVE_ACK) = 0
--- Send unexpected NS RESET ACK (should not be answered)---
@@ -107,9 +104,6 @@ result (ALIVE_ACK) = 0
PROCESSING RESET_ACK from 0x01020304:1111
03 01 82 e0 01 04 82 e0 00
-MESSAGE to BSS, msg length 15
-08 00 81 0a 02 89 03 01 82 e0 01 04 82 e0 00
-
result (RESET_ACK) = 0
--- Setup, send BSSGP RESET ---
--
1.7.9.5