Skip to content

Commit

Permalink
include: merge branch 'th/move-private-headers-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Aug 1, 2023
2 parents 739d9e6 + 776fc5a commit 77a8a00
Show file tree
Hide file tree
Showing 73 changed files with 243 additions and 251 deletions.
25 changes: 14 additions & 11 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,14 @@ noinst_HEADERS = \
include/linux-private/linux/tc_ematch/tc_em_meta.h \
include/linux-private/linux/veth.h \
include/linux-private/linux/xfrm.h \
include/netlink-private/cache-api.h \
include/netlink-private/netlink.h \
include/netlink-private/object-api.h \
include/netlink-private/route/link/sriov.h \
include/netlink-private/route/nexthop-encap.h \
include/netlink-private/route/tc-api.h \
include/netlink-private/socket.h \
include/netlink-private/tc.h \
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 \
include/nl-intern-route/nl-intern-route.h \
include/nl-shared-core/cache-api.h \
include/nl-shared-core/object-api.h \
$(NULL)

###############################################################################
Expand Down Expand Up @@ -342,8 +339,7 @@ lib_cppflags = \
-I$(srcdir)/include/linux-private \
-I$(srcdir)/include \
-I$(builddir)/include \
-I$(builddir)/lib/route \
-I$(builddir)/lib/route/cls
$(NULL)

lib_LTLIBRARIES += lib/libnl-3.la

Expand All @@ -361,6 +357,7 @@ lib_libnl_3_la_SOURCES = \
lib/mpls.c \
lib/mpls.h \
lib/msg.c \
lib/nl-core.h \
lib/nl.c \
lib/object.c \
lib/socket.c \
Expand All @@ -378,7 +375,6 @@ lib_libnl_3_la_LDFLAGS = \
lib_LTLIBRARIES += lib/libnl-route-3.la

lib_libnl_route_3_la_SOURCES = \
include/nl-intern-route/nl-intern-route.h \
lib/fib_lookup/lookup.c \
lib/fib_lookup/request.c \
lib/route/act.c \
Expand All @@ -404,6 +400,7 @@ lib_libnl_route_3_la_SOURCES = \
lib/route/cls/mall.c \
lib/route/cls/police.c \
lib/route/cls/u32.c \
lib/route/link-sriov.h \
lib/route/link.c \
lib/route/link/api.c \
lib/route/link/bonding.c \
Expand Down Expand Up @@ -438,6 +435,7 @@ lib_libnl_route_3_la_SOURCES = \
lib/route/neigh.c \
lib/route/neightbl.c \
lib/route/netconf.c \
lib/route/nexthop-encap.h \
lib/route/nexthop.c \
lib/route/nexthop_encap.c \
lib/route/nh.c \
Expand All @@ -464,14 +462,19 @@ lib_libnl_route_3_la_SOURCES = \
lib/route/route_utils.c \
lib/route/rtnl.c \
lib/route/rule.c \
lib/route/tc-api.h \
lib/route/tc.c \
$(NULL)
nodist_lib_libnl_route_3_la_SOURCES = \
$(grammar_files_sources)
EXTRA_lib_libnl_route_3_la_DEPENDENCIES = \
libnl-route-3.sym
lib_libnl_route_3_la_CPPFLAGS = \
$(lib_cppflags)
$(lib_cppflags) \
-I$(srcdir)/lib/route \
-I$(builddir)/lib/route \
-I$(builddir)/lib/route/cls \
$(NULL)
lib_libnl_route_3_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-Wl,--version-script=$(srcdir)/libnl-route-3.sym
Expand Down
3 changes: 1 addition & 2 deletions include/netlink-private/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@
#include <netlink/handlers.h>
#include <netlink/cache.h>
#include <netlink/route/tc.h>
#include <netlink-private/object-api.h>
#include <netlink-private/cache-api.h>
#include <netlink-private/types.h>

#include "nl-shared-core/cache-api.h"
#include "nl-aux-core/nl-core.h"

#define NSEC_PER_SEC 1000000000L
Expand Down
52 changes: 0 additions & 52 deletions include/netlink-private/tc.h

This file was deleted.

7 changes: 3 additions & 4 deletions include/netlink-private/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
#include <netlink/route/route.h>
#include <netlink/idiag/idiagnl.h>
#include <netlink/netfilter/ct.h>
#include <netlink-private/object-api.h>
#include <netlink-private/route/tc-api.h>
#include <netlink-private/route/link/sriov.h>
#include <netlink/route/link/sriov.h>
#include <netlink/route/nh.h>
#include <netlink-private/route/nexthop-encap.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/genetlink.h>
Expand All @@ -32,6 +29,8 @@

#include <netinet/in.h>

#include "nl-shared-core/object-api.h"

