m2ua: Print information about number of SCTP connections
It appears that it is possible to have a stale SCTP connection and this added LOGL_NOTICE and the VTY interface might help to identify this situation in the future (the mean time of failure is about five month).
This commit is contained in:
parent
c21c0d699f
commit
ab79b9b593
|
@ -80,4 +80,6 @@ struct mtp_m2ua_link *mtp_m2ua_link_create(struct sctp_m2ua_transport *transport
|
|||
|
||||
struct mtp_m2ua_link *mtp_m2ua_link_init(struct mtp_link *link);
|
||||
|
||||
int sctp_m2ua_conn_count(struct sctp_m2ua_transport *tran);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -130,3 +130,7 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,18 @@
|
|||
|
||||
#define SCTP_PPID_M2UA 2
|
||||
|
||||
|
||||
int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans)
|
||||
{
|
||||
int count = 0;
|
||||
struct sctp_m2ua_conn *conn;
|
||||
|
||||
llist_for_each_entry(conn, &trans->conns, entry)
|
||||
count += 1;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct mtp_m2ua_link *find_m2ua_link(struct sctp_m2ua_transport *trans, int link_index)
|
||||
{
|
||||
struct mtp_m2ua_link *link;
|
||||
|
@ -650,7 +662,7 @@ static int sctp_trans_accept(struct osmo_fd *fd, unsigned int what)
|
|||
struct sctp_m2ua_conn *conn;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t len;
|
||||
int s, ret;
|
||||
int s, ret, count;
|
||||
|
||||
len = sizeof(addr);
|
||||
s = accept(fd->fd, (struct sockaddr *) &addr, &len);
|
||||
|
@ -700,6 +712,10 @@ static int sctp_trans_accept(struct osmo_fd *fd, unsigned int what)
|
|||
}
|
||||
|
||||
llist_add_tail(&conn->entry, &trans->conns);
|
||||
|
||||
|
||||
count = sctp_m2ua_conn_count(trans);
|
||||
LOGP(DINP, LOGL_NOTICE, "Now having %d SCTP connection(s).\n", count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <bsc_data.h>
|
||||
#include <mtp_pcap.h>
|
||||
#include <msc_connection.h>
|
||||
#include <sctp_m2ua.h>
|
||||
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
|
||||
|
@ -252,6 +253,15 @@ DEFUN(allow_inject, allow_inject_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(show_sctp, show_sctp_cmd,
|
||||
"show sctp-connections",
|
||||
SHOW_STR "Active 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;
|
||||
}
|
||||
|
||||
void cell_vty_init_cmds(void)
|
||||
{
|
||||
/* special commands */
|
||||
|
@ -268,4 +278,5 @@ void cell_vty_init_cmds(void)
|
|||
install_element_ve(&show_slc_cmd);
|
||||
|
||||
install_element_ve(&show_msc_cmd);
|
||||
install_element_ve(&show_sctp_cmd);
|
||||
}
|
||||
|
|
Reference in New Issue