Change in osmo-msc[master]: vty: make 'sh connect/transact' readable again

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Jan 17 18:27:17 UTC 2019


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



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/26/12626/1

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: newchange
Gerrit-Change-Id: Id06b4277ff790d95457d0cc2f94ef6bf5366bb21
Gerrit-Change-Number: 12626
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190117/771fc159/attachment.htm>


More information about the gerrit-log mailing list