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

2018-03-03 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: ipac: fix log output
..


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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(, RSL_IE_IPAC_REMOTE_IP, 4)) {
connect_ip = tlvp_val32_unal(, 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(, RSL_IE_IPAC_REMOTE_PORT, 2)) {
connect_port = tlvp_val16_unal(, 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(, 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(, 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(, RSL_IE_IPAC_RTP_PAYLOAD2);
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I61044edc0672b268aeebf48b59a772887703399f
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


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

2018-03-03 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I61044edc0672b268aeebf48b59a772887703399f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


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

2018-03-02 Thread dexter

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(, RSL_IE_IPAC_REMOTE_IP, 4)) {
connect_ip = tlvp_val32_unal(, 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(, RSL_IE_IPAC_REMOTE_PORT, 2)) {
connect_port = tlvp_val16_unal(, 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(, 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(, 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(, 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