sctp: Add VTY command to print details about active SCTP connections
This will print details about each SCTP connection including the
FD and pointer of it.
diff --git a/src/vty_interface_cmds.c b/src/vty_interface_cmds.c
index 56b8ada..8c4d71d 100644
--- a/src/vty_interface_cmds.c
+++ b/src/vty_interface_cmds.c
@@ -253,15 +253,32 @@
return CMD_SUCCESS;
}
-DEFUN(show_sctp, show_sctp_cmd,
- "show sctp-connections",
- SHOW_STR "Active SCTP connections\n")
+DEFUN(show_sctp_count, show_sctp_count_cmd,
+ "show sctp-connections count",
+ SHOW_STR "Number of SCTP connections\n")
{
int count = sctp_m2ua_conn_count(bsc->m2ua_trans);
vty_out(vty, "Active SCTP connections are: %d.%s", count, VTY_NEWLINE);
return CMD_SUCCESS;
}
+DEFUN(show_sctp_details, show_sctp_details_cmd,
+ "show sctp-connections details",
+ SHOW_STR "Details of SCTP connections\n")
+{
+ struct sctp_m2ua_conn *conn;
+
+ llist_for_each_entry(conn, &bsc->m2ua_trans->conns, entry) {
+ vty_out(vty,
+ "SCTP Conn ASP UP: %d, ident: %d,%d,%d,%d fd: %d ptr: %p.%s",
+ conn->asp_up, conn->asp_ident[0], conn->asp_ident[1],
+ conn->asp_ident[2], conn->asp_ident[3],
+ conn->queue.bfd.fd, conn, VTY_NEWLINE);
+ }
+
+ return CMD_WARNING;
+}
+
void cell_vty_init_cmds(void)
{
/* special commands */
@@ -278,5 +295,6 @@
install_element_ve(&show_slc_cmd);
install_element_ve(&show_msc_cmd);
- install_element_ve(&show_sctp_cmd);
+ install_element_ve(&show_sctp_count_cmd);
+ install_element_ve(&show_sctp_details_cmd);
}