From shi_lei at massclouds.com  Thu Nov 19 21:44:11 2020
From: shi_lei at massclouds.com (Shi Lei)
Date: Fri, 20 Nov 2020 10:44:11 +0800
Subject: [PATCH] cli: Introduce nl_cli_tc_get_ops to expose rtnl_tc_get_ops
Message-ID: <20201120024411.16711-1-shi_lei@massclouds.com>

Now applications with libnl can't utilize tc directly just like
internal commands (nl_qdisc_[add|delete|...] etc.), because
they need rtnl_tc_get_ops but it's a internal function.

Introduce a new cli function to expose it.

Signed-off-by: Shi Lei <shi_lei at massclouds.com>
---
 include/netlink/cli/tc.h | 1 +
 libnl-cli-3.sym          | 1 +
 src/lib/tc.c             | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/include/netlink/cli/tc.h b/include/netlink/cli/tc.h
index 77042c7..a631798 100644
--- a/include/netlink/cli/tc.h
+++ b/include/netlink/cli/tc.h
@@ -37,5 +37,6 @@ struct nl_cli_tc_module
 extern struct nl_cli_tc_module *nl_cli_tc_lookup(struct rtnl_tc_ops *);
 extern void nl_cli_tc_register(struct nl_cli_tc_module *);
 extern void nl_cli_tc_unregister(struct nl_cli_tc_module *);
+struct rtnl_tc_ops *nl_cli_tc_get_ops(struct rtnl_tc *);
 
 #endif
diff --git a/libnl-cli-3.sym b/libnl-cli-3.sym
index 3d433f6..a72defa 100644
--- a/libnl-cli-3.sym
+++ b/libnl-cli-3.sym
@@ -105,6 +105,7 @@ global:
 	nl_cli_tc_parse_parent;
 	nl_cli_tc_register;
 	nl_cli_tc_unregister;
+	nl_cli_tc_get_ops;
 local:
 	*;
 };
diff --git a/src/lib/tc.c b/src/lib/tc.c
index dde729f..8a7b0b9 100644
--- a/src/lib/tc.c
+++ b/src/lib/tc.c
@@ -161,5 +161,10 @@ void nl_cli_tc_unregister(struct nl_cli_tc_module *tm)
 	nl_list_del(&tm->tm_list);
 }
 
+struct rtnl_tc_ops *nl_cli_tc_get_ops(struct rtnl_tc *tc)
+{
+	return rtnl_tc_get_ops(tc);
+}
+
 
 /** @} */
-- 
2.25.1




