Change in osmo-ggsn[master]: osmo-ggsn: print requested / actual APN in PDP info

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Mon May 13 15:30:57 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/14016


Change subject: osmo-ggsn: print requested / actual APN in PDP info
......................................................................

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
---
M ggsn/ggsn.c
M ggsn/ggsn_vty.c
2 files changed, 14 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/16/14016/1

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 @@
 		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..173cbe0 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 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 @@
 	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_use.v, pdp->apn_use.l);
+	vty_out(vty, " APN in use: %s%s", apn_name ? name_buf : "(NONE)", 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);
+
 	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",

-- 
To view, visit https://gerrit.osmocom.org/14016
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cbe195f64e5b83d5158c175aad2e81ba2487850
Gerrit-Change-Number: 14016
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190513/88c64e54/attachment.html>


More information about the gerrit-log mailing list