Change in osmo-ggsn[master]: Fix vty PDP lookups by IMSI

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

keith gerrit-no-reply at lists.osmocom.org
Sat Oct 10 10:19:17 UTC 2020


keith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/20532 )


Change subject: Fix vty PDP lookups by IMSI
......................................................................

Fix vty PDP lookups by IMSI

Change-Id: Icd2e2bc6068c06fbf5d5fe905ebcda8954f33f04
---
M ggsn/ggsn_vty.c
M gtp/pdp.c
2 files changed, 15 insertions(+), 5 deletions(-)



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

diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index cb92a8a..a5815af 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -896,6 +896,18 @@
 
 	imsi = strtoull(argv[1], NULL, 10);
 
+	/*  gtp_pdp_getimsi() calls gtp_pdp_tidget() which calls
+	 *  pdp_tidhash() as was done by pdp_tidset() but when than
+	 *  function was called, the IMSI was in gtp format. (TS 29.060)
+	 *  We end up with the wrong hash below and do not find the pdp
+	 *  context.
+	 *  See gtp.c:imsi_gtp2str()
+	 */
+
+	/* TODO: Implement
+	 *  imsi = imsi_str2gtp(const uint64_t *imsi);
+	 */
+
 	if (argc > 2) {
 		nsapi = atoi(argv[2]);
 		if (gtp_pdp_getimsi(ggsn->gsn, &pdp, imsi, nsapi)) {
diff --git a/gtp/pdp.c b/gtp/pdp.c
index 518f5d4..116e849 100644
--- a/gtp/pdp.c
+++ b/gtp/pdp.c
@@ -274,7 +274,7 @@
 	int hash = pdp_tidhash(tid);
 	struct pdp_t *pdp2;
 	struct pdp_t *pdp_prev = NULL;
-	DEBUGP(DLGTP, "Begin pdp_tidset tid = %"PRIx64"\n", tid);
+	DEBUGP(DLGTP, "Begin pdp_tidset tid = %"PRIx64", hash %d\n", tid, hash);
 	pdp->tidnext = NULL;
 	pdp->tid = tid;
 	for (pdp2 = hashtid[hash]; pdp2; pdp2 = pdp2->tidnext)
@@ -319,7 +319,7 @@
 	struct pdp_t **hashtid = gsn->hashtid;
 	int hash = pdp_tidhash(tid);
 	struct pdp_t *pdp2;
-	DEBUGP(DLGTP, "Begin pdp_tidget tid = %"PRIx64"\n", tid);
+	DEBUGP(DLGTP, "Begin pdp_tidget tid = %"PRIx64", hash: %d\n", tid, hash);
 	for (pdp2 = hashtid[hash]; pdp2; pdp2 = pdp2->tidnext) {
 		if (pdp2->tid == tid) {
 			*pdp = pdp2;
@@ -338,9 +338,7 @@
 
 int gtp_pdp_getimsi(struct gsn_t *gsn, struct pdp_t **pdp, uint64_t imsi, uint8_t nsapi)
 {
-	return gtp_pdp_tidget(gsn, pdp,
-			  (imsi & 0x0fffffffffffffffull) +
-			  ((uint64_t) nsapi << 60));
+	return gtp_pdp_tidget(gsn, pdp, pdp_gettid(imsi, nsapi));
 }
 
 

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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Icd2e2bc6068c06fbf5d5fe905ebcda8954f33f04
Gerrit-Change-Number: 20532
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201010/bf9a8ce7/attachment.htm>


More information about the gerrit-log mailing list