Change in libosmocore[master]: NS: Factor out gprs_nsvc_start_test() and use it

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Feb 26 11:24:52 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13023 )

Change subject: NS: Factor out gprs_nsvc_start_test() and use it
......................................................................

NS: Factor out gprs_nsvc_start_test() and use it

This function performs  sending a NS-ALIVE PDU and starting Tns-Test,
let's use it in all places where we used to do that.

As part of this, also fix a bug where the sendto() return value (number
of bytes sent) would actually propagate up all the way to
gprs_ns_rx_reset() return value, which in turn affects the test results
on stdout.

Change-Id: I4d303117f77fabb74bbb91887b9914a81c2a084a
---
M src/gb/gb_internal.h
M src/gb/gprs_ns.c
M tests/gb/gprs_ns_test.ok
3 files changed, 21 insertions(+), 15 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/gb/gb_internal.h b/src/gb/gb_internal.h
index c1fa8e1..72d940f 100644
--- a/src/gb/gb_internal.h
+++ b/src/gb/gb_internal.h
@@ -4,6 +4,7 @@
 #include <osmocom/gsm/tlv.h>
 #include <osmocom/gprs/gprs_ns.h>
 
+void gprs_nsvc_start_test(struct gprs_nsvc *nsvc);
 int gprs_ns_tx_sns_ack(struct gprs_nsvc *nsvc, uint8_t trans_id, uint8_t *cause,
 		       const struct gprs_ns_ie_ip4_elem *ip4_elems,unsigned int num_ip4_elems);
 
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 660dfec..ad68bc9 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1171,8 +1171,7 @@
 	rc = gprs_ns_tx_reset_ack(*nsvc);
 
 	/* start the test procedure */
-	gprs_ns_tx_alive(*nsvc);
-	nsvc_start_timer((*nsvc), NSVC_TIMER_TNS_TEST);
+	gprs_nsvc_start_test(*nsvc);
 
 	return rc;
 }
@@ -1295,10 +1294,9 @@
 		osmo_timer_del(&(*nsvc)->timer);
 	}
 	/* Initiate TEST proc.: Send ALIVE and start timer */
-	rc = gprs_ns_tx_alive(*nsvc);
-	nsvc_start_timer(*nsvc, NSVC_TIMER_TNS_TEST);
+	gprs_nsvc_start_test(*nsvc);
 
-	return rc;
+	return 0;
 }
 
 static int gprs_ns_rx_block(struct gprs_nsvc *nsvc, struct msgb *msg)
@@ -1949,4 +1947,11 @@
 	return s;
 }
 
+/*! Start the ALIVE timer procedure in all NS-VCs part of this NS Instance */
+void gprs_nsvc_start_test(struct gprs_nsvc *nsvc)
+{
+	gprs_ns_tx_alive(nsvc);
+	nsvc_start_timer(nsvc, NSVC_TIMER_TNS_TEST);
+}
+
 /*! @} */
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 3cb1dfc..57ae188 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -344,7 +344,7 @@
 MESSAGE to BSS, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222, ALIVE, UNBLOCKED, UNRESET
@@ -365,7 +365,7 @@
 MESSAGE to BSS, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, DEAD, BLOCKED, RESET
@@ -386,7 +386,7 @@
 MESSAGE to BSS, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, DEAD, BLOCKED, RESET
@@ -534,7 +534,7 @@
 MESSAGE to BSS, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET
@@ -557,7 +557,7 @@
 MESSAGE to BSS, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET
@@ -641,7 +641,7 @@
 MESSAGE to BSS, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET
@@ -666,7 +666,7 @@
 MESSAGE to SGSN, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 PROCESSING ALIVE_ACK from 0x05060708:32000
 0b 
@@ -818,7 +818,7 @@
 MESSAGE to SGSN, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 PROCESSING ALIVE_ACK from 0x05060708:32000
 0b 
@@ -898,7 +898,7 @@
 MESSAGE to SGSN, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 PROCESSING ALIVE_ACK from 0x05060708:32000
 0b 
@@ -956,7 +956,7 @@
 MESSAGE to SGSN, msg length 1
 0a 
 
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
 
 PROCESSING ALIVE_ACK from 0x05060708:32000
 0b 

-- 
To view, visit https://gerrit.osmocom.org/13023
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4d303117f77fabb74bbb91887b9914a81c2a084a
Gerrit-Change-Number: 13023
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-CC: Max <msuraev at sysmocom.de>
Gerrit-CC: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190226/f2503929/attachment.htm>


More information about the gerrit-log mailing list