From patchwork Wed Oct 8 10:05:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Erlbeck X-Patchwork-Id: 397589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 90739140077 for ; Wed, 8 Oct 2014 21:17:11 +1100 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1XboIk-0001XI-S6; Wed, 08 Oct 2014 12:16:59 +0200 Received: from mail.sysmocom.de ([2a01:4f8:191:444c::2:4]) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1Xbo8J-0001KC-00 for openbsc@lists.osmocom.org; Wed, 08 Oct 2014 12:06:15 +0200 Received: from sysmocom-tmp.lan (e178216153.adsl.alicedsl.de [85.178.216.153]) by mail.sysmocom.de (Postfix) with ESMTPSA id 8B67B7DD47; Wed, 8 Oct 2014 10:06:07 +0000 (UTC) From: Jacob Erlbeck To: openbsc@lists.osmocom.org Subject: [PATCH 1/6] gprs-ns/test: Use gprs_nsvc_reset instead of gprs_ns_tx_reset Date: Wed, 8 Oct 2014 12:05:13 +0200 Message-Id: <1412762718-31961-1-git-send-email-jerlbeck@sysmocom.de> X-Mailer: git-send-email 1.9.1 X-Spam-Score: 0.0 (/) Cc: Jacob Erlbeck X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org Currently gprs_ns_tx_reset is used to let the NS stack generate NS_RESET message. This is not adjusting the nsvc state properly. This patch uses gprs_nsvc_reset instead which starts the full reset procedure. Sponsored-by: On-Waves ehf --- tests/gb/gprs_ns_test.c | 23 ++++++++--------------- tests/gb/gprs_ns_test.ok | 12 +++++------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c index c90d752..15e36ba 100644 --- a/tests/gb/gprs_ns_test.c +++ b/tests/gb/gprs_ns_test.c @@ -573,7 +573,6 @@ static void test_bss_reset_ack() struct sockaddr_in peer[4] = {{0},}; struct gprs_nsvc *nsvc; struct sockaddr_in *nse[4]; - int rc; peer[0].sin_family = AF_INET; peer[0].sin_port = htons(1111); @@ -604,7 +603,7 @@ static void test_bss_reset_ack() printf("--- Setup VC 1 SGSN -> BSS ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, 0x1001); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, nse[0], 0x1001, 0x1000); gprs_dump_nsi(nsi); @@ -616,25 +615,19 @@ static void test_bss_reset_ack() printf("--- Setup VC 2 SGSN -> BSS (hits NSEI 1) ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, 0x2001); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, nse[0], 0x1001, 0x1000); gprs_dump_nsi(nsi); printf("--- Setup VC 2 SGSN -> BSS (hits NSEI 2) ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, 0x2001); - rc = gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); - if (rc < 0) - printf("Failed to send RESET to %s\n\n", gprs_ns_ll_str(nsvc)); - else { - send_ns_reset_ack(nsi, nse[1], 0x2001, 0x2000); - gprs_dump_nsi(nsi); - } + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); printf("--- Setup VC 1 SGSN -> BSS (hits NSEI 1) ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, 0x1001); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, nse[0], 0x1001, 0x1000); gprs_dump_nsi(nsi); @@ -683,7 +676,7 @@ static void test_bss_reset_ack() printf("--- RESET_ACK with invalid NSEI, BSS -> SGSN ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, 0x1001); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, nse[0], 0x1001, 0xf000); gprs_dump_nsi(nsi); @@ -692,7 +685,7 @@ static void test_bss_reset_ack() printf("--- RESET_ACK with invalid NSVCI, BSS -> SGSN ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, 0x1001); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, nse[0], 0xf001, 0x1000); gprs_dump_nsi(nsi); @@ -761,7 +754,7 @@ static void test_sgsn_reset() printf("--- RESET_ACK with invalid NSEI, BSS -> SGSN ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, SGSN_NSEI+1); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, &sgsn_peer, SGSN_NSEI+1, 0xe000); gprs_dump_nsi(nsi); @@ -770,7 +763,7 @@ static void test_sgsn_reset() printf("--- RESET_ACK with invalid NSVCI, BSS -> SGSN ---\n\n"); nsvc = gprs_nsvc_by_nsvci(nsi, SGSN_NSEI+1); - gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); send_ns_reset_ack(nsi, &sgsn_peer, 0xe001, SGSN_NSEI); gprs_dump_nsi(nsi); diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok index 13d5f36..0d4b7fb 100644 --- a/tests/gb/gprs_ns_test.ok +++ b/tests/gb/gprs_ns_test.ok @@ -368,15 +368,13 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x00000000:0 + VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, blocked, dead VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked NS-VC Block count : 2 NS-VC replaced other count: 1 --- Setup VC 2 SGSN -> BSS (hits NSEI 2) --- -Failed to send RESET to 0.0.0.0:0 - --- Setup VC 1 SGSN -> BSS (hits NSEI 1) --- MESSAGE to BSS, msg length 12 @@ -391,7 +389,7 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x00000000:0 + VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, blocked, dead VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked NS-VC Block count : 3 NS-VC replaced other count: 1 @@ -566,7 +564,7 @@ Current NS-VCIs: NS-VC Block count : 1 NS-VC replaced other count: 2 VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, blocked + VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, blocked, dead NS-VC Block count : 4 NS-VC replaced other count: 2 NS-VC changed NSEI count : 3 @@ -700,7 +698,7 @@ PROCESSING RESET_ACK from 0x05060708:32000 result (RESET_ACK) = -22 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead NS-VC Block count : 1 NS-VCI was invalid count : 1 NSEI was invalid count : 2 @@ -717,7 +715,7 @@ PROCESSING RESET_ACK from 0x05060708:32000 result (RESET_ACK) = -22 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead NS-VC Block count : 1 NS-VCI was invalid count : 2 NSEI was invalid count : 2