Change in osmo-ggsn[master]: gtp: Improve logging of failing pdp ctx resolution from TEI/TID

pespin gerrit-no-reply at lists.osmocom.org
Thu Apr 22 13:01:27 UTC 2021


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


Change subject: gtp: Improve logging of failing pdp ctx resolution from TEI/TID
......................................................................

gtp: Improve logging of failing pdp ctx resolution from TEI/TID

Change-Id: I4f2084ec7e3a830e0224dd998ff0fe6654cc23bd
---
M gtp/gtp.c
1 file changed, 31 insertions(+), 24 deletions(-)



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

diff --git a/gtp/gtp.c b/gtp/gtp.c
index 1995d10..81b7e0f 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -2136,8 +2136,9 @@
 		/* Find the context in question */
 		if (gtp_pdp_tidget(gsn, &pdp, get_tid(pack))) {
 			gsn->err_unknownpdp++;
-			GTP_LOGPKG(LOGL_ERROR, peer, pack,
-				    len, "Unknown PDP context\n");
+			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+				   "Unknown PDP context: TID=0x%" PRIx64 "\n",
+				   get_tid(pack));
 			return gtp_update_pdp_resp(gsn, version, peer, fd, pack,
 						   len, NULL,
 						   GTPCAUSE_NON_EXIST);
@@ -2161,9 +2162,9 @@
 			/* Find the context in question */
 			if (gtp_pdp_getgtp1(gsn, &pdp, get_tei(pack))) {
 				gsn->err_unknownpdp++;
-				GTP_LOGPKG(LOGL_ERROR, peer,
-					pack, len, "Unknown PDP context: %u\n",
-					get_tei(pack));
+				GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+					   "Unknown PDP context: TEI=0x%" PRIx32 "\n",
+					   get_tei(pack));
 				return gtp_update_pdp_resp(gsn, version, peer,
 							   fd, pack, len, NULL,
 							   GTPCAUSE_NON_EXIST);
@@ -2172,8 +2173,9 @@
 			/* Find the context in question */
 			if (gtp_pdp_getimsi(gsn, &pdp, imsi, nsapi)) {
 				gsn->err_unknownpdp++;
-				GTP_LOGPKG(LOGL_ERROR, peer,
-					    pack, len, "Unknown PDP context\n");
+				GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+					   "Unknown PDP context: IMSI=0x%" PRIx64
+					   " NSAPI=%" PRIu8 "\n", imsi, nsapi);
 				return gtp_update_pdp_resp(gsn, version, peer,
 							   fd, pack, len, NULL,
 							   GTPCAUSE_NON_EXIST);
@@ -2366,7 +2368,7 @@
 		if (gtp_pdp_getgtp1(gsn, &pdp, get_tei(pack))) {
 			gsn->err_unknownpdp++;
 			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
-				    "Unknown PDP context: %u\n", get_tei(pack));
+				   "Unknown PDP context: TEI=0x%" PRIx32 "\n", get_tei(pack));
 			goto err_out;
 		}
 	}
@@ -2603,7 +2605,7 @@
 	if (gtp_pdp_getgtp1(gsn, &linked_pdp, get_tei(pack))) {
 		gsn->err_unknownpdp++;
 		GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
-			    "Unknown PDP context: %u\n", get_tei(pack));
+			   "Unknown PDP context: TEI=0x%" PRIx32 "\n", get_tei(pack));
 		return gtp_delete_pdp_resp(gsn, version, peer, fd, pack, len,
 					   NULL, NULL, GTPCAUSE_NON_EXIST,
 					   teardown);
