From 7f85acea9bb9f80e208820958f4cae63625f3689 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 9 May 2019 15:12:34 +0200 Subject: LOG_TRANS: store subsys in trans, unify USSD logging back to DMM Instead of calling trans_log_subsys() for each LOG_TRANS() log line, rather store in trans->log_subsys once on trans_alloc() and use that. Do not fall back to the RAN's own subsystem (DBSSAP / DIUCS), it makes little sense and may cause logging to switch subsystems depending on the RAN state. In trans_log_subsys(), add missing switch cases: - Log silent call transactions also on CC. - Log USSD on DMM. About USSD: we currently have no dedicated USSD logging category. As a result, after LOG_TRANS() was introduced [1], USSD logged on DBSSAP/DIUCS or DMSC, depending on whether a RAN was associated with the trans or not. Before that change, USSD always logged on DMM, so, until we have a separate logging category for USSD, consistenly use DMM again. [1] in I2e60964d7a3c06d051debd1c707051a0eb3101ba / ff7074a0c7b62025473d8f1a950905ac2cb2f31c Related: coverity CID 198453 Change-Id: I6dfe5b98fb9e884c2dde61d603832dafceb12123 --- include/osmocom/msc/transaction.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include/osmocom/msc') diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h index 99aca55ef..6b82390e5 100644 --- a/include/osmocom/msc/transaction.h +++ b/include/osmocom/msc/transaction.h @@ -27,7 +27,7 @@ struct vty; ##args) #define LOG_TRANS(trans, level, fmt, args...) \ - LOG_TRANS_CAT(trans, trans_log_subsys(trans), level, fmt, ##args) + LOG_TRANS_CAT(trans, (trans)->log_subsys, level, fmt, ##args) enum bridge_state { BRIDGE_STATE_NONE, @@ -60,6 +60,8 @@ struct gsm_trans { /* What kind of transaction */ enum trans_type type; + /* Which category to log on, for LOG_TRANS(). */ + int log_subsys; /* The current transaction ID */ uint8_t transaction_id; @@ -161,13 +163,17 @@ static inline int trans_log_subsys(const struct gsm_trans *trans) return DMSC; switch (trans->type) { case TRANS_CC: + case TRANS_SILENT_CALL: return DCC; case TRANS_SMS: return DLSMS; + case TRANS_USSD: + /* FIXME: traditionally (before LOG_TRANS() was added in I2e60964d7a3c06d051debd1c707051a0eb3101ba / + * ff7074a0c7b62025473d8f1a950905ac2cb2f31c), all USSD logging happened on DMM. Instead, it probably + * deserves its own logging subsystem. */ + return DMM; default: break; } - if (trans->msc_a) - return trans->msc_a->c.ran->log_subsys; return DMSC; } -- cgit v1.2.3