Change in ...osmo-sgsn[master]: sgsn: gtp: Drop related pdp contexts on echo timeout against GGSN

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

pespin gerrit-no-reply at lists.osmocom.org
Mon Sep 2 09:06:14 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/15308 )

Change subject: sgsn: gtp: Drop related pdp contexts on echo timeout against GGSN
......................................................................

sgsn: gtp: Drop related pdp contexts on echo timeout against GGSN

Change-Id: I7e97bac1c13a2c26203eb64e590fd75d77eb44bd
---
M include/osmocom/sgsn/gprs_sgsn.h
M src/gprs/gprs_sgsn.c
M src/gprs/sgsn_libgtp.c
3 files changed, 16 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 17cafa3..eea9fb0 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -402,6 +402,7 @@
 struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id);
 void sgsn_ggsn_ctx_drop_pdp(struct sgsn_pdp_ctx *pctx);
 int sgsn_ggsn_ctx_drop_all_pdp_except(struct sgsn_ggsn_ctx *ggsn, struct sgsn_pdp_ctx *except);
+int sgsn_ggsn_ctx_drop_all_pdp(struct sgsn_ggsn_ctx *ggsn);
 void sgsn_ggsn_ctx_add_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp);
 void sgsn_ggsn_ctx_remove_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp);
 void sgsn_ggsn_ctx_check_echo_timer(struct sgsn_ggsn_ctx *ggc);
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index 7174bd5..829204e 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -759,6 +759,11 @@
 	return num;
 }
 
+int sgsn_ggsn_ctx_drop_all_pdp(struct sgsn_ggsn_ctx *ggsn)
+{
+	return sgsn_ggsn_ctx_drop_all_pdp_except(ggsn, NULL);
+}
+
 void sgsn_ggsn_ctx_add_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp)
 {
 	llist_add(&pdp->ggsn_list, &ggc->pdp_list);
diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index 79d5543..a8ad527 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -469,7 +469,8 @@
 
 void sgsn_ggsn_echo_req(struct sgsn_ggsn_ctx *ggc)
 {
-	gtp_echo_req(ggc->gsn, ggc->gtp_version, NULL, &ggc->remote_addr);
+	LOGGGSN(ggc, LOGL_INFO, "GTP Tx Echo Request\n");
+	gtp_echo_req(ggc->gsn, ggc->gtp_version, ggc, &ggc->remote_addr);
 }
 
 #ifdef BUILD_IU
@@ -579,13 +580,15 @@
 }
 
 /* Confirmation of an GTP ECHO request */
-static int echo_conf(struct pdp_t *pdp, void *cbp, int recovery)
+static int echo_conf(void *cbp, bool timeout)
 {
-	if (recovery < 0) {
-		LOGP(DGPRS, LOGL_NOTICE, "GTP Echo Request timed out\n");
+	struct sgsn_ggsn_ctx *ggc = (struct sgsn_ggsn_ctx *)cbp;
+	if (timeout) {
+		LOGGGSN(ggc, LOGL_NOTICE, "GTP Echo Request timed out\n");
 		/* FIXME: if version == 1, retry with version 0 */
+		sgsn_ggsn_ctx_drop_all_pdp(ggc);
 	} else {
-		DEBUGP(DGPRS, "GTP Rx Echo Response\n");
+		LOGGGSN(ggc, LOGL_INFO, "GTP Rx Echo Response\n");
 	}
 	return 0;
 }
@@ -630,8 +633,8 @@
 
 	switch (type) {
 	case GTP_ECHO_REQ:
-		/* libgtp hands us the RECOVERY number instead of a cause */
-		return echo_conf(pdp, cbp, cause);
+		/* libgtp hands us the RECOVERY number instead of a cause (EOF on timeout) */
+		return echo_conf(cbp, cause == EOF);
 	case GTP_CREATE_PDP_REQ:
 		return create_pdp_conf(pdp, cbp, cause);
 	case GTP_DELETE_PDP_REQ:

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I7e97bac1c13a2c26203eb64e590fd75d77eb44bd
Gerrit-Change-Number: 15308
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: fixeria <axilirator at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190902/660b6de1/attachment.htm>


More information about the gerrit-log mailing list