@@ -2632,7 +2634,7 @@
 		if (gtpie_gettv1(ie, GTPIE_NSAPI, 0, &nsapi)) {
 			gsn->missing++;
 			GTP_LOGPKG(LOGL_ERROR, peer, pack,
-				    len, "Missing mandatory information field\n");
+				   len, "Missing mandatory information field\n");
 			return gtp_delete_pdp_resp(gsn, version, peer, fd, pack,
 						   len, NULL, NULL,
 						   GTPCAUSE_MAN_IE_MISSING,
@@ -2642,8 +2644,9 @@
 		/* Find the context in question */
 		if (gtp_pdp_getgtp1(gsn, &pdp, linked_pdp->secondary_tei[nsapi & 0x0f])) {
 			gsn->err_unknownpdp++;
-			GTP_LOGPKG(LOGL_ERROR, peer, pack,
-				    len, "Unknown PDP context\n");
+			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+				   "Unknown PDP context: Secondary TEI=0x%" PRIx32 "\n",
+				   linked_pdp->secondary_tei[nsapi & 0x0f]);
 			return gtp_delete_pdp_resp(gsn, version, peer, fd, pack,
 						   len, NULL, NULL,
 						   GTPCAUSE_NON_EXIST,
@@ -2696,8 +2699,9 @@
 	if (gtp_pdp_getgtp1(gsn, &pdp, get_tei(pack))) {
 		gsn->err_unknownpdp++;
 		GTP_LOGPKG(LOGL_NOTICE, peer, pack, len,
-			    "Unknown PDP context: %u (expected if gtp_delete_context_req is used or pdp ctx was freed manually before response)\n",
-			     get_tei(pack));
+			   "Unknown PDP context: TEI=0x%" PRIx32 " (expected if "
+			   "gtp_delete_context_req is used or pdp ctx was freed "
+			   "manually before response)\n", get_tei(pack));
 		if (gsn->cb_conf)
 			gsn->cb_conf(type, EOF, NULL, cbp);
 		return EOF;
@@ -2774,7 +2778,8 @@
 		if (gtp_pdp_tidget(gsn, &pdp, get_tid(pack))) {
 			gsn->err_unknownpdp++;
 			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
-				    "Unknown PDP context\n");
+				   "Unknown PDP context: TID=0x%" PRIx64 "\n",
+				   get_tid(pack));
 			return EOF;
 		}
 	} else if (version == 1) {
@@ -2799,7 +2804,9 @@
 
 		if (gtp_pdp_getgtp1_peer_d(gsn, &pdp, peer, teid_gn)) {
 			gsn->err_unknownpdp++;
-			GTP_LOGPKG(LOGL_ERROR, peer, pack, len, "Unknown PDP context\n");
+			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+				   "Unknown PDP context: Peer TEID=0x%" PRIx32 "\n",
+				   teid_gn);
 			return EOF;
 		}
 	} else {
@@ -2830,22 +2837,22 @@
 
 	switch (version) {
 	case 0:
-		if (gtp_pdp_getgtp0(gsn, &pdp,
-				    ntoh16(((union gtp_packet *)pack)->gtp0.h.flow))) {
+		if (gtp_pdp_getgtp0(gsn, &pdp, get_tei(pack))) {
 			gsn->err_unknownpdp++;
-			GTP_LOGPKG(LOGL_ERROR, peer, pack,
-				    len, "Unknown PDP context, GTPv0\n");
+			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+				   "Unknown PDP context: TEI=0x%" PRIx32 "\n",
+				   get_tei(pack));
 			return gtp_error_ind_resp(gsn, version, peer, fd, pack,
 						  len);
 		}
 		hlen = GTP0_HEADER_SIZE;
 		break;
 	case 1:
-		if (gtp_pdp_getgtp1(gsn, &pdp,
-				    ntoh32(((union gtp_packet *)pack)->gtp1l.h.tei))) {
+		if (gtp_pdp_getgtp1(gsn, &pdp, get_tei(pack))) {
 			gsn->err_unknownpdp++;
-			GTP_LOGPKG(LOGL_ERROR, peer, pack,
-				    len, "Unknown PDP context, GTPv1\n");
+			GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
+				   "Unknown PDP context: TEI=0x%" PRIx32 "\n",
+				   get_tei(pack));
 			return gtp_error_ind_resp(gsn, version, peer, fd, pack,
 						  len);
 		}

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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I4f2084ec7e3a830e0224dd998ff0fe6654cc23bd
Gerrit-Change-Number: 23862
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210422/a8960c8e/attachment.htm>


More information about the gerrit-log mailing list