aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-05-13 22:10:24 +0700
committerHarald Welte <laforge@gnumonks.org>2019-05-14 08:33:25 +0000
commitd7030d268c4e61bcdad42364a7080635d32de140 (patch)
tree603a93b4044ef03ae4aab3518bd3bec0f7b83fd7
parent2e8e57a3dea8f7fc4ea8f407c0237b6f0aa56adb (diff)
osmo-ggsn: print requested / actual APN in PDP info
An actual APN can be different from the one that was requested by user, e.g. when 'default-apn' VTY parameter is used. The one that was requested is already being stored in the PDP context state. Let's also store a chosen APN in create_context_ind(). Change-Id: I9cbe195f64e5b83d5158c175aad2e81ba2487850
-rw-r--r--ggsn/ggsn.c6
-rw-r--r--ggsn/ggsn_vty.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index a3bf4db..bd8647f 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -685,6 +685,12 @@ int create_context_ind(struct pdp_t *pdp)
return 0;
}
+ /* Store the actual APN for logging and the VTY */
+ rc = osmo_apn_from_str(pdp->apn_use.v, sizeof(pdp->apn_use.v), apn->cfg.name);
+ if (rc < 0) /* Unlikely this would happen, but anyway... */
+ LOGPPDP(LOGL_ERROR, pdp, "Failed to store APN '%s'\n", apn->cfg.name);
+ pdp->apn_use.l = rc;
+
/* Allocate dynamic addresses from the pool */
for (i = 0; i < num_addr; i++) {
if (addr[i].len == sizeof(struct in_addr)) {
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index 594c0e9..214e2fa 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -26,6 +26,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/rate_ctr.h>
+#include <osmocom/gsm/apn.h>
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/vty/command.h>
@@ -733,6 +734,8 @@ static const char *print_gsnaddr(const struct ul16_t *in)
static void show_one_pdp(struct vty *vty, struct pdp_t *pdp)
{
struct in46_addr eua46;
+ char name_buf[256];
+ char *apn_name;
vty_out(vty, "IMSI: %s, NSAPI: %u, MSISDN: %s%s", imsi_gtp2str(&pdp->imsi), pdp->nsapi,
osmo_hexdump_nospc(pdp->msisdn.v, pdp->msisdn.l), VTY_NEWLINE);
@@ -743,6 +746,11 @@ static void show_one_pdp(struct vty *vty, struct pdp_t *pdp)
vty_out(vty, " Data: %s:%08x ", print_gsnaddr(&pdp->gsnlu), pdp->teid_own);
vty_out(vty, "<-> %s:%08x%s", print_gsnaddr(&pdp->gsnru), pdp->teid_gn, VTY_NEWLINE);
+ apn_name = osmo_apn_to_str(name_buf, pdp->apn_req.v, pdp->apn_req.l);
+ vty_out(vty, " APN requested: %s%s", apn_name ? name_buf : "(NONE)", VTY_NEWLINE);
+ apn_name = osmo_apn_to_str(name_buf, pdp->apn_use.v, pdp->apn_use.l);
+ vty_out(vty, " APN in use: %s%s", apn_name ? name_buf : "(NONE)", VTY_NEWLINE);
+
in46a_from_eua(&pdp->eua, &eua46);
vty_out(vty, " End-User Address: %s%s", in46a_ntoa(&eua46), VTY_NEWLINE);
vty_out(vty, " Transmit GTP Sequence Number for G-PDU: %s%s",