[PATCH] osmo-sgsn[master]: Fix APN printing

Max gerrit-no-reply at lists.osmocom.org
Fri Oct 20 11:27:50 UTC 2017

Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit


to look at the new patch set (#2).

Fix APN printing

Previously first character of APN was omitted. Fix this by getting rid
of errorneous wrapper function and using osmo_apn_to_str() directly.

The breaking change was introduced in

Change-Id: Ie13b6cd0066e0370e2adf48d12a363c2e405eaf2
Related: SYS#3610
M src/gprs/sgsn_vty.c
1 file changed, 2 insertions(+), 18 deletions(-)

  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/56/4356/2

diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 1882852..4e58f9f 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -117,23 +117,6 @@
 DECLARE_TIMER(3395, "Wait for DEACT PDP CTX ACK timer (s)")
 DECLARE_TIMER(3397, "Wait for DEACT AA PDP CTX ACK timer (s)")
-#define GSM48_MAX_APN_LEN	102	/* */
-/** Copy apn to a static buffer, replacing the length octets in apn_enc with '.'
- * and terminating with a '\0'. Return the static buffer.
- * len: the length of the encoded APN (which has no terminating zero).
- */
-static char *gprs_apn2str(uint8_t *apn, unsigned int len)
-	static char apnbuf[GSM48_MAX_APN_LEN+1];
-	if (!apn)
-		return "";
-	osmo_apn_to_str(apnbuf, apn, len);
-	return apnbuf+1;
 char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len)
 	static char str[INET6_ADDRSTRLEN + 10];
@@ -458,8 +441,9 @@
 	vty_out(vty, "%sPDP Context IMSI: %s, SAPI: %u, NSAPI: %u, TI: %u%s",
 		pfx, imsi, pdp->sapi, pdp->nsapi, pdp->ti, VTY_NEWLINE);
 	if (pdp->lib) {
+		char apnbuf[APN_MAXLEN + 1];
 		vty_out(vty, "%s  APN: %s%s", pfx,
-			gprs_apn2str(pdp->lib->apn_use.v, pdp->lib->apn_use.l),
+			osmo_apn_to_str(apnbuf, pdp->lib->apn_use.v, pdp->lib->apn_use.l),
 		vty_out(vty, "%s  PDP Address: %s%s", pfx,
 			gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l),

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie13b6cd0066e0370e2adf48d12a363c2e405eaf2
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

More information about the gerrit-log mailing list