pespin has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/54/41854/1

diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 6eddba0..6d4eda5 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>
@@ -215,6 +216,20 @@
        return conn;
 }

+static void ipaccess_bsc_srv_conn_set_name(struct osmo_stream_srv *conn,
+                                          struct e1inp_ts *e1i_ts,
+                                          enum e1inp_sign_type sign_type,
+                                          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(sign_type));
+       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
@@ -283,6 +298,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, bfd->priv_nr, 
&unit_data);

                if (!line->ops->sign_link_up) {
                        LOGPITS(e1i_ts, DLINP, LOGL_ERROR, "Unable to set 
signal link, closing socket.\n");
@@ -761,7 +777,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, E1INP_SIGN_OML, 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);
@@ -815,7 +831,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, E1INP_SIGN_RSL, 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: newchange
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I79f68e82420a59e1490d4959ad4996e4b40a16f8
Gerrit-Change-Number: 41854
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to