[MERGED] osmo-sgsn[master]: Fix display of GTP addresses

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Dec 5 17:29:01 UTC 2017


Max has submitted this change and it was merged.

Change subject: Fix display of GTP addresses
......................................................................


Fix display of GTP addresses

Previously we've tried to convert addresses manually which lead to
wrongly displayed GTP addresses (e. g. '4.0.0.0' instead of
'127.0.0.2'). Use libgtp function for conversion to fix it.

Change-Id: I695a9c9497d675564a088b002299096e0dcd267d
---
M src/gprs/sgsn_vty.c
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index c8dfc43..e9ce199 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -431,12 +431,12 @@
 
 char *sgsn_gtp_ntoa(struct ul16_t *ul)
 {
-	if (ul->l == 4) {
-		struct in_addr *ia = (struct in_addr *) ul;
-		return inet_ntoa(*ia);
-	} else {
+	struct in_addr ia;
+
+	if (gsna2in_addr(&ia, ul) != 0)
 		return "UNKNOWN";
-	}
+
+	return inet_ntoa(ia);
 }
 
 static void vty_dump_pdp(struct vty *vty, const char *pfx,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I695a9c9497d675564a088b002299096e0dcd267d
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
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list