pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/28886 )
Change subject: cbsp/sbcap: Set link fsm id with peer's name ......................................................................
cbsp/sbcap: Set link fsm id with peer's name
Otherwise the id is left unset.
Change-Id: I8a6850293cbe01c66e4fb545d646d63743ddaecb --- M src/cbsp_link.c M src/sbcap_link.c 2 files changed, 10 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified dexter: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
diff --git a/src/cbsp_link.c b/src/cbsp_link.c index 564e134..564df3f 100644 --- a/src/cbsp_link.c +++ b/src/cbsp_link.c @@ -41,6 +41,7 @@ struct cbc_cbsp_link *cbc_cbsp_link_alloc(struct cbc_cbsp_mgr *cbc, struct cbc_peer *peer) { struct cbc_cbsp_link *link; + char *name;
link = talloc_zero(cbc, struct cbc_cbsp_link); OSMO_ASSERT(link); @@ -48,12 +49,15 @@ link->peer = peer; link->is_client = (peer->link_mode == CBC_PEER_LINK_MODE_CLIENT);
- link->fi = osmo_fsm_inst_alloc(&cbsp_link_fsm, link, link, LOGL_DEBUG, NULL); + name = talloc_strdup(link, peer->name); + osmo_identifier_sanitize_buf(name, NULL, '_'); + link->fi = osmo_fsm_inst_alloc(&cbsp_link_fsm, link, link, LOGL_DEBUG, name); if (!link->fi) { LOGPCC(link, LOGL_ERROR, "Unable to allocate FSM\n"); talloc_free(link); return NULL; } + talloc_free(name);
llist_add_tail(&link->list, &cbc->links); return link; diff --git a/src/sbcap_link.c b/src/sbcap_link.c index 9af842f..3f5d792 100644 --- a/src/sbcap_link.c +++ b/src/sbcap_link.c @@ -46,6 +46,7 @@ struct cbc_sbcap_link *cbc_sbcap_link_alloc(struct cbc_sbcap_mgr *cbc, struct cbc_peer *peer) { struct cbc_sbcap_link *link; + char *name;
link = talloc_zero(cbc, struct cbc_sbcap_link); OSMO_ASSERT(link); @@ -53,12 +54,15 @@ link->peer = peer; link->is_client = (peer->link_mode == CBC_PEER_LINK_MODE_CLIENT);
- link->fi = osmo_fsm_inst_alloc(&sbcap_link_fsm, link, link, LOGL_DEBUG, NULL); + name = talloc_strdup(link, peer->name); + osmo_identifier_sanitize_buf(name, NULL, '_'); + link->fi = osmo_fsm_inst_alloc(&sbcap_link_fsm, link, link, LOGL_DEBUG, name); if (!link->fi) { LOGPSBCAPC(link, LOGL_ERROR, "Unable to allocate FSM\n"); talloc_free(link); return NULL; } + talloc_free(name);
llist_add_tail(&link->list, &cbc->links); return link;