pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/41854?usp=email )

Change subject: ipaccess: Add ipa_unit_data to logging context of bsc ipaccess 
srv stream
......................................................................

ipaccess: Add ipa_unit_data to logging context of bsc ipaccess srv stream

Related: SYS#7831
Change-Id: I79f68e82420a59e1490d4959ad4996e4b40a16f8
---
M src/input/ipaccess.c
1 file changed, 18 insertions(+), 2 deletions(-)

Approvals:
  osmith: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 7329d37..cf04538 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -45,6 +45,7 @@
 #include <osmocom/core/logging.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/socket.h>
+#include <osmocom/core/utils.h>
 #include <osmocom/core/backtrace.h>
 #include <osmocom/core/stats_tcp.h>
 #include <osmocom/core/fsm.h>
@@ -207,6 +208,20 @@
        return conn;
 }

+static void ipaccess_bsc_srv_conn_set_name(struct osmo_stream_srv *conn,
+                                          struct e1inp_ts *e1i_ts,
+                                          const struct ipaccess_unit 
*unit_data)
+{
+       char buf[256];
+       struct osmo_strbuf sb = { .buf = buf, .len = sizeof(buf) };
+
+       OSMO_STRBUF_PRINTF(sb, "ts-%u-%u-%s", e1i_ts->line->num, e1i_ts->num,
+                          
e1inp_signtype_name(ipaccess_e1i_ts_sign_type(e1i_ts)));
+       if (unit_data)
+               OSMO_STRBUF_PRINTF(sb, ",ipa-unit-%u/%u/%u", 
unit_data->site_id, unit_data->bts_id, unit_data->trx_id);
+       osmo_stream_srv_set_name(conn, buf);
+}
+
 static int ipaccess_bsc_write_cb(struct e1inp_ts *e1i_ts);

 /* Returns -1 on error, and 0 or 1 on success. If -1 or 1 is returned, line has
@@ -275,6 +290,7 @@
                        LOGPITS(e1i_ts, DLINP, LOGL_ERROR, "Failed to parse 
unit ID '%s'\n", unitid);
                        goto err;
                }
+               ipaccess_bsc_srv_conn_set_name(conn, e1i_ts, &unit_data);

                if (!line->ops->sign_link_up) {
                        LOGPITS(e1i_ts, DLINP, LOGL_ERROR, "Unable to set 
signal link, closing socket.\n");
@@ -753,7 +769,7 @@
        snprintf(conn_name, sizeof(conn_name), "ts-%u-%u-oml", line->num, 
e1i_ts->num);
        conn = osmo_stream_srv_create2(link, link, fd, e1i_ts);
        OSMO_ASSERT(conn);
-       osmo_stream_srv_set_name(conn, conn_name);
+       ipaccess_bsc_srv_conn_set_name(conn, e1i_ts, NULL);
        osmo_stream_srv_set_read_cb(conn, ipaccess_bsc_conn_read_cb);
        osmo_stream_srv_set_closed_cb(conn, ipaccess_bsc_conn_closed_cb);
        osmo_stream_srv_set_segmentation_cb(conn, osmo_ipa_segmentation_cb);
@@ -807,7 +823,7 @@
        snprintf(conn_name, sizeof(conn_name), "ts-%u-%u-rsl", line->num, 
e1i_ts->num);
        conn = osmo_stream_srv_create2(link, link, fd, e1i_ts);
        OSMO_ASSERT(conn);
-       osmo_stream_srv_set_name(conn, conn_name);
+       ipaccess_bsc_srv_conn_set_name(conn, e1i_ts, NULL);
        osmo_stream_srv_set_read_cb(conn, ipaccess_bsc_conn_read_cb);
        osmo_stream_srv_set_closed_cb(conn, ipaccess_bsc_conn_closed_cb);
        osmo_stream_srv_set_segmentation_cb(conn, osmo_ipa_segmentation_cb);

--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/41854?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I79f68e82420a59e1490d4959ad4996e4b40a16f8
Gerrit-Change-Number: 41854
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to