Review at  https://gerrit.osmocom.org/3845

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(-)


  git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/45/3845/1

diff --git a/gtp/gtp.c b/gtp/gtp.c
index 012aa79..7ce41bb 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)
@@ -1571,6 +1575,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: newchange
Gerrit-Change-Id: I68ae49a765828fa681054c68bf7f5e74dbe48ad2
Gerrit-PatchSet: 1
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to