[MERGED] openggsn[master]: libgtp: Add back-reference to gsn from pdp context

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 Sep 5 21:23:08 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: libgtp: Add back-reference to gsn from pdp context
......................................................................


libgtp: Add back-reference to gsn from pdp context

This is required once one wants to support multiple GSNs in a single
application.

WARNING: This breaks ABI compatibility, LIBVERSION must be adjusted

Change-Id: I68ae49a765828fa681054c68bf7f5e74dbe48ad2
---
M gtp/gtp.c
M gtp/pdp.h
2 files changed, 11 insertions(+), 1 deletion(-)

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



diff --git a/gtp/gtp.c b/gtp/gtp.c
index a3f6eb2..87ab075 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -90,7 +90,11 @@
 int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp,
 	       uint64_t imsi, uint8_t nsapi)
 {
-	return pdp_newpdp(pdp, imsi, nsapi, NULL);
+	int rc;
+	rc = pdp_newpdp(pdp, imsi, nsapi, NULL);
+	if (!rc && *pdp)
+		(*pdp)->gsn = gsn;
+	return rc;
 }
 
 int gtp_freepdp(struct gsn_t *gsn, struct pdp_t *pdp)
@@ -1570,6 +1574,8 @@
 	}
 
 	pdp_newpdp(&pdp, pdp->imsi, pdp->nsapi, pdp);
+	if (pdp)
+		pdp->gsn = gsn;
 
 	/* Callback function to validata login */
 	if (gsn->cb_create_context_ind != 0)
diff --git a/gtp/pdp.h b/gtp/pdp.h
index 432f1df..c51e9e2 100644
--- a/gtp/pdp.h
+++ b/gtp/pdp.h
@@ -12,6 +12,8 @@
 #ifndef _PDP_H
 #define _PDP_H
 
+struct gsn_t;
+
 #define PDP_MAX 1024		/* Max number of PDP contexts */
 #define PDP_MAXNSAPI 16		/* Max number of NSAPI */
 
@@ -221,6 +223,8 @@
 
 	/* to be used by libgtp callers/users (to attach their own private state) */
 	void *priv;
+
+	struct gsn_t *gsn;
 };
 
 /* functions related to pdp_t management */

-- 
To view, visit https://gerrit.osmocom.org/3845
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I68ae49a765828fa681054c68bf7f5e74dbe48ad2
Gerrit-PatchSet: 4
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list