#define NL_SOCK_PASSCRED (1<<1)
#define NL_OWN_PORT (1<<2)
#define NL_MSG_PEEK (1<<3)
Expand Down
10 changes: 10 additions & 0 deletions include/nl-hidden-route/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include/nl-hidden-route
=======================

libnl-route-3 wrongly exposes some symbols that are not part of public headers.
They are used by other internal code.

These are the symbols.

This header can be used by internal code, that dynamically links with libnl-route-3.
But best we reduce the use of such hidden API, so avoid it.
74 changes: 74 additions & 0 deletions include/nl-hidden-route/nl-hidden-route.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2011-2013 Thomas Graf <[email protected]>
*/

#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__ */
8 changes: 8 additions & 0 deletions include/nl-shared-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include/nl-shared-core
======================

Contains internal API on top of core (libnl-3). It is
implemented by core and usable to all users that link
against libnl-3.

Note that the ABI, while being internal, should stay stable.
File renamed without changes.
File renamed without changes.
14 changes: 3 additions & 11 deletions include/netlink-private/socket.h → lib/nl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
* Copyright (c) 2014 Thomas Graf <[email protected]>
*/

#ifndef NETLINK_SOCKET_PRIV_H_
#define NETLINK_SOCKET_PRIV_H_
#ifndef __LIB_NL_CORE_H__
#define __LIB_NL_CORE_H__

#include <netlink-private/netlink.h>

#ifdef __cplusplus
extern "C" {
#endif

int _nl_socket_is_local_port_unspecified (struct nl_sock *sk);
uint32_t _nl_socket_set_local_port_no_release(struct nl_sock *sk, int generate_other);

void _nl_socket_used_ports_release_all(const uint32_t *used_ports);
void _nl_socket_used_ports_set(uint32_t *used_ports, uint32_t port);

#ifdef __cplusplus
}
#endif

#endif
#endif /* __LIB_NL_CORE_H__ */
3 changes: 2 additions & 1 deletion lib/nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/

#include <netlink-private/netlink.h>
#include <netlink-private/socket.h>
#include "base/nl-base-utils.h"
#include <netlink/netlink.h>
#include <netlink/utils.h>
Expand All @@ -29,6 +28,8 @@
#include <netlink/attr.h>
#include <linux/socket.h>

#include "nl-core.h"

/**
* @defgroup core_types Data Types
*
Expand Down
3 changes: 1 addition & 2 deletions lib/route/act.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@

#include <netlink-private/netlink.h>
#include "base/nl-base-utils.h"
#include <netlink-private/tc.h>
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <netlink-private/route/tc-api.h>
#include <netlink/route/link.h>
#include <netlink/route/action.h>

#include "tc-api.h"

static struct nl_object_ops act_obj_ops;
static struct nl_cache_ops rtnl_act_ops;
Expand Down
4 changes: 2 additions & 2 deletions lib/route/act/gact.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
*/

#include <netlink-private/netlink.h>
#include <netlink-private/tc.h>
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/utils.h>
#include <netlink-private/route/tc-api.h>
#include <netlink/route/act/gact.h>

#include "tc-api.h"

static struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
[TCA_GACT_PARMS] = { .minlen = sizeof(struct tc_gact) },
};
Expand Down
4 changes: 2 additions & 2 deletions lib/route/act/mirred.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
*/

#include <netlink-private/netlink.h>
#include <netlink-private/tc.h>
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/utils.h>
#include <netlink-private/route/tc-api.h>
#include <netlink/route/act/mirred.h>

#include "tc-api.h"

static struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = {
[TCA_MIRRED_PARMS] = { .minlen = sizeof(struct tc_mirred) },
};
Expand Down
4 changes: 2 additions & 2 deletions lib/route/act/nat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
*/

#include <netlink-private/netlink.h>
#include <netlink-private/tc.h>
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/utils.h>
#include <netlink-private/route/tc-api.h>
#include <netlink/route/act/nat.h>
#include <netlink/route/tc.h>

#include "tc-api.h"

static struct nla_policy nat_policy[TCA_NAT_MAX + 1] = {
[TCA_NAT_PARMS] = { .minlen = sizeof(struct tc_nat) },
};
Expand Down
4 changes: 2 additions & 2 deletions lib/route/act/skbedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
*/

#include <netlink-private/netlink.h>
#include <netlink-private/tc.h>
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/utils.h>
#include <netlink-private/route/tc-api.h>
#include <netlink/route/act/skbedit.h>

#include "tc-api.h"

static struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
[TCA_SKBEDIT_PARMS] = { .minlen = sizeof(struct tc_skbedit) },
[TCA_SKBEDIT_PRIORITY] = { .type = NLA_U32 },
Expand Down
Loading

0 comments on commit 77a8a00

Please sign in to comment.