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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20393 ) Change subject: ns2: vty: on `show ns` add information of NS binds ...................................................................... ns2: vty: on `show ns` add information of NS binds Change-Id: I6cef42749555e577d5573f2ed8b8bce4cf842a98 --- M src/gb/gprs_ns2_internal.h M src/gb/gprs_ns2_udp.c M src/gb/gprs_ns2_vty.c 3 files changed, 44 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h index 3d0f96d..f5d9ed5 100644 --- a/src/gb/gprs_ns2_internal.h +++ b/src/gb/gprs_ns2_internal.h @@ -192,8 +192,11 @@ /*! free the vc priv data */ void (*free_vc)(struct gprs_ns2_vc *nsvc); -}; + /*! allow to show information for the vty */ + void (*dump_vty)(const struct gprs_ns2_vc_bind *bind, + struct vty *vty, bool stats); +}; struct gprs_ns2_vc_driver { const char *name; diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c index 251f869..3ce0508 100644 --- a/src/gb/gprs_ns2_udp.c +++ b/src/gb/gprs_ns2_udp.c @@ -78,6 +78,34 @@ nsvc->priv = NULL; } +static void dump_vty(const struct gprs_ns2_vc_bind *bind, + struct vty *vty, bool _stats) +{ + struct priv_bind *priv; + struct gprs_ns2_vc *nsvc; + struct osmo_sockaddr_str sockstr = {}; + unsigned long nsvcs = 0; + + if (!bind) + return; + + priv = bind->priv; + if (osmo_sockaddr_str_from_sockaddr(&sockstr, &priv->addr.u.sas)) + strcpy(sockstr.ip, "invalid"); + + llist_for_each_entry(nsvc, &bind->nsvc, blist) { + nsvcs++; + } + + vty_out(vty, "UDP bind: %s:%d dcsp: %d%s", sockstr.ip, sockstr.port, priv->dscp, VTY_NEWLINE); + vty_out(vty, " %lu NS-VC: %s", nsvcs, VTY_NEWLINE); + + llist_for_each_entry(nsvc, &bind->nsvc, blist) { + vty_out(vty, " %s%s", gprs_ns2_ll_str(nsvc), VTY_NEWLINE); + } +} + + /*! Find a NS-VC by its remote socket address. * \param[in] bind in which to search * \param[in] saddr remote peer socket adddress to search @@ -262,6 +290,7 @@ bind->driver = &vc_driver_ip; bind->send_vc = nsip_vc_sendmsg; bind->free_vc = free_vc; + bind->dump_vty = dump_vty; bind->nsi = nsi; priv = bind->priv = talloc_zero(bind, struct priv_bind); diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c index 824466b..3decf4e 100644 --- a/src/gb/gprs_ns2_vty.c +++ b/src/gb/gprs_ns2_vty.c @@ -303,10 +303,21 @@ } } +static void dump_bind(struct vty *vty, const struct gprs_ns2_vc_bind *bind, bool stats) +{ + if (bind->dump_vty) + bind->dump_vty(bind, vty, stats); +} + static void dump_ns(struct vty *vty, const struct gprs_ns2_inst *nsi, bool stats, bool persistent_only) { + struct gprs_ns2_vc_bind *bind; struct gprs_ns2_nse *nse; + llist_for_each_entry(bind, &nsi->binding, list) { + dump_bind(vty, bind, stats); + } + llist_for_each_entry(nse, &nsi->nse, list) { dump_nse(vty, nse, stats, persistent_only); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20393 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I6cef42749555e577d5573f2ed8b8bce4cf842a98 Gerrit-Change-Number: 20393 Gerrit-PatchSet: 4 Gerrit-Owner: lynxis lazus <lynxis at fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201005/a92a72dc/attachment.htm>