Change in ...osmo-ggsn[master]: ggsn_vty.c: Fix wrong use of in46a_from_eua, print IPv6 euas

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 29 05:26:39 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/15248 )

Change subject: ggsn_vty.c: Fix wrong use of in46a_from_eua, print IPv6 euas
......................................................................

ggsn_vty.c: Fix wrong use of in46a_from_eua, print IPv6 euas

in46a_from_eua() API documentation clearly states an array of 2 items
should be passed as pointer, but show_one_pdp() was passing only one,
which would end up in out-of-bounds writes on v4v6 EUAs.

Let's better use ippool to print allocated ip addresses instead of
parsing EUAs we sent some point in the past.

Related OS#4154
Change-Id: Ia34939957bb7856388cb52a741cec0c015a08c70
---
M ggsn/ggsn_vty.c
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index eb7cca7..0a86f49 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -734,7 +734,7 @@
 
 static void show_one_pdp(struct vty *vty, struct pdp_t *pdp)
 {
-	struct in46_addr eua46;
+	struct ippoolm_t *peer;
 	char name_buf[256];
 	char *apn_name;
 	int rc;
@@ -757,8 +757,12 @@
 	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);
+	if ((peer = pdp_get_peer_ipv(pdp, false)))
+		vty_out(vty, " End-User Address (IPv4): %s%s",
+			in46a_ntop(&peer->addr, name_buf, sizeof(name_buf)), VTY_NEWLINE);
+	if ((peer = pdp_get_peer_ipv(pdp, true)))
+		vty_out(vty, " End-User Address (IPv6): %s%s",
+			in46a_ntop(&peer->addr, name_buf, sizeof(name_buf)), VTY_NEWLINE);
 	vty_out(vty, " Transmit GTP Sequence Number for G-PDU: %s%s",
 		pdp->tx_gpdu_seq ? "Yes" : "No", VTY_NEWLINE);
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/15248
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia34939957bb7856388cb52a741cec0c015a08c70
Gerrit-Change-Number: 15248
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190829/1ac3a1da/attachment.html>


More information about the gerrit-log mailing list