mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
nat: Provide statistics about amount of different messages.
Provide simple statistics on how many LUs, Paging Responses etc. we are seeing in the network.
This commit is contained in:
@@ -99,6 +99,10 @@ enum bsc_cfg_ctr {
|
||||
BCFG_CTR_REJECTED_CR,
|
||||
BCFG_CTR_REJECTED_MSG,
|
||||
BCFG_CTR_ILL_PACKET,
|
||||
BCFG_CTR_CON_TYPE_LU,
|
||||
BCFG_CTR_CON_CMSERV_RQ,
|
||||
BCFG_CTR_CON_PAG_RESP,
|
||||
BCFG_CTR_CON_OTHER,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -296,4 +300,6 @@ struct bsc_nat_acc_lst_entry *bsc_nat_acc_lst_entry_create(struct bsc_nat_acc_ls
|
||||
|
||||
int bsc_nat_msc_is_connected(struct bsc_nat *nat);
|
||||
|
||||
int bsc_conn_type_to_ctr(struct sccp_connections *conn);
|
||||
|
||||
#endif
|
||||
|
@@ -758,6 +758,21 @@ static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc
|
||||
bsc->write_queue.bfd.fd);
|
||||
}
|
||||
|
||||
static void handle_con_stats(struct sccp_connections *con)
|
||||
{
|
||||
struct rate_ctr_group *ctrg;
|
||||
int id = bsc_conn_type_to_ctr(con);
|
||||
|
||||
if (id == -1)
|
||||
return;
|
||||
|
||||
if (!con->bsc || !con->bsc->cfg)
|
||||
return;
|
||||
|
||||
ctrg = con->bsc->cfg->stats.ctrg;
|
||||
rate_ctr_inc(&ctrg->ctr[id]);
|
||||
}
|
||||
|
||||
static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
|
||||
{
|
||||
int con_filter = 0;
|
||||
@@ -809,6 +824,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
|
||||
con->con_type = con_type;
|
||||
con->imsi_checked = filter;
|
||||
con_bsc = con->bsc;
|
||||
handle_con_stats(con);
|
||||
break;
|
||||
case SCCP_MSG_TYPE_RLSD:
|
||||
case SCCP_MSG_TYPE_CREF:
|
||||
|
@@ -40,7 +40,6 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
static const struct rate_ctr_desc bsc_cfg_ctr_description[] = {
|
||||
[BCFG_CTR_SCCP_CONN] = { "sccp.conn", "SCCP Connections "},
|
||||
[BCFG_CTR_SCCP_CALLS] = { "sccp.calls", "SCCP Assignment Commands "},
|
||||
@@ -50,6 +49,10 @@ static const struct rate_ctr_desc bsc_cfg_ctr_description[] = {
|
||||
[BCFG_CTR_REJECTED_CR] = { "rejected.cr", "Rejected CR due filter "},
|
||||
[BCFG_CTR_REJECTED_MSG] = { "rejected.msg", "Rejected MSG due filter "},
|
||||
[BCFG_CTR_ILL_PACKET] = { "rejected.ill", "Rejected due parse error "},
|
||||
[BCFG_CTR_CON_TYPE_LU] = { "conn.lu", "Conn Location Update "},
|
||||
[BCFG_CTR_CON_CMSERV_RQ] = { "conn.rq", "Conn CM Service Req "},
|
||||
[BCFG_CTR_CON_PAG_RESP] = { "conn.pag", "Conn Paging Response "},
|
||||
[BCFG_CTR_CON_OTHER] = { "conn.other", "Conn Other "},
|
||||
};
|
||||
|
||||
static const struct rate_ctr_group_desc bsc_cfg_ctrg_desc = {
|
||||
@@ -609,3 +612,17 @@ int bsc_nat_msc_is_connected(struct bsc_nat *nat)
|
||||
{
|
||||
return nat->msc_con->is_connected;
|
||||
}
|
||||
|
||||
static const int con_to_ctr[] = {
|
||||
[NAT_CON_TYPE_NONE] = -1,
|
||||
[NAT_CON_TYPE_LU] = BCFG_CTR_CON_TYPE_LU,
|
||||
[NAT_CON_TYPE_CM_SERV_REQ] = BCFG_CTR_CON_CMSERV_RQ,
|
||||
[NAT_CON_TYPE_PAG_RESP] = BCFG_CTR_CON_PAG_RESP,
|
||||
[NAT_CON_TYPE_LOCAL_REJECT] = -1,
|
||||
[NAT_CON_TYPE_OTHER] = BCFG_CTR_CON_OTHER,
|
||||
};
|
||||
|
||||
int bsc_conn_type_to_ctr(struct sccp_connections *conn)
|
||||
{
|
||||
return con_to_ctr[conn->con_type];
|
||||
}
|
||||
|
Reference in New Issue
Block a user