aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-13 00:56:45 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:55 +0200
commitdfbd2c88d2b124a2db5771ceb903422e55699149 (patch)
treed3bbbdc2f27a124f14856970a3f16e22c4d169df
parent619021da9a1f4341f6cf6283b79ef811879f1fab (diff)
sgsn_vty: Don't assume pdp->lib is always valid
We can only print libgtp pdp information if a library context is attached to this pdp context. This is not always the case, particuarly during some teardown scenarios. Change-Id: Ia3184877f9709db65f5f93a98403f2ef5b04a8ca
-rw-r--r--src/gprs/sgsn_vty.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 888f53a1..cc8d6c39 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -468,20 +468,22 @@ static void vty_dump_pdp(struct vty *vty, const char *pfx,
const char *imsi = pdp->mm ? pdp->mm->imsi : "(detaching)";
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);
+ if (pdp->lib) {
+ 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);
}