[PATCH v2 11/16] netlink: add a dummy netlink attribute parser of AF_SMC diag

JingPiao Chen chenjingpiao at gmail.com
Sun Jun 18 05:18:38 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    | 7 +++++++
 xlat/smc_diag_attrs.in | 5 +++++
 2 files changed, 12 insertions(+)
 create mode 100644 xlat/smc_diag_attrs.in

diff --git a/netlink_sock_diag.c b/netlink_sock_diag.c
index 5e232fe..f0e2f30 100644
--- a/netlink_sock_diag.c
+++ b/netlink_sock_diag.c
@@ -55,6 +55,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
@@ -543,6 +544,12 @@ decode_smc_diag_msg(struct tcb *const tcp,
 		tprints("...");
 	tprints("}");
 
+	if (len > NLA_ALIGN(sizeof(msg))) {
+		tprints(", ");
+		decode_nlattr(tcp, addr + NLA_ALIGN(sizeof(msg)),
+			      len - NLA_ALIGN(sizeof(msg)),
+			      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