aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-07-12 04:59:34 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-07-16 16:24:26 +0200
commit645bdf0b1a3a8e155c0e54d4f4502fc41539e1f7 (patch)
tree10895a3ba071e697ca54b2b641822dfa13a8c299
parentd6f9965b8c1bbd7bb5693451fbe668260e2ef270 (diff)
vty: fix 'show lchan'
In the vty, do not show lchan info for uninitialized lchans. For lchan->fi == NULL, lchan_state_is(UNUSED) returned false, and hence the vty interpreted all lchans as interesting. Change-Id: Iec855f1bbecfe5600fc943d815623e73dd70ff6a
-rw-r--r--include/osmocom/bsc/lchan_fsm.h3
-rw-r--r--src/osmo-bsc/bsc_vty.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/include/osmocom/bsc/lchan_fsm.h b/include/osmocom/bsc/lchan_fsm.h
index a69890bb2..e5b093340 100644
--- a/include/osmocom/bsc/lchan_fsm.h
+++ b/include/osmocom/bsc/lchan_fsm.h
@@ -81,7 +81,8 @@ static inline const char *lchan_state_name(struct gsm_lchan *lchan)
static inline bool lchan_state_is(struct gsm_lchan *lchan, uint32_t state)
{
- return lchan->fi && lchan->fi->state == state;
+ return (!lchan->fi && state == LCHAN_ST_UNUSED)
+ || (lchan->fi && lchan->fi->state == state);
}
bool lchan_may_receive_data(struct gsm_lchan *lchan);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index e068db6c6..32b139f4d 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1345,10 +1345,9 @@ static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty,
void (*dump_cb)(struct vty *, struct gsm_lchan *))
{
- int lchan_nr;
- for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) {
- struct gsm_lchan *lchan = &ts->lchan[lchan_nr];
- if ((lchan->type == GSM_LCHAN_NONE) && lchan_state_is(lchan, LCHAN_ST_UNUSED))
+ struct gsm_lchan *lchan;
+ ts_for_each_lchan(lchan, ts) {
+ if (lchan_state_is(lchan, LCHAN_ST_UNUSED))
continue;
dump_cb(vty, lchan);
}