72 lines
2.2 KiB
Diff
72 lines
2.2 KiB
Diff
From 587d1d56630bd7e193ffe50834e57431454d1003 Mon Sep 17 00:00:00 2001
|
|
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
Date: Sun, 19 Aug 2018 21:33:26 +0200
|
|
Subject: [PATCH 042/293] netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute
|
|
value
|
|
|
|
* xlat/sock_shutdown_flags.in: New file.
|
|
* netlink_smc_diag.c: Include "xlat/sock_shutdown_flags.h".
|
|
(decode_smc_diag_shutdown): New function.
|
|
(smc_diag_msg_nla_decoders) <[SMC_DIAG_SHUTDOWN]>: Use
|
|
decode_smc_diag_shutdown.
|
|
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_SHUTDOWN.
|
|
---
|
|
netlink_smc_diag.c | 17 ++++++++++++++++-
|
|
xlat/sock_shutdown_flags.in | 2 ++
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
create mode 100644 xlat/sock_shutdown_flags.in
|
|
|
|
diff --git a/netlink_smc_diag.c b/netlink_smc_diag.c
|
|
index b9293a9..0248712 100644
|
|
--- a/netlink_smc_diag.c
|
|
+++ b/netlink_smc_diag.c
|
|
@@ -49,6 +49,7 @@
|
|
# include "xlat/smc_diag_mode.h"
|
|
# include "xlat/smc_link_group_roles.h"
|
|
# include "xlat/smc_states.h"
|
|
+# include "xlat/sock_shutdown_flags.h"
|
|
|
|
DECL_NETLINK_DIAG_DECODER(decode_smc_diag_req)
|
|
{
|
|
@@ -149,6 +150,20 @@ decode_smc_diag_lgrinfo(struct tcb *const tcp,
|
|
}
|
|
|
|
static bool
|
|
+decode_smc_diag_shutdown(struct tcb *const tcp,
|
|
+ const kernel_ulong_t addr,
|
|
+ const unsigned int len,
|
|
+ const void *const opaque_data)
|
|
+{
|
|
+ const struct decode_nla_xlat_opts opts = {
|
|
+ ARRSZ_PAIR(sock_shutdown_flags), "???_SHUTDOWN",
|
|
+ .size = 1,
|
|
+ };
|
|
+
|
|
+ return decode_nla_flags(tcp, addr, len, &opts);
|
|
+}
|
|
+
|
|
+static bool
|
|
decode_smc_diag_dmbinfo(struct tcb *const tcp,
|
|
const kernel_ulong_t addr,
|
|
const unsigned int len,
|
|
@@ -201,7 +216,7 @@ decode_smc_diag_fallback(struct tcb *const tcp,
|
|
static const nla_decoder_t smc_diag_msg_nla_decoders[] = {
|
|
[SMC_DIAG_CONNINFO] = decode_smc_diag_conninfo,
|
|
[SMC_DIAG_LGRINFO] = decode_smc_diag_lgrinfo,
|
|
- [SMC_DIAG_SHUTDOWN] = decode_nla_u8,
|
|
+ [SMC_DIAG_SHUTDOWN] = decode_smc_diag_shutdown,
|
|
[SMC_DIAG_DMBINFO] = decode_smc_diag_dmbinfo,
|
|
[SMC_DIAG_FALLBACK] = decode_smc_diag_fallback,
|
|
};
|
|
diff --git a/xlat/sock_shutdown_flags.in b/xlat/sock_shutdown_flags.in
|
|
new file mode 100644
|
|
index 0000000..ff7d432
|
|
--- /dev/null
|
|
+++ b/xlat/sock_shutdown_flags.in
|
|
@@ -0,0 +1,2 @@
|
|
+RCV_SHUTDOWN 1
|
|
+SEND_SHUTDOWN 2
|
|
--
|
|
1.7.12.4
|
|
|