Change in osmo-ggsn[master]: gtp: Pass originating pdp ctx to recovery_cb

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Jul 17 13:54:41 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10024


Change subject: gtp: Pass originating pdp ctx to recovery_cb
......................................................................

gtp: Pass originating pdp ctx to recovery_cb

This commit breaks API and old apps will fail to compile if using the
cb_recovery.

Sometimes the originating pdp ctx causing the Recovery Procedure is
required, in order to drop all pdp ctx but this one, which specs specify
should be handled as valid:
"""
The SGSN receiving the Recovery information element shall handle it as when an
Echo Response message is received but shall consider the PDP context being created as active if the response indicates
successful context activation at the GGSN.
"""

Change-Id: I53e92298f2f6b84d662a3300d922e8c2ccb178bc
---
M gtp/gtp.c
M gtp/gtp.h
2 files changed, 18 insertions(+), 9 deletions(-)



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

diff --git a/gtp/gtp.c b/gtp/gtp.c
index 95abbef..a495943 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -190,10 +190,17 @@
 	return 0;
 }
 
+/* cb_recovery()
+ * pdp may be NULL if Recovery IE was received from a message indepenendent
+ * of any PDP ctx (such as Echo Response), or because pdp ctx is unknown to the
+ * local setup. In case pdp is known, user may want to keep that pdp alive to
+ * handle subsequent msg cb as this specific pdp ctx is still valid according to
+ * specs.
+ */
 int gtp_set_cb_recovery(struct gsn_t *gsn,
-			int (*cb) (struct sockaddr_in * peer, uint8_t recovery))
+			int (*cb_recovery) (struct sockaddr_in * peer, struct pdp_t * pdp, uint8_t recovery))
 {
-	gsn->cb_recovery = cb;
+	gsn->cb_recovery = cb_recovery;
 	return 0;
 }
 
@@ -978,7 +985,7 @@
 		gsn->cb_conf(type, recovery, NULL, cbp);
 
 	if (gsn->cb_recovery)
-		gsn->cb_recovery(peer, recovery);
+		gsn->cb_recovery(peer, NULL, recovery);
 
 	return 0;
 }
@@ -1410,8 +1417,9 @@
 
 	/* Recovery (optional) */
 	if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
+		/* pass null pdp since new ctx is still not known to upper layers */
 		if (gsn->cb_recovery)
-			gsn->cb_recovery(peer, recovery);
+			gsn->cb_recovery(peer, NULL, recovery);
 	}
 
 	/* Selection mode (conditional) */
@@ -1697,7 +1705,7 @@
 	/* Extract recovery (optional) */
 	if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
 		if (gsn->cb_recovery)
-			gsn->cb_recovery(peer, recovery);
+			gsn->cb_recovery(peer, pdp, recovery);
 	}
 
 	/* Extract protocol configuration options (optional) */
@@ -2107,7 +2115,7 @@
 	/* Recovery (optional) */
 	if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
 		if (gsn->cb_recovery)
-			gsn->cb_recovery(peer, recovery);
+			gsn->cb_recovery(peer, pdp, recovery);
 	}
 
 	if (version == 0) {
@@ -2268,7 +2276,7 @@
 	/* Extract recovery (optional) */
 	if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
 		if (gsn->cb_recovery)
-			gsn->cb_recovery(peer, recovery);
+			gsn->cb_recovery(peer, pdp, recovery);
 	}
 
 	/* Check all conditional information elements */
diff --git a/gtp/gtp.h b/gtp/gtp.h
index f185424..f5ce517 100644
--- a/gtp/gtp.h
+++ b/gtp/gtp.h
@@ -270,7 +270,7 @@
 	int (*cb_extheader_ind) (struct sockaddr_in * peer);
 	int (*cb_conf) (int type, int cause, struct pdp_t * pdp, void *cbp);
 	int (*cb_data_ind) (struct pdp_t * pdp, void *pack, unsigned len);
-	int (*cb_recovery) (struct sockaddr_in * peer, uint8_t recovery);
+	int (*cb_recovery) (struct sockaddr_in * peer, struct pdp_t * pdp, uint8_t recovery);
 
 	/* Counters */
 
@@ -360,7 +360,8 @@
 				      void *cbp));
 
 int gtp_set_cb_recovery(struct gsn_t *gsn,
-			int (*cb) (struct sockaddr_in * peer,
+			int (*cb_recovery) (struct sockaddr_in * peer,
+				   struct pdp_t * pdp,
 				   uint8_t recovery));
 
 /* Internal functions (not part of the API */

-- 
To view, visit https://gerrit.osmocom.org/10024
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: I53e92298f2f6b84d662a3300d922e8c2ccb178bc
Gerrit-Change-Number: 10024
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180717/ef839df7/attachment.htm>


More information about the gerrit-log mailing list