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
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index 99aca55..6b82390 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -27,7 +27,7 @@
##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 @@
/* 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 @@
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;
}