From 155fa1293ba0a54960d1959a2335d3917bf8bec6 Mon Sep 17 00:00:00 2001
From: JingPiao Chen <chenjingpiao@gmail.com>
Date: Mon, 4 Sep 2017 14:56:44 +0800
Subject: [PATCH] rtnl_tc_action: decode tcamsg netlink attributes

* rtnl_tc_action.c (tcamsg_nla_decoders): New array.
(decode_tcamsg): Use it.
---
 rtnl_tc_action.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/rtnl_tc_action.c b/rtnl_tc_action.c
index ca0b72be..499c69ac 100644
--- a/rtnl_tc_action.c
+++ b/rtnl_tc_action.c
@@ -37,6 +37,15 @@
 
 #include "xlat/rtnl_tc_action_attrs.h"
 
+static const nla_decoder_t tcamsg_nla_decoders[] = {
+	[TCA_ACT_KIND]		= decode_nla_str,
+	[TCA_ACT_OPTIONS]	= NULL, /* unimplemented */
+	[TCA_ACT_INDEX]		= decode_nla_u32,
+	[TCA_ACT_STATS]		= decode_nla_tc_stats,
+	[TCA_ACT_PAD]		= NULL,
+	[TCA_ACT_COOKIE]	= NULL /* default parser */
+};
+
 DECL_NETLINK_ROUTE_DECODER(decode_tcamsg)
 {
 	struct tcamsg tca = { .tca_family = family };
@@ -49,6 +58,7 @@ DECL_NETLINK_ROUTE_DECODER(decode_tcamsg)
 		tprints(", ");
 		decode_nlattr(tcp, addr + offset, len - offset,
 			      rtnl_tc_action_attrs, "TCA_ACT_???",
-			      NULL, 0, NULL);
+			      tcamsg_nla_decoders,
+			      ARRAY_SIZE(tcamsg_nla_decoders), NULL);
 	}
 }
-- 
2.40.0