Change in osmo-ggsn[master]: libgtp: implement gtp_clear_queues to clear req/resp queue

2018-09-16 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10975 )

Change subject: libgtp: implement gtp_clear_queues to clear req/resp queue
..

libgtp: implement gtp_clear_queues to clear req/resp queue

Clearing the request and response queue is useful for debugging
to reset "some" state. Otherwise some tests will get un-expected
packets.

Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
---
M gtp/gtp.c
M gtp/gtp.h
2 files changed, 20 insertions(+), 0 deletions(-)

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



diff --git a/gtp/gtp.c b/gtp/gtp.c
index 1d58088..b98fba0 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -496,6 +496,24 @@
return 0;
 }

+
+/**
+ * @brief clear the request and response queue. Useful for debugging to reset 
"some" state.
+ * @param gsn The GGSN instance
+ */
+void gtp_clear_queues(struct gsn_t *gsn)
+{
+   struct qmsg_t *qmsg;
+
+   while (!queue_getfirst(gsn->queue_req, )) {
+   queue_freemsg(gsn->queue_req, qmsg);
+   }
+
+   while (!queue_getfirst(gsn->queue_resp, )) {
+   queue_freemsg(gsn->queue_resp, qmsg);
+   }
+}
+
 /* gtp_conf
  * Remove signalling packet from retransmission queue.
  * return 0 on success, EOF if packet was not found */
diff --git a/gtp/gtp.h b/gtp/gtp.h
index ed594f1..5f35ab5 100644
--- a/gtp/gtp.h
+++ b/gtp/gtp.h
@@ -369,6 +369,8 @@
   struct pdp_t * pdp,
   uint8_t recovery));

+void gtp_clear_queues(struct gsn_t *gsn);
+
 /* Internal functions (not part of the API */

 extern int gtp_echo_req(struct gsn_t *gsn, int version, void *cbp,

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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
Gerrit-Change-Number: 10975
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ggsn[master]: libgtp: implement gtp_clear_queues to clear req/resp queue

2018-09-16 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10975 )

Change subject: libgtp: implement gtp_clear_queues to clear req/resp queue
..


Patch Set 2: Code-Review+2


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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
Gerrit-Change-Number: 10975
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Sun, 16 Sep 2018 10:30:08 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: libgtp: implement gtp_clear_queues to clear req/resp queue

2018-09-16 Thread lynxis lazus
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/10975

to look at the new patch set (#2).

Change subject: libgtp: implement gtp_clear_queues to clear req/resp queue
..

libgtp: implement gtp_clear_queues to clear req/resp queue

Clearing the request and response queue is useful for debugging
to reset "some" state. Otherwise some tests will get un-expected
packets.

Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
---
M gtp/gtp.c
M gtp/gtp.h
2 files changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/75/10975/2
--
To view, visit https://gerrit.osmocom.org/10975
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
Gerrit-Change-Number: 10975
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ggsn[master]: libgtp: implement gtp_clear_queues to clear req/resp queue

2018-09-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10975 )

Change subject: libgtp: implement gtp_clear_queues to clear req/resp queue
..


Patch Set 1: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/10975/1//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/10975/1//COMMIT_MSG@11
PS1, Line 11: packages
packets.



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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
Gerrit-Change-Number: 10975
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Sun, 16 Sep 2018 05:17:36 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: libgtp: implement gtp_clear_queues to clear req/resp queue

2018-09-15 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/10975


Change subject: libgtp: implement gtp_clear_queues to clear req/resp queue
..

libgtp: implement gtp_clear_queues to clear req/resp queue

Clearing the request and response queue is useful for debugging
to reset "some" state. Otherwise some tests will get un-expected
packages.

Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
---
M gtp/gtp.c
M gtp/gtp.h
2 files changed, 20 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/75/10975/1

diff --git a/gtp/gtp.c b/gtp/gtp.c
index 1d58088..b98fba0 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -496,6 +496,24 @@
return 0;
 }

+
+/**
+ * @brief clear the request and response queue. Useful for debugging to reset 
"some" state.
+ * @param gsn The GGSN instance
+ */
+void gtp_clear_queues(struct gsn_t *gsn)
+{
+   struct qmsg_t *qmsg;
+
+   while (!queue_getfirst(gsn->queue_req, )) {
+   queue_freemsg(gsn->queue_req, qmsg);
+   }
+
+   while (!queue_getfirst(gsn->queue_resp, )) {
+   queue_freemsg(gsn->queue_resp, qmsg);
+   }
+}
+
 /* gtp_conf
  * Remove signalling packet from retransmission queue.
  * return 0 on success, EOF if packet was not found */
diff --git a/gtp/gtp.h b/gtp/gtp.h
index ed594f1..5f35ab5 100644
--- a/gtp/gtp.h
+++ b/gtp/gtp.h
@@ -369,6 +369,8 @@
   struct pdp_t * pdp,
   uint8_t recovery));

+void gtp_clear_queues(struct gsn_t *gsn);
+
 /* Internal functions (not part of the API */

 extern int gtp_echo_req(struct gsn_t *gsn, int version, void *cbp,

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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I279d1d7cbf5d37dd5609c2b968f317fe9a0e348d
Gerrit-Change-Number: 10975
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus