diff options
author | Thomas Haller <thaller@redhat.com> | 2014-11-27 12:09:03 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-11-27 15:50:46 (GMT) |
commit | 9d4bc0345a6ee350ed1493b932b19f5eb315a613 (patch) | |
tree | b392c4b5749787fbf6b87554036096aee8c76260 | |
parent | a60b3e46e74f91bde3264c5f5382b87d05fcb917 (diff) | |
download | libnl-9d4bc0345a6ee350ed1493b932b19f5eb315a613.zip libnl-9d4bc0345a6ee350ed1493b932b19f5eb315a613.tar.gz libnl-9d4bc0345a6ee350ed1493b932b19f5eb315a613.tar.bz2 |
idiag: don't dump unset properties of idiag_msg
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | lib/idiag/idiag_msg_obj.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/lib/idiag/idiag_msg_obj.c b/lib/idiag/idiag_msg_obj.c index 8199536..bb50974 100644 --- a/lib/idiag/idiag_msg_obj.c +++ b/lib/idiag/idiag_msg_obj.c @@ -458,7 +458,7 @@ static void idiag_msg_dump_details(struct nl_object *a, struct nl_dump_params *p nl_dump(p, "tos: 0x%x\n", msg->idiag_tos); nl_dump(p, "traffic class: %d\n", msg->idiag_tclass); - nl_dump(p, "congestion algorithm: %s\n", msg->idiag_cong); + nl_dump(p, "congestion algorithm: %s\n", msg->idiag_cong ? : ""); } static void idiag_msg_dump_stats(struct nl_object *obj, struct nl_dump_params *p) @@ -575,27 +575,29 @@ static void idiag_msg_dump_stats(struct nl_object *obj, struct nl_dump_params *p nl_dump(p, "]\n"); } - nl_dump(p, "skmeminfo: [\n"); - nl_dump(p, "\trmem alloc: %d\n", - msg->idiag_skmeminfo[SK_MEMINFO_RMEM_ALLOC]); - nl_dump(p, "\trcv buf: %s\n", - nl_size2str(msg->idiag_skmeminfo[SK_MEMINFO_RCVBUF], - buf, sizeof(buf))); - nl_dump(p, "\twmem alloc: %d\n", - msg->idiag_skmeminfo[SK_MEMINFO_WMEM_ALLOC]); - nl_dump(p, "\tsnd buf: %s\n", - nl_size2str(msg->idiag_skmeminfo[SK_MEMINFO_SNDBUF], - buf, sizeof(buf))); - nl_dump(p, "\tfwd alloc: %d\n", - msg->idiag_skmeminfo[SK_MEMINFO_FWD_ALLOC]); - nl_dump(p, "\twmem queued: %s\n", - nl_size2str(msg->idiag_skmeminfo[SK_MEMINFO_WMEM_QUEUED], - buf, sizeof(buf))); - nl_dump(p, "\topt mem: %d\n", - msg->idiag_skmeminfo[SK_MEMINFO_OPTMEM]); - nl_dump(p, "\tbacklog: %d\n", - msg->idiag_skmeminfo[SK_MEMINFO_BACKLOG]); - nl_dump(p, "]\n\n"); + if (msg->ce_mask & IDIAGNL_ATTR_MEMINFO) { + nl_dump(p, "skmeminfo: [\n"); + nl_dump(p, "\trmem alloc: %d\n", + msg->idiag_skmeminfo[SK_MEMINFO_RMEM_ALLOC]); + nl_dump(p, "\trcv buf: %s\n", + nl_size2str(msg->idiag_skmeminfo[SK_MEMINFO_RCVBUF], + buf, sizeof(buf))); + nl_dump(p, "\twmem alloc: %d\n", + msg->idiag_skmeminfo[SK_MEMINFO_WMEM_ALLOC]); + nl_dump(p, "\tsnd buf: %s\n", + nl_size2str(msg->idiag_skmeminfo[SK_MEMINFO_SNDBUF], + buf, sizeof(buf))); + nl_dump(p, "\tfwd alloc: %d\n", + msg->idiag_skmeminfo[SK_MEMINFO_FWD_ALLOC]); + nl_dump(p, "\twmem queued: %s\n", + nl_size2str(msg->idiag_skmeminfo[SK_MEMINFO_WMEM_QUEUED], + buf, sizeof(buf))); + nl_dump(p, "\topt mem: %d\n", + msg->idiag_skmeminfo[SK_MEMINFO_OPTMEM]); + nl_dump(p, "\tbacklog: %d\n", + msg->idiag_skmeminfo[SK_MEMINFO_BACKLOG]); + nl_dump(p, "]\n\n"); + } } static void idiagnl_msg_free(struct nl_object *a) |