[PATCH v3 11/16] netlink: add a dummy netlink attribute parser of AF_SMC diag
JingPiao Chen
chenjingpiao at gmail.com
Mon Jun 19 01:15:35 UTC 2017
* netlink_sock_diag.c: Include "xlat/smc_diag_attrs.h".
(decode_smc_diag_msg): Use decode_nlattr.
* xlat/smc_diag_attrs.in: New file.
---
netlink_sock_diag.c | 11 ++++++++++-
xlat/smc_diag_attrs.in | 5 +++++
2 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 xlat/smc_diag_attrs.in
diff --git a/netlink_sock_diag.c b/netlink_sock_diag.c
index a37292c..f46c441 100644
--- a/netlink_sock_diag.c
+++ b/netlink_sock_diag.c
@@ -56,6 +56,7 @@
#include "xlat/packet_diag_show.h"
#ifdef AF_SMC
+# include "xlat/smc_diag_attrs.h"
# include "xlat/smc_diag_extended_flags.h"
# include "xlat/smc_states.h"
#endif
@@ -528,7 +529,8 @@ decode_smc_diag_msg(struct tcb *const tcp,
const kernel_ulong_t len)
{
struct smc_diag_msg msg = { .diag_family = family };
- const size_t offset = sizeof(msg.diag_family);
+ size_t offset = sizeof(msg.diag_family);
+ bool decode_nla = false;
tprints("{diag_family=");
printxval(addrfams, msg.diag_family, "AF_???");
@@ -551,11 +553,18 @@ decode_smc_diag_msg(struct tcb *const tcp,
print_inet_diag_sockid(&msg.id, AF_INET);
tprintf(", diag_uid=%" PRIu32 ", diag_inode=%" PRIu64,
msg.diag_uid, msg.diag_inode);
+ decode_nla = true;
}
} else
tprints("...");
tprints("}");
+ offset = NLA_ALIGN(sizeof(msg));
+ if (decode_nla && len > offset) {
+ tprints(", ");
+ decode_nlattr(tcp, addr + offset, len - offset,
+ smc_diag_attrs, "SMC_DIAG_???");
+ }
}
#endif
diff --git a/xlat/smc_diag_attrs.in b/xlat/smc_diag_attrs.in
new file mode 100644
index 0000000..cd6179b
--- /dev/null
+++ b/xlat/smc_diag_attrs.in
@@ -0,0 +1,5 @@
+#unconditional
+SMC_DIAG_NONE
+SMC_DIAG_CONNINFO
+SMC_DIAG_LGRINFO
+SMC_DIAG_SHUTDOWN
--
2.7.4
More information about the Strace-devel
mailing list