[PATCH] osmo-bts[master]: ipac: fix log output

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Fri Mar 2 15:18:23 UTC 2018


Review at  https://gerrit.osmocom.org/7064

ipac: fix log output

The current log output logs connect_ip connect_port
speech mode and payload type over multiple lines and without
logging context (lchan name). Also the logging level
incorrectly set.

- shrink log output into one line.
- add context (lchan name)
- encode ip/port into human readable form

Change-Id: I61044edc0672b268aeebf48b59a772887703399f
Closes: OS#3001
---
M src/common/rsl.c
1 file changed, 10 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/64/7064/1

diff --git a/src/common/rsl.c b/src/common/rsl.c
index 98e8913..d048c82 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1689,6 +1689,7 @@
 	int rc, inc_ip_port = 0, port;
 	char *name;
 	struct in_addr ia;
+	struct in_addr addr;
 
 	if (dch->c.msg_type == RSL_MT_IPAC_CRCX)
 		name = "CRCX";
@@ -1705,31 +1706,28 @@
 		return tx_ipac_XXcx_nack(lchan, RSL_ERR_MAND_IE_ERROR,
 					 0, dch->c.msg_type);
 
+	LOGP(DRSL, LOGL_DEBUG, "%s IPAC_%s: ", gsm_lchan_name(lchan), name);
 	if (TLVP_PRES_LEN(&tp, RSL_IE_IPAC_REMOTE_IP, 4)) {
 		connect_ip = tlvp_val32_unal(&tp, RSL_IE_IPAC_REMOTE_IP);
-		LOGP(DRSL, LOGL_NOTICE, "connect_ip %d \n", connect_ip );
+		addr.s_addr = connect_ip;
+		LOGPC(DRSL, LOGL_DEBUG, "connect_ip=%s ", inet_ntoa(addr));
 	}
-	else
-		LOGP(DRSL, LOGL_NOTICE, "CRCX does not specify a remote IP\n");
 
 	if (TLVP_PRES_LEN(&tp, RSL_IE_IPAC_REMOTE_PORT, 2)) {
 		connect_port = tlvp_val16_unal(&tp, RSL_IE_IPAC_REMOTE_PORT);
-		LOGP(DRSL, LOGL_NOTICE, "connect_port %d \n", connect_port );
+		LOGPC(DRSL, LOGL_DEBUG, "connect_port=%u ",
+		      ntohs(connect_port));
 	}
-	else
-		LOGP(DRSL, LOGL_NOTICE, "CRCX does not specify a remote port\n");
 
 	speech_mode = TLVP_VAL(&tp, RSL_IE_IPAC_SPEECH_MODE);
 	if (speech_mode)
-		LOGP(DRSL, LOGL_NOTICE, "speech mode: %d\n", *speech_mode);
-	else
-		LOGP(DRSL, LOGL_NOTICE, "speech mode: none\n");
+		LOGPC(DRSL, LOGL_DEBUG, "speech_mode=%u ", *speech_mode);
 
 	payload_type = TLVP_VAL(&tp, RSL_IE_IPAC_RTP_PAYLOAD);
 	if (payload_type)
-		LOGP(DRSL, LOGL_NOTICE, "payload type: %d\n",*payload_type);
-	else
-		LOGP(DRSL, LOGL_NOTICE, "payload type: none\n");
+		LOGPC(DRSL, LOGL_DEBUG, "payload_type=%u ", *payload_type);
+
+	LOGPC(DRSL, LOGL_DEBUG, "\n");
 
 	payload_type2 = TLVP_VAL(&tp, RSL_IE_IPAC_RTP_PAYLOAD2);
 

-- 
To view, visit https://gerrit.osmocom.org/7064
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I61044edc0672b268aeebf48b59a772887703399f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list