Introduce SCTP log category

Change-Id: I2c9cb54958807bd68c04a4c0d3a0f355dd641282
This commit is contained in:
Pau Espin 2021-11-23 13:26:46 +01:00
parent 4310b0d57a
commit 9828dbed18
3 changed files with 14 additions and 8 deletions

View File

@ -32,6 +32,7 @@ enum {
DHNBAP, DHNBAP,
DRUA, DRUA,
DRANAP, DRANAP,
DSCTP,
DNAS, DNAS,
}; };
extern const struct log_info hnb_log_info; extern const struct log_info hnb_log_info;

View File

@ -42,6 +42,11 @@ static const struct log_info_cat log_cat[] = {
.color = "\033[1;35m", .color = "\033[1;35m",
.description = "RANAP User Adaptation", .description = "RANAP User Adaptation",
}, },
[DSCTP] = {
.name = "DSCTP", .loglevel = LOGL_NOTICE, .enabled = 1,
.color = "\033[1;36m",
.description = "SCTP connection on the Iuh link",
},
[DNAS] = { [DNAS] = {
.name = "NAS", .loglevel = LOGL_NOTICE, .enabled = 1, .name = "NAS", .loglevel = LOGL_NOTICE, .enabled = 1,
.color = "\033[1;32m", .color = "\033[1;32m",

View File

@ -52,12 +52,12 @@ static int hnb_iuh_read_cb(struct osmo_stream_cli *conn)
rc = sctp_recvmsg(fd->fd, msgb_data(msg), msgb_tailroom(msg), rc = sctp_recvmsg(fd->fd, msgb_data(msg), msgb_tailroom(msg),
NULL, NULL, &sinfo, &flags); NULL, NULL, &sinfo, &flags);
if (rc < 0) { if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Error during sctp_recvmsg()\n"); LOGP(DSCTP, LOGL_ERROR, "Error during sctp_recvmsg()\n");
/* FIXME: clean up after disappeared HNB */ /* FIXME: clean up after disappeared HNB */
osmo_stream_cli_close(conn); osmo_stream_cli_close(conn);
goto free_ret; goto free_ret;
} else if (rc == 0) { } else if (rc == 0) {
LOGP(DMAIN, LOGL_INFO, "Connection to HNBGW closed\n"); LOGP(DSCTP, LOGL_INFO, "Connection to HNBGW closed\n");
osmo_stream_cli_close(conn); osmo_stream_cli_close(conn);
rc = -1; rc = -1;
goto free_ret; goto free_ret;
@ -66,7 +66,7 @@ static int hnb_iuh_read_cb(struct osmo_stream_cli *conn)
} }
if (flags & MSG_NOTIFICATION) { if (flags & MSG_NOTIFICATION) {
LOGP(DMAIN, LOGL_DEBUG, "Ignoring SCTP notification\n"); LOGP(DSCTP, LOGL_DEBUG, "Ignoring SCTP notification\n");
rc = 0; rc = 0;
goto free_ret; goto free_ret;
} }
@ -85,12 +85,12 @@ static int hnb_iuh_read_cb(struct osmo_stream_cli *conn)
case IUH_PPI_SABP: case IUH_PPI_SABP:
case IUH_PPI_RNA: case IUH_PPI_RNA:
case IUH_PPI_PUA: case IUH_PPI_PUA:
LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%u received\n", LOGP(DSCTP, LOGL_ERROR, "Unimplemented SCTP PPID=%u received\n",
sinfo.sinfo_ppid); sinfo.sinfo_ppid);
rc = 0; rc = 0;
break; break;
default: default:
LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%u received\n", LOGP(DSCTP, LOGL_ERROR, "Unknown SCTP PPID=%u received\n",
sinfo.sinfo_ppid); sinfo.sinfo_ppid);
rc = 0; rc = 0;
break; break;
@ -103,7 +103,7 @@ free_ret:
static int hnb_iuh_connect_cb(struct osmo_stream_cli *conn) static int hnb_iuh_connect_cb(struct osmo_stream_cli *conn)
{ {
LOGP(DMAIN, LOGL_NOTICE, "Iuh connected to HNBGW\n"); LOGP(DSCTP, LOGL_NOTICE, "Iuh connected to HNBGW\n");
struct hnb *hnb = osmo_stream_cli_get_data(conn); struct hnb *hnb = osmo_stream_cli_get_data(conn);
hnb_send_register_req(hnb); hnb_send_register_req(hnb);
@ -142,7 +142,7 @@ int hnb_iuh_connect(struct hnb *hnb)
{ {
int rc; int rc;
LOGP(DMAIN, LOGL_INFO, "Iuh Connect: %s[:%u] => %s[:%u]\n", LOGP(DSCTP, LOGL_INFO, "Iuh Connect: %s[:%u] => %s[:%u]\n",
hnb->iuh.local_addr, hnb->iuh.local_port, hnb->iuh.remote_addr, hnb->iuh.remote_port); hnb->iuh.local_addr, hnb->iuh.local_port, hnb->iuh.remote_addr, hnb->iuh.remote_port);
osmo_stream_cli_set_addrs(hnb->iuh.client, (const char **)&hnb->iuh.remote_addr, 1); osmo_stream_cli_set_addrs(hnb->iuh.client, (const char **)&hnb->iuh.remote_addr, 1);
@ -151,7 +151,7 @@ int hnb_iuh_connect(struct hnb *hnb)
osmo_stream_cli_set_local_port(hnb->iuh.client, hnb->iuh.local_port); osmo_stream_cli_set_local_port(hnb->iuh.client, hnb->iuh.local_port);
rc = osmo_stream_cli_open(hnb->iuh.client); rc = osmo_stream_cli_open(hnb->iuh.client);
if (rc < 0) { if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Unable to open stream client for Iuh %s[:%u] => %s[:%u]\n", LOGP(DSCTP, LOGL_ERROR, "Unable to open stream client for Iuh %s[:%u] => %s[:%u]\n",
hnb->iuh.local_addr, hnb->iuh.local_port, hnb->iuh.remote_addr, hnb->iuh.remote_port); hnb->iuh.local_addr, hnb->iuh.local_port, hnb->iuh.remote_addr, hnb->iuh.remote_port);
/* we don't return error in here because osmo_stream_cli_open() /* we don't return error in here because osmo_stream_cli_open()
will continue to retry (due to timeout being explicitly set with will continue to retry (due to timeout being explicitly set with