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 uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21400 )
Change subject: gprs_ns2: Give NS-VC FSMs a proper name/identifier
......................................................................
gprs_ns2: Give NS-VC FSMs a proper name/identifier
Log output without a proper identifier is mostly useless.
Change-Id: Id9d5b0684584d03685900c6298fe70246793de14
Closes: OS#4876
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_fr.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_udp.c
4 files changed, 20 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/21400/1
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 30716fc..759df3c 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -495,8 +495,10 @@
* \param[in] bind The 'bind' on which we operate
* \param[in] nse The NS Entity on which we operate
* \param[in] initiater - if this is an incoming remote (!initiater) or a local outgoing connection (initater)
+ * \param[in] id - human-readable identifier
* \return newly allocated NS-VC on success; NULL on error */
-struct gprs_ns2_vc *ns2_vc_alloc(struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater)
+struct gprs_ns2_vc *ns2_vc_alloc(struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater,
+ const char *id)
{
struct gprs_ns2_vc *nsvc = talloc_zero(bind, struct gprs_ns2_vc);
@@ -516,7 +518,7 @@
nsvc->statg = osmo_stat_item_group_alloc(nsvc, &nsvc_statg_desc, bind->nsi->rate_ctr_idx);
if (!nsvc->statg)
goto err_group;
- if (!gprs_ns2_vc_fsm_alloc(nsvc, NULL, initiater))
+ if (!gprs_ns2_vc_fsm_alloc(nsvc, id, initiater))
goto err_statg;
bind->nsi->rate_ctr_idx++;
@@ -771,6 +773,7 @@
struct gprs_ns2_nse *nse;
uint16_t nsvci;
uint16_t nsei;
+ char idbuf[32];
int rc;
@@ -852,11 +855,13 @@
}
}
- nsvc = ns2_vc_alloc(bind, nse, false);
+ nsvci = tlvp_val16be(&tp, NS_IE_VCI);
+ snprintf(idbuf, sizeof(idbuf), "%s-NSEI%u-NSVCI%u", gprs_ns2_lltype_str(nse->ll),
+ nse->nsei, nsvci);
+ nsvc = ns2_vc_alloc(bind, nse, false, idbuf);
if (!nsvc)
return GPRS_NS2_CS_SKIPPED;
- nsvci = tlvp_val16be(&tp, NS_IE_VCI);
nsvc->nsvci = nsvci;
nsvc->nsvci_is_valid = true;
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 80e3366..7e826a9 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -465,9 +465,12 @@
uint16_t nsvci,
uint16_t dlci)
{
+ char idbuf[64];
bool created_nse = false;
struct gprs_ns2_vc *nsvc = NULL;
struct priv_vc *priv = NULL;
+ struct priv_bind *bpriv = bind->priv;
+
struct gprs_ns2_nse *nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei);
if (!nse) {
nse = gprs_ns2_create_nse(bind->nsi, nsei, GPRS_NS2_LL_FR);
@@ -481,7 +484,9 @@
goto err_nse;
}
- nsvc = ns2_vc_alloc(bind, nse, true);
+ snprintf(idbuf, sizeof(idbuf), "%s-%s-DLCI%u-NSEI%u-NSVCI%u", gprs_ns2_lltype_str(nse->ll),
+ bpriv->netif, dlci, nse->nsei, nsvci);
+ nsvc = ns2_vc_alloc(bind, nse, true, idbuf);
if (!nsvc)
goto err_nse;
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 08ffac2..a1b6a49 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -218,7 +218,7 @@
struct gprs_ns2_vc *ns2_vc_alloc(struct gprs_ns2_vc_bind *bind,
struct gprs_ns2_nse *nse,
- bool initiater);
+ bool initiater, const char *id);
struct msgb *gprs_ns2_msgb_alloc(void);
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 7f82667..07209b5 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -378,8 +378,11 @@
{
struct gprs_ns2_vc *nsvc;
struct priv_vc *priv;
+ char idbuf[64];
- nsvc = ns2_vc_alloc(bind, nse, true);
+ snprintf(idbuf, sizeof(idbuf), "%s-NSEI%u-remmote-%s)", gprs_ns2_lltype_str(nse->ll),
+ nse->nsei, osmo_sockaddr_to_str(remote));
+ nsvc = ns2_vc_alloc(bind, nse, true, idbuf);
if (!nsvc)
return NULL;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21400
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id9d5b0684584d03685900c6298fe70246793de14
Gerrit-Change-Number: 21400
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201129/331b8d32/attachment.htm>