summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-08-01 06:22:55 (GMT)
committerThomas Haller <thaller@redhat.com>2023-08-01 07:37:45 (GMT)
commitdb810cfb8ce7f2620f3d865ac4e9e3f757030eb3 (patch)
treeb7e484ba427f8c66f4881922612d6d14736286b8
parentff08e6180d4bdce4f8d60917bed239fee0a2abaa (diff)
downloadlibnl-db810cfb8ce7f2620f3d865ac4e9e3f757030eb3.zip
libnl-db810cfb8ce7f2620f3d865ac4e9e3f757030eb3.tar.gz
libnl-db810cfb8ce7f2620f3d865ac4e9e3f757030eb3.tar.bz2
route: move hidden symbols from "include/netlink-private/route/tc-api.h"
To new header "include/nl-hidden-route/nl-hidden-route.h". libnl-route-3 exports some symbols that are no in public headers. They are however used by other internal users in the source tree. Such usage seems bad. We should clearly see where this is done. Move the symbols to a separate header, where it's clear who may use this header, and what's its purpose.
-rw-r--r--Makefile.am1
-rw-r--r--include/netlink-private/route/tc-api.h68
-rw-r--r--include/nl-hidden-route/nl-hidden-route.h74
-rw-r--r--libnl-route-3.sym3
-rw-r--r--src/lib/tc.c3
-rw-r--r--src/nl-class-add.c4
-rw-r--r--src/nl-cls-add.c4
-rw-r--r--src/nl-qdisc-add.c4
-rw-r--r--tests/cksuite-all-attr.c1
9 files changed, 87 insertions, 75 deletions
diff --git a/Makefile.am b/Makefile.am
index 838b1de..b7f23fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -282,6 +282,7 @@ noinst_HEADERS = \
include/netlink-private/types.h \
include/nl-aux-core/nl-core.h \
include/nl-aux-route/nl-route.h \
+ include/nl-hidden-route/nl-hidden-route.h \
$(NULL)
###############################################################################
diff --git a/include/netlink-private/route/tc-api.h b/include/netlink-private/route/tc-api.h
index 1eb27dc..cbfb021 100644
--- a/include/netlink-private/route/tc-api.h
+++ b/include/netlink-private/route/tc-api.h
@@ -10,73 +10,12 @@
#include <netlink/msg.h>
#include <netlink/route/tc.h>
+#include "nl-hidden-route/nl-hidden-route.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-/**
- * Traffic control object operations
- * @ingroup tc
- *
- * This structure holds function pointers and settings implementing
- * the features of each traffic control object implementation.
- */
-struct rtnl_tc_ops
-{
- /**
- * Name of traffic control module
- */
- char *to_kind;
-
- /**
- * Type of traffic control object
- */
- enum rtnl_tc_type to_type;
-
-
- /**
- * Size of private data
- */
- size_t to_size;
-
- /**
- * Dump callbacks
- */
- void (*to_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, void *,
- struct nl_dump_params *);
- /**
- * Used to fill the contents of TCA_OPTIONS
- */
- int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *);
-
- /**
- * Uesd to to fill tc related messages, unlike with to_msg_fill,
- * the contents is not encapsulated with a TCA_OPTIONS nested
- * attribute.
- */
- int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *);
-
- /**
- * TCA_OPTIONS message parser
- */
- int (*to_msg_parser)(struct rtnl_tc *, void *);
-
- /**
- * Called before a tc object is destroyed
- */
- void (*to_free_data)(struct rtnl_tc *, void *);
-
- /**
- * Called whenever a classifier object needs to be cloned
- */
- int (*to_clone)(void *, void *);
-
- /**
- * Internal, don't touch
- */
- struct nl_list_head to_list;
-};
-
struct rtnl_tc_type_ops
{
enum rtnl_tc_type tt_type;
@@ -113,9 +52,6 @@ extern void * rtnl_tc_data(struct rtnl_tc *);
extern void * rtnl_tc_data_check(struct rtnl_tc *,
struct rtnl_tc_ops *, int *);
-extern struct rtnl_tc_ops * rtnl_tc_lookup_ops(enum rtnl_tc_type,
- const char *);
-extern struct rtnl_tc_ops * rtnl_tc_get_ops(struct rtnl_tc *);
extern int rtnl_tc_register(struct rtnl_tc_ops *);
extern void rtnl_tc_unregister(struct rtnl_tc_ops *);
diff --git a/include/nl-hidden-route/nl-hidden-route.h b/include/nl-hidden-route/nl-hidden-route.h
new file mode 100644
index 0000000..1baba32
--- /dev/null
+++ b/include/nl-hidden-route/nl-hidden-route.h
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/*
+ * Copyright (c) 2011-2013 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef __NL_HIDDEN_ROUTE_NL_HIDDEN_ROUTE_H__
+#define __NL_HIDDEN_ROUTE_NL_HIDDEN_ROUTE_H__
+
+/**
+ * Traffic control object operations
+ * @ingroup tc
+ *
+ * This structure holds function pointers and settings implementing
+ * the features of each traffic control object implementation.
+ */
+struct rtnl_tc_ops {
+ /**
+ * Name of traffic control module
+ */
+ char *to_kind;
+
+ /**
+ * Type of traffic control object
+ */
+ enum rtnl_tc_type to_type;
+
+ /**
+ * Size of private data
+ */
+ size_t to_size;
+
+ /**
+ * Dump callbacks
+ */
+ void (*to_dump[NL_DUMP_MAX + 1])(struct rtnl_tc *, void *,
+ struct nl_dump_params *);
+ /**
+ * Used to fill the contents of TCA_OPTIONS
+ */
+ int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *);
+
+ /**
+ * Uesd to to fill tc related messages, unlike with to_msg_fill,
+ * the contents is not encapsulated with a TCA_OPTIONS nested
+ * attribute.
+ */
+ int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *);
+
+ /**
+ * TCA_OPTIONS message parser
+ */
+ int (*to_msg_parser)(struct rtnl_tc *, void *);
+
+ /**
+ * Called before a tc object is destroyed
+ */
+ void (*to_free_data)(struct rtnl_tc *, void *);
+
+ /**
+ * Called whenever a classifier object needs to be cloned
+ */
+ int (*to_clone)(void *, void *);
+
+ /**
+ * Internal, don't touch
+ */
+ struct nl_list_head to_list;
+};
+
+extern struct rtnl_tc_ops *rtnl_tc_lookup_ops(enum rtnl_tc_type, const char *);
+
+struct rtnl_tc_ops *rtnl_tc_get_ops(struct rtnl_tc *);
+
+#endif /* __NL_HIDDEN_ROUTE_NL_HIDDEN_ROUTE_H__ */
diff --git a/libnl-route-3.sym b/libnl-route-3.sym
index 275b616..052569c 100644
--- a/libnl-route-3.sym
+++ b/libnl-route-3.sym
@@ -36,7 +36,8 @@ global:
rtnl_tc_unregister;
# these functions are in private header files and should have never
- # been exported. They are used by libnl internals
+ # been exported. They are used by libnl internals.
+ # declared in "include/nl-hidden-route/nl-hidden-route.h".
rtnl_tc_get_ops;
rtnl_tc_lookup_ops;
diff --git a/src/lib/tc.c b/src/lib/tc.c
index ba3de18..fbab274 100644
--- a/src/lib/tc.c
+++ b/src/lib/tc.c
@@ -5,7 +5,8 @@
#include <netlink/cli/utils.h>
#include <netlink/cli/tc.h>
-#include <netlink-private/route/tc-api.h>
+
+#include "nl-hidden-route/nl-hidden-route.h"
/**
* @ingroup cli
diff --git a/src/nl-class-add.c b/src/nl-class-add.c
index d3f9230..82de8fa 100644
--- a/src/nl-class-add.c
+++ b/src/nl-class-add.c
@@ -9,10 +9,10 @@
#include <netlink/cli/class.h>
#include <netlink/cli/link.h>
-#include <netlink-private/route/tc-api.h>
-
#include <linux/netlink.h>
+#include "nl-hidden-route/nl-hidden-route.h"
+
static int quiet = 0;
static void print_usage(void)
diff --git a/src/nl-cls-add.c b/src/nl-cls-add.c
index a29beb7..090a836 100644
--- a/src/nl-cls-add.c
+++ b/src/nl-cls-add.c
@@ -8,10 +8,10 @@
#include <netlink/cli/cls.h>
#include <netlink/cli/link.h>
-#include <netlink-private/route/tc-api.h>
-
#include <linux/netlink.h>
+#include "nl-hidden-route/nl-hidden-route.h"
+
static int quiet = 0;
static void print_usage(void)
diff --git a/src/nl-qdisc-add.c b/src/nl-qdisc-add.c
index 8cd317c..698b00b 100644
--- a/src/nl-qdisc-add.c
+++ b/src/nl-qdisc-add.c
@@ -8,10 +8,10 @@
#include <netlink/cli/qdisc.h>
#include <netlink/cli/link.h>
-#include <netlink-private/route/tc-api.h>
-
#include <linux/netlink.h>
+#include "nl-hidden-route/nl-hidden-route.h"
+
static int quiet = 0;
static void print_usage(void)
diff --git a/tests/cksuite-all-attr.c b/tests/cksuite-all-attr.c
index f929f61..a4bd271 100644
--- a/tests/cksuite-all-attr.c
+++ b/tests/cksuite-all-attr.c
@@ -10,7 +10,6 @@
#include "netlink/attr.h"
#include "netlink/msg.h"
#include "netlink/route/cls/u32.h"
-#include "netlink-private/route/tc-api.h"
#include "nl-aux-route/nl-route.h"