diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-10-02 02:34:39 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-10-05 14:23:33 +0000 |
commit | 22f34710d9e4d237ae72fb1dd835c261c0652d87 (patch) | |
tree | f9643af0e9ea227111e2bd507036bd0333f65f2c /src/gb/gprs_ns2_udp.c | |
parent | 1fac6f7452d2aa6cb28b6af9858646c0badf60e4 (diff) |
ns2: vty: on `show ns` add information of NS binds
Change-Id: I6cef42749555e577d5573f2ed8b8bce4cf842a98
Diffstat (limited to 'src/gb/gprs_ns2_udp.c')
-rw-r--r-- | src/gb/gprs_ns2_udp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c index 251f869a..3ce05084 100644 --- a/src/gb/gprs_ns2_udp.c +++ b/src/gb/gprs_ns2_udp.c @@ -78,6 +78,34 @@ static void free_vc(struct gprs_ns2_vc *nsvc) 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 @@ int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi, 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); |