osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27467 )
Change subject: bsc_nat_fsm: tweak forwarding log messages ......................................................................
bsc_nat_fsm: tweak forwarding log messages
Shorten them and don't use the LOG_SCCP macro anymore that will be dropped in a follow-up patch. Change the level to DEBUG.
Related: SYS#5560 Change-Id: I85f65ad3c15a10958fbfe97aef00fc386e85ef63 --- M include/osmocom/bsc_nat/bsc_nat.h M src/osmo-bsc-nat/bsc_nat.c M src/osmo-bsc-nat/bsc_nat_fsm.c 3 files changed, 17 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc-nat refs/changes/67/27467/1
diff --git a/include/osmocom/bsc_nat/bsc_nat.h b/include/osmocom/bsc_nat/bsc_nat.h index a1e3da8..e014800 100644 --- a/include/osmocom/bsc_nat/bsc_nat.h +++ b/include/osmocom/bsc_nat/bsc_nat.h @@ -39,5 +39,7 @@ struct bsc_nat *bsc_nat_alloc(void *tall_ctx); void bsc_nat_free(struct bsc_nat *bsc_nat);
+const char *bsc_nat_print_addr(struct bsc_nat_sccp_inst *sccp_inst, struct osmo_sccp_addr *addr); + extern void *tall_bsc_nat_ctx; extern struct bsc_nat *g_bsc_nat; diff --git a/src/osmo-bsc-nat/bsc_nat.c b/src/osmo-bsc-nat/bsc_nat.c index 7741184..579c6aa 100644 --- a/src/osmo-bsc-nat/bsc_nat.c +++ b/src/osmo-bsc-nat/bsc_nat.c @@ -52,3 +52,13 @@
talloc_free(bsc_nat); } + +const char *bsc_nat_print_addr(struct bsc_nat_sccp_inst *sccp_inst, struct osmo_sccp_addr *addr) +{ + static char buf[25]; + + snprintf(buf, sizeof(buf), "PC=%s in %s", osmo_ss7_pointcode_print(NULL, addr->pc), + sccp_inst == g_bsc_nat->cn ? "CN" : "RAN"); + + return buf; +} diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c index f0f28f8..4d71420 100644 --- a/src/osmo-bsc-nat/bsc_nat_fsm.c +++ b/src/osmo-bsc-nat/bsc_nat_fsm.c @@ -134,9 +134,7 @@ if (sccp_sap_get_peer_addr_out(src, peer_addr_in, &peer_addr_out) < 0) goto error;
- LOG_SCCP(src, peer_addr_in, LOGL_NOTICE, "Forwarding to %s in %s\n", - osmo_sccp_inst_addr_name(NULL, &peer_addr_out), - dest == g_bsc_nat->ran ? "RAN" : "CN"); + LOGP(DMAIN, LOGL_DEBUG, "Fwd to %s\n", bsc_nat_print_addr(dest, &peer_addr_out));
msgb_pull_to_l2(oph->msg); osmo_sccp_tx_conn_req(dest->scu, prim->u.connect.conn_id, &dest->local_sccp_addr, &peer_addr_out, @@ -153,9 +151,7 @@ if (sccp_sap_get_peer_addr_out(src, peer_addr_in, &peer_addr_out) < 0) goto error;
- LOG_SCCP(src, peer_addr_in, LOGL_NOTICE, "Forwarding to %s in %s\n", - osmo_sccp_inst_addr_name(NULL, &peer_addr_out), - dest == g_bsc_nat->ran ? "RAN" : "CN"); + LOGP(DMAIN, LOGL_DEBUG, "Fwd to %s\n", bsc_nat_print_addr(dest, &peer_addr_out));
msgb_pull_to_l2(oph->msg); osmo_sccp_tx_conn_resp(dest->scu, prim->u.connect.conn_id, &peer_addr_out, oph->msg->data, @@ -168,9 +164,7 @@ if (sccp_sap_get_peer_addr_out(src, NULL, &peer_addr_out) < 0) goto error;
- LOG_SCCP(src, NULL, LOGL_NOTICE, "Forwarding to %s in %s\n", - osmo_sccp_inst_addr_name(NULL, &peer_addr_out), - dest == g_bsc_nat->ran ? "RAN" : "CN"); + LOGP(DMAIN, LOGL_DEBUG, "Fwd to %s\n", bsc_nat_print_addr(dest, &peer_addr_out));
msgb_pull_to_l2(oph->msg); osmo_sccp_tx_data(dest->scu, prim->u.data.conn_id, oph->msg->data, msgb_length(oph->msg)); @@ -182,9 +176,7 @@ if (sccp_sap_get_peer_addr_out(src, NULL, &peer_addr_out) < 0) goto error;
- LOG_SCCP(src, NULL, LOGL_NOTICE, "Forwarding to %s in %s\n", - osmo_sccp_inst_addr_name(NULL, &peer_addr_out), - dest == g_bsc_nat->ran ? "RAN" : "CN"); + LOGP(DMAIN, LOGL_DEBUG, "Fwd to %s\n", bsc_nat_print_addr(dest, &peer_addr_out));
osmo_sccp_tx_disconn(dest->scu, prim->u.disconnect.conn_id, &prim->u.disconnect.responding_addr, prim->u.disconnect.cause); @@ -198,9 +190,7 @@ if (sccp_sap_get_peer_addr_out(src, peer_addr_in, &peer_addr_out) < 0) goto error;
- LOG_SCCP(src, peer_addr_in, LOGL_NOTICE, "Forwarding to %s in %s\n", - osmo_sccp_inst_addr_name(NULL, &peer_addr_out), - dest == g_bsc_nat->ran ? "RAN" : "CN"); + LOGP(DMAIN, LOGL_DEBUG, "Fwd to %s\n", bsc_nat_print_addr(dest, &peer_addr_out));
/* oph->msg stores oph and unitdata msg. Move oph->msg->data to * unitdata msg and send it again. */