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
This commit is contained in:
Harald Welte 2016-12-15 19:48:58 +01:00
parent cc7db18e1a
commit 471ac7d99c
1 changed files with 21 additions and 2 deletions

View File

@ -442,18 +442,37 @@ const struct value_string gprs_mm_st_strs[] = {
{ 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);
}