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/.
keith gerrit-no-reply at lists.osmocom.orgkeith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/25649 )
Change subject: VTY: Don't display 'PDP Address: invalid' for IPv4v6
......................................................................
VTY: Don't display 'PDP Address: invalid' for IPv4v6
We were not handling the case of PDP_TYPE_N_IETF_IPv4v6
in gprs_pdpaddr2str() and showed "invalid" for these addresses.
Change-Id: Id36b7520677e4a0af40d05dc503b26d1b0b74a26
---
M include/osmocom/sgsn/gprs_sgsn.h
M src/sgsn/sgsn_vty.c
2 files changed, 24 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/49/25649/1
diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index c176494..dcda5c3 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -417,7 +417,7 @@
struct sgsn_instance *sgsn_instance_alloc(void *talloc_ctx);
void sgsn_inst_init(struct sgsn_instance *sgsn);
-char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len);
+char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len, bool return_ipv6);
/*
* ctrl interface related work
diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c
index e0e2677..85aebbc 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -135,9 +135,10 @@
return osmo_tdef_vty_set_cmd(vty, g_cfg->T_defs, argv);
}
-char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len)
+char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len, bool return_ipv6)
{
- static char str[INET6_ADDRSTRLEN + 10];
+ static char str[INET_ADDRSTRLEN + 10];
+ static char str_inet6[INET6_ADDRSTRLEN + 10];
if (!pdpa || len < 2)
return "none";
@@ -154,8 +155,20 @@
case PDP_TYPE_N_IETF_IPv6:
if (len < 2 + 8)
break;
- strcpy(str, "IPv6 ");
- inet_ntop(AF_INET6, pdpa+2, str+5, sizeof(str)-5);
+ strcpy(str_inet6, "IPv6 ");
+ inet_ntop(AF_INET6, pdpa+2, str_inet6+5, sizeof(str_inet6)-5);
+ return str_inet6;
+ case PDP_TYPE_N_IETF_IPv4v6:
+ if (len < 2 + 20)
+ break;
+ strcpy(str, "IPv4 ");
+ inet_ntop(AF_INET, pdpa+2, str+5, sizeof(str)-5);
+ /* The IPv6 token, (rightmost four fields) is a duplicate of
+ * the site prefix + subnetID (leftmost fields) in pdpa here */
+ strcpy(str_inet6, "IPv6 ");
+ inet_ntop(AF_INET6, pdpa+6, str_inet6+5, sizeof(str_inet6)-5);
+ if (return_ipv6)
+ return str_inet6;
return str;
default:
break;
@@ -552,8 +565,13 @@
osmo_apn_to_str(apnbuf, pdp->lib->apn_use.v, pdp->lib->apn_use.l),
VTY_NEWLINE);
vty_out(vty, "%s PDP Address: %s%s", pfx,
- gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l),
+ gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l, false),
VTY_NEWLINE);
+ if (pdp->lib->eua.v[1] == PDP_TYPE_N_IETF_IPv4v6) {
+ vty_out(vty, "%s PDP Address: %s%s", pfx,
+ gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l, true),
+ VTY_NEWLINE);
+ }
vty_out(vty, "%s GTPv%d Local Control(%s / TEIC: 0x%08x) ", pfx, pdp->lib->version,
sgsn_gtp_ntoa(&pdp->lib->gsnlc), pdp->lib->teic_own);
vty_out(vty, "Data(%s / TEID: 0x%08x)%s",
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/25649
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Id36b7520677e4a0af40d05dc503b26d1b0b74a26
Gerrit-Change-Number: 25649
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210929/ced49be1/attachment.htm>