Change in ...osmo-ggsn[master]: cosmetic: gtp: Document free pdp ctx in non-teardown scenario

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jun 3 11:18:16 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/14286 )

Change subject: cosmetic: gtp: Document free pdp ctx in non-teardown scenario
......................................................................

cosmetic: gtp: Document free pdp ctx in non-teardown scenario

Change-Id: Ia47ac792111fe1e9aa68222b32b5da823642206b
---
M gtp/gtp.c
1 file changed, 25 insertions(+), 1 deletion(-)

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



diff --git a/gtp/gtp.c b/gtp/gtp.c
index 57c19a2..5dde6b5 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -2409,6 +2409,18 @@
 	if (teardown) {		/* Remove all contexts */
 		gtp_freepdp_teardown(gsn, linked_pdp);
 	} else {
+		/* If we end up here (no teardown) it means we still
+		   have at least another pdp context active for this
+		   PDN connection (since last DeleteReq should come
+		   with teardown enabled). If the ctx to delete is a
+		   secondary ctx, simply free it. If it's the primary
+		   ctx, mark it as nodata but don't free it since we
+		   need it to hold data linked together and we'll
+		   require it later to tear down the entire tree. Still,
+		   we announce its deletion through cb_delete_context
+		   because we don't want user to release its related
+		   data and not use it anymore.
+		 */
 		if (gsn->cb_delete_context)
 			gsn->cb_delete_context(pdp);
 		if (pdp == linked_pdp) {
@@ -2485,7 +2497,19 @@
 	if (cause == GTPCAUSE_ACC_REQ) {
 		if ((teardown) || (version == 0)) {	/* Remove all contexts */
 			gtp_freepdp_teardown(gsn, linked_pdp);
-		} else {	/* Remove only current context */
+		} else {
+			/* If we end up here (no teardown) it means we still
+			   have at least another pdp context active for this
+			   PDN connection (since last DeleteReq should come
+			   with teardown enabled). If the ctx to delete is a
+			   secondary ctx, simply free it. If it's the primary
+			   ctx, mark it as nodata but don't free it since we
+			   need it to hold data linked together and we'll
+			   require it later to tear down the entire tree. Still,
+			   we announce its deletion through cb_delete_context
+			   because we don't want user to release its related
+			   data and not use it anymore.
+			 */
 			if (gsn->cb_delete_context)
 				gsn->cb_delete_context(pdp);
 			if (pdp == linked_pdp) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14286
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia47ac792111fe1e9aa68222b32b5da823642206b
Gerrit-Change-Number: 14286
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190603/8ae6dcb6/attachment.html>


More information about the gerrit-log mailing list