[PATCH] openbsc[master]: sgsn: Add GTP information to "show pdp-context"

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jan 26 14:26:27 UTC 2017


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

sgsn: Add GTP information to "show pdp-context"

When displaying the PDP context, it is quite useful to also show IP
address and TEI information about the GTP side of that PDP context.

Change-Id: I56ea530240c15b26729e7a42e539020cb1e233e5
---
M openbsc/src/gprs/sgsn_vty.c
1 file changed, 21 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/88/1688/1

diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index 21c865b..4a97687 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -442,18 +442,37 @@
 	{ 0, NULL }
 };
 
+static char *gtp_ntoa(struct ul16_t *ul)
+{
+	if (ul->l == 4) {
+		struct in_addr *ia = (struct in_addr *) ul;
+		return inet_ntoa(*ia);
+	} else {
+		return "UNKNOWN";
+	}
+}
+
 static void vty_dump_pdp(struct vty *vty, const char *pfx,
 			 struct sgsn_pdp_ctx *pdp)
 {
 	const char *imsi = pdp->mm ? pdp->mm->imsi : "(detaching)";
-	vty_out(vty, "%sPDP Context IMSI: %s, SAPI: %u, NSAPI: %u%s",
-		pfx, imsi, pdp->sapi, pdp->nsapi, VTY_NEWLINE);
+	vty_out(vty, "%sPDP Context IMSI: %s, SAPI: %u, NSAPI: %u, TI: %u%s",
+		pfx, imsi, pdp->sapi, pdp->nsapi, pdp->ti, VTY_NEWLINE);
 	vty_out(vty, "%s  APN: %s%s", pfx,
 		gprs_apn2str(pdp->lib->apn_use.v, pdp->lib->apn_use.l),
 		VTY_NEWLINE);
 	vty_out(vty, "%s  PDP Address: %s%s", pfx,
 		gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l),
 		VTY_NEWLINE);
+	vty_out(vty, "%s  GTP Local Control(%s / TEIC: 0x%08x) ", pfx,
+		gtp_ntoa(&pdp->lib->gsnlc), pdp->lib->teic_own);
+	vty_out(vty, "Data(%s / TEID: 0x%08x)%s",
+		gtp_ntoa(&pdp->lib->gsnlu), pdp->lib->teid_own, VTY_NEWLINE);
+	vty_out(vty, "%s  GTP Remote Control(%s / TEIC: 0x%08x) ", pfx,
+		gtp_ntoa(&pdp->lib->gsnrc), pdp->lib->teic_gn);
+	vty_out(vty, "Data(%s / TEID: 0x%08x)%s",
+		gtp_ntoa(&pdp->lib->gsnru), pdp->lib->teid_gn, VTY_NEWLINE);
+
 	vty_out_rate_ctr_group(vty, " ", pdp->ctrg);
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56ea530240c15b26729e7a42e539020cb1e233e5
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list