summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornp <np@FreeBSD.org>2014-10-27 22:41:55 +0000
committernp <np@FreeBSD.org>2014-10-27 22:41:55 +0000
commit1a7f83f8a90187e3380f32bc6aae91b1205b003a (patch)
treeebad9b6ed5a071838c2ee783b73d3ab2498bf654
parent4d2f388452b00b6acd98a1642cfd96bdc40900f5 (diff)
downloadFreeBSD-src-1a7f83f8a90187e3380f32bc6aae91b1205b003a.zip
FreeBSD-src-1a7f83f8a90187e3380f32bc6aae91b1205b003a.tar.gz
krping: In verbose mode print only first 128 bytes of krping data.
Submitted by: Hariprasad at Chelsio dot com. Sponsored by: Chelsio Communications
-rw-r--r--sys/contrib/rdma/krping/krping.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c
index 2280636..a770423 100644
--- a/sys/contrib/rdma/krping/krping.c
+++ b/sys/contrib/rdma/krping/krping.c
@@ -1011,9 +1011,17 @@ static void krping_test_server(struct krping_cb *cb)
DEBUG_LOG(cb, "server received read complete\n");
/* Display data in recv buf */
- if (cb->verbose)
- PRINTF(cb, "server ping data: %s\n",
- cb->rdma_buf);
+ if (cb->verbose) {
+ if (strlen(cb->rdma_buf) > 128) {
+ char msgbuf[128];
+
+ strlcpy(msgbuf, cb->rdma_buf, sizeof(msgbuf));
+ PRINTF(cb, "server ping data stripped: %s\n",
+ msgbuf);
+ } else
+ PRINTF(cb, "server ping data: %s\n",
+ cb->rdma_buf);
+ }
/* Tell client to continue */
if (cb->server && cb->server_invalidate) {
@@ -1713,8 +1721,16 @@ static void krping_test_client(struct krping_cb *cb)
break;
}
- if (cb->verbose)
- PRINTF(cb, "ping data: %s\n", cb->rdma_buf);
+ if (cb->verbose) {
+ if (strlen(cb->rdma_buf) > 128) {
+ char msgbuf[128];
+
+ strlcpy(msgbuf, cb->rdma_buf, sizeof(msgbuf));
+ PRINTF(cb, "ping data stripped: %s\n",
+ msgbuf);
+ } else
+ PRINTF(cb, "ping data: %s\n", cb->rdma_buf);
+ }
#ifdef SLOW_KRPING
wait_event_interruptible_timeout(cb->sem, cb->state == ERROR, HZ);
#endif
OpenPOWER on IntegriCloud