Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/12626 )
Change subject: vty: make 'sh connect/transact' readable again ...................................................................... vty: make 'sh connect/transact' readable again After recent changes to vlr_subscr_name() result became variable-length which messes up old vty code. Fix this by moving it to the very end and adjusting headers as necessary. While at it, make sure we don't print headers if we have nothing else to show. Change-Id: Id06b4277ff790d95457d0cc2f94ef6bf5366bb21 --- M src/libmsc/msc_vty.c 1 file changed, 24 insertions(+), 9 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c index 1fdf560..93d093f 100644 --- a/src/libmsc/msc_vty.c +++ b/src/libmsc/msc_vty.c @@ -550,15 +550,21 @@ static void vty_conn_hdr(struct vty *vty) { - vty_out(vty, "--ConnId ------------Subscriber RAN --LAC Use --Tokens C A5 State%s", - VTY_NEWLINE); + unsigned lnum = 0; + struct ran_conn *conn; + + llist_for_each_entry(conn, &gsmnet->ran_conns, entry) + lnum++; + + if (lnum) + vty_out(vty, "--ConnId RAN --LAC Use --Tokens C A5 State ------------ Subscriber%s", + VTY_NEWLINE); } static void vty_dump_one_conn(struct vty *vty, const struct ran_conn *conn) { - vty_out(vty, "%08x %22s %3s %5u %3u %08x %c /%1u %27s %s", + vty_out(vty, "%08x %3s %5u %3u %08x %c /%1u %27s %22s%s", conn->a.conn_id, - conn->vsub ? vlr_subscr_name(conn->vsub) : "-", conn->via_ran == OSMO_RAT_UTRAN_IU ? "Iu" : "A", conn->lac, conn->use_count, @@ -566,6 +572,7 @@ conn->received_cm_service_request ? 'C' : '-', conn->geran_encr.alg_id, conn->fi ? osmo_fsm_inst_state_name(conn->fi) : "-", + conn->vsub ? vlr_subscr_name(conn->vsub) : "-", VTY_NEWLINE); } @@ -583,8 +590,15 @@ static void vty_trans_hdr(struct vty *vty) { - vty_out(vty, "------------Subscriber --ConnId -P TI -CallRef Proto%s", - VTY_NEWLINE); + unsigned lnum = 0; + struct gsm_trans *trans; + + llist_for_each_entry(trans, &gsmnet->trans_list, entry) + lnum++; + + if (lnum) + vty_out(vty, "--ConnId -P TI -CallRef [--- Proto ---] ------------ Subscriber%s", + VTY_NEWLINE); } static const char *get_trans_proto_str(const struct gsm_trans *trans) @@ -613,13 +627,14 @@ static void vty_dump_one_trans(struct vty *vty, const struct gsm_trans *trans) { - vty_out(vty, "%22s %08x %s %02u %08x %s%s", - trans->vsub ? vlr_subscr_name(trans->vsub) : "-", + vty_out(vty, "%08x %s %02u %08x [%s] %22s%s", trans->conn ? trans->conn->a.conn_id : 0, gsm48_pdisc_name(trans->protocol), trans->transaction_id, trans->callref, - get_trans_proto_str(trans), VTY_NEWLINE); + get_trans_proto_str(trans), + trans->vsub ? vlr_subscr_name(trans->vsub) : "-", + VTY_NEWLINE); } DEFUN(show_msc_transaction, show_msc_transaction_cmd, -- To view, visit https://gerrit.osmocom.org/12626 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Id06b4277ff790d95457d0cc2f94ef6bf5366bb21 Gerrit-Change-Number: 12626 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msur...@sysmocom.de> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>