From ebd66c5b95035374496a0a255b9cc781bf1148ba Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 2 Aug 2023 18:40:41 +0200 Subject: [PATCH] include: drop "netlink-private/netlink.h" and move declarations --- Makefile.am | 1 - include/base/nl-base-utils.h | 110 ++++++++++++++- include/netlink-private/netlink.h | 220 ----------------------------- include/nl-aux-core/nl-core.h | 16 +++ include/nl-shared-core/cache-api.h | 23 +++ include/nl-shared-core/nl-core.h | 42 +++--- lib/addr.c | 3 +- lib/attr.c | 3 +- lib/cache.c | 5 +- lib/cache_mngr.c | 5 +- lib/cache_mngt.c | 4 +- lib/data.c | 4 +- lib/error.c | 2 - lib/fib_lookup/lookup.c | 4 +- lib/fib_lookup/request.c | 2 - lib/genl/ctrl.c | 6 + lib/genl/family.c | 1 + lib/genl/genl.c | 1 + lib/genl/nl-genl.h | 3 +- lib/handlers.c | 3 +- lib/hashtable.c | 2 +- lib/idiag/idiag.c | 2 +- lib/idiag/idiag_meminfo_obj.c | 2 - lib/idiag/idiag_msg_obj.c | 4 +- lib/idiag/idiag_req_obj.c | 5 +- lib/idiag/idiag_vegasinfo_obj.c | 2 - lib/msg.c | 7 +- lib/netfilter/ct.c | 3 +- lib/netfilter/ct_obj.c | 2 - lib/netfilter/exp.c | 3 +- lib/netfilter/exp_obj.c | 2 - lib/netfilter/log.c | 3 +- lib/netfilter/log_msg.c | 3 +- lib/netfilter/log_msg_obj.c | 3 +- lib/netfilter/log_obj.c | 4 +- lib/netfilter/netfilter.c | 2 +- lib/netfilter/nfnl.c | 4 +- lib/netfilter/queue.c | 3 +- lib/netfilter/queue_msg.c | 3 +- lib/netfilter/queue_msg_obj.c | 4 +- lib/netfilter/queue_obj.c | 3 +- lib/nl-core.h | 7 +- lib/nl.c | 4 +- lib/object.c | 5 +- lib/route/act.c | 3 +- lib/route/act/gact.c | 2 - lib/route/act/mirred.c | 2 - lib/route/act/nat.c | 2 - lib/route/act/skbedit.c | 2 - lib/route/act/vlan.c | 2 - lib/route/addr.c | 3 +- lib/route/class.c | 2 - lib/route/classid.c | 6 +- lib/route/cls.c | 4 +- lib/route/cls/basic.c | 2 - lib/route/cls/cgroup.c | 2 - lib/route/cls/ematch.c | 3 +- lib/route/cls/ematch/cmp.c | 2 - lib/route/cls/ematch/container.c | 2 - lib/route/cls/ematch/meta.c | 2 +- lib/route/cls/ematch/nbyte.c | 2 - lib/route/cls/ematch/text.c | 2 - lib/route/cls/ematch_grammar.l | 7 +- lib/route/cls/ematch_syntax.y | 10 +- lib/route/cls/flower.c | 4 +- lib/route/cls/fw.c | 2 - lib/route/cls/mall.c | 2 - lib/route/cls/police.c | 2 +- lib/route/cls/u32.c | 2 - lib/route/link.c | 5 +- lib/route/link/api.c | 2 - lib/route/link/bonding.c | 2 - lib/route/link/bridge.c | 2 - lib/route/link/bridge_info.c | 2 - lib/route/link/can.c | 2 - lib/route/link/dummy.c | 2 - lib/route/link/geneve.c | 2 - lib/route/link/ifb.c | 2 - lib/route/link/inet.c | 4 +- lib/route/link/inet6.c | 5 +- lib/route/link/ip6gre.c | 2 - lib/route/link/ip6tnl.c | 2 - lib/route/link/ip6vti.c | 2 - lib/route/link/ipgre.c | 2 - lib/route/link/ipip.c | 2 - lib/route/link/ipvlan.c | 2 - lib/route/link/ipvti.c | 2 - lib/route/link/link-api.h | 3 + lib/route/link/macsec.c | 2 - lib/route/link/macvlan.c | 3 +- lib/route/link/ppp.c | 2 - lib/route/link/sit.c | 2 - lib/route/link/sriov.c | 2 - lib/route/link/team.c | 2 - lib/route/link/veth.c | 2 - lib/route/link/vlan.c | 2 - lib/route/link/vrf.c | 2 - lib/route/link/vxlan.c | 2 - lib/route/link/xfrmi.c | 2 - lib/route/mdb.c | 4 +- lib/route/neigh.c | 3 +- lib/route/neightbl.c | 3 +- lib/route/netconf.c | 4 +- lib/route/nexthop.c | 3 +- lib/route/nexthop_encap.c | 2 - lib/route/nh.c | 3 +- lib/route/nh_encap_mpls.c | 2 - lib/route/nl-route.h | 29 ++++ lib/route/pktloc.c | 4 +- lib/route/pktloc_grammar.l | 5 +- lib/route/pktloc_syntax.y | 3 +- lib/route/qdisc.c | 2 - lib/route/qdisc/blackhole.c | 2 - lib/route/qdisc/cbq.c | 2 - lib/route/qdisc/dsmark.c | 2 - lib/route/qdisc/fifo.c | 2 - lib/route/qdisc/fq_codel.c | 2 - lib/route/qdisc/hfsc.c | 2 - lib/route/qdisc/htb.c | 2 - lib/route/qdisc/ingress.c | 2 - lib/route/qdisc/mqprio.c | 2 - lib/route/qdisc/netem.c | 2 - lib/route/qdisc/plug.c | 2 - lib/route/qdisc/prio.c | 2 - lib/route/qdisc/red.c | 2 - lib/route/qdisc/sfq.c | 2 - lib/route/qdisc/tbf.c | 2 - lib/route/route.c | 4 +- lib/route/route_obj.c | 2 - lib/route/route_utils.c | 2 +- lib/route/rtnl.c | 2 +- lib/route/rule.c | 3 +- lib/route/tc-api.h | 1 + lib/route/tc.c | 6 +- lib/socket.c | 10 +- lib/utils.c | 12 +- lib/xfrm/ae.c | 4 +- lib/xfrm/lifetime.c | 2 - lib/xfrm/sa.c | 4 +- lib/xfrm/selector.c | 2 - lib/xfrm/sp.c | 4 +- lib/xfrm/template.c | 3 +- src/nl-list-caches.c | 3 +- tests/test-create-ip6tnl.c | 2 - tests/test-create-ipgre.c | 2 - tests/test-create-ipgretap.c | 2 - tests/test-create-ipip.c | 2 - tests/test-create-ipvti.c | 2 - tests/test-create-sit.c | 2 - tests/test-create-xfrmi.c | 2 - tests/test-genl.c | 2 - tools/clang-format.sh | 1 - 152 files changed, 345 insertions(+), 517 deletions(-) delete mode 100644 include/netlink-private/netlink.h diff --git a/Makefile.am b/Makefile.am index 778d57efb..d64a6efd8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -271,7 +271,6 @@ 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/netlink.h \ include/nl-aux-core/nl-core.h \ include/nl-aux-route/nl-route.h \ include/nl-default.h \ diff --git a/include/base/nl-base-utils.h b/include/base/nl-base-utils.h index e02b5f4bd..4e7ad7a4b 100644 --- a/include/base/nl-base-utils.h +++ b/include/base/nl-base-utils.h @@ -8,6 +8,9 @@ #include #include +#include +#include +#include #include #include #include @@ -17,6 +20,12 @@ #include #include +#ifndef DISABLE_PTHREADS +#include +#endif + +/*****************************************************************************/ + #if __BYTE_ORDER == __BIG_ENDIAN #define ntohll(x) (x) #elif __BYTE_ORDER == __LITTLE_ENDIAN @@ -178,9 +187,14 @@ #define _NL_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) +#define ARRAY_SIZE(arr) _NL_N_ELEMENTS(arr) + /*****************************************************************************/ -extern const char *nl_strerror_l(int err); +/* This is also defined in stddef.h */ +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER) +#endif /*****************************************************************************/ @@ -713,4 +727,98 @@ static inline char *_nl_inet_ntop_dup(int addr_family, const void *addr) #define _nl_auto_free _nl_auto(_nl_auto_free_fcn) _NL_AUTO_DEFINE_FCN_VOID0(void *, _nl_auto_free_fcn, free); +/*****************************************************************************/ + +#define NSEC_PER_SEC 1000000000L + +struct trans_tbl { + uint64_t i; + const char *a; +}; + +#define __ADD(id, name) \ + { \ + .i = id, .a = #name \ + } + +#define BUG() \ + do { \ + fprintf(stderr, "BUG at file position %s:%d:%s\n", __FILE__, \ + __LINE__, __func__); \ + assert(0); \ + } while (0) + +#define BUG_ON(condition) \ + do { \ + if (condition) \ + BUG(); \ + } while (0) + +#define APPBUG(msg) \ + do { \ + fprintf(stderr, "APPLICATION BUG: %s:%d:%s: %s\n", __FILE__, \ + __LINE__, __func__, msg); \ + assert(0); \ + } while (0) + +/*****************************************************************************/ + +#ifndef DISABLE_PTHREADS +#define NL_LOCK(NAME) pthread_mutex_t(NAME) = PTHREAD_MUTEX_INITIALIZER +#define NL_RW_LOCK(NAME) pthread_rwlock_t(NAME) = PTHREAD_RWLOCK_INITIALIZER + +static inline void nl_lock(pthread_mutex_t *lock) +{ + pthread_mutex_lock(lock); +} + +static inline void nl_unlock(pthread_mutex_t *lock) +{ + pthread_mutex_unlock(lock); +} + +static inline void nl_read_lock(pthread_rwlock_t *lock) +{ + pthread_rwlock_rdlock(lock); +} + +static inline void nl_read_unlock(pthread_rwlock_t *lock) +{ + pthread_rwlock_unlock(lock); +} + +static inline void nl_write_lock(pthread_rwlock_t *lock) +{ + pthread_rwlock_wrlock(lock); +} + +static inline void nl_write_unlock(pthread_rwlock_t *lock) +{ + pthread_rwlock_unlock(lock); +} + +#else +#define NL_LOCK(NAME) int __unused_lock_##NAME __attribute__((unused)) +#define NL_RW_LOCK(NAME) int __unused_lock_##NAME __attribute__((unused)) + +#define nl_lock(LOCK) \ + do { \ + } while (0) +#define nl_unlock(LOCK) \ + do { \ + } while (0) +#define nl_read_lock(LOCK) \ + do { \ + } while (0) +#define nl_read_unlock(LOCK) \ + do { \ + } while (0) +#define nl_write_lock(LOCK) \ + do { \ + } while (0) +#define nl_write_unlock(LOCK) \ + do { \ + } while (0) +#endif + #endif /* __NETLINK_BASE_NL_BASE_UTILS_H__ */ diff --git a/include/netlink-private/netlink.h b/include/netlink-private/netlink.h deleted file mode 100644 index 7c6360548..000000000 --- a/include/netlink-private/netlink.h +++ /dev/null @@ -1,220 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-only */ -/* - * Copyright (c) 2003-2013 Thomas Graf - */ - -#ifndef NETLINK_LOCAL_H_ -#define NETLINK_LOCAL_H_ - -#include "nl-default.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef SOL_NETLINK -#define SOL_NETLINK 270 -#endif - -#include - -/* local header copies */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef DISABLE_PTHREADS -#include -#endif - -#include "base/nl-base-utils.h" - -#include -#include -#include -#include - -#include "nl-shared-core/cache-api.h" -#include "nl-aux-core/nl-core.h" - -#define NSEC_PER_SEC 1000000000L - -struct trans_tbl { - uint64_t i; - const char *a; -}; - -#define __ADD(id, name) { .i = id, .a = #name } - -struct trans_list { - int i; - char *a; - struct nl_list_head list; -}; - -#ifdef NL_DEBUG -#define NL_DBG(LVL,FMT,ARG...) \ - do { \ - if (LVL <= nl_debug) { \ - int _errsv = errno; \ - fprintf(stderr, \ - "DBG<" #LVL ">%20s:%-4u %s: " FMT, \ - __FILE__, __LINE__, \ - __func__, ##ARG); \ - errno = _errsv; \ - } \ - } while (0) -#else /* NL_DEBUG */ -#define NL_DBG(LVL,FMT,ARG...) do { } while(0) -#endif /* NL_DEBUG */ - -#define BUG() \ - do { \ - fprintf(stderr, "BUG at file position %s:%d:%s\n", \ - __FILE__, __LINE__, __func__); \ - assert(0); \ - } while (0) - -#define BUG_ON(condition) \ - do { \ - if (condition) \ - BUG(); \ - } while (0) - - -#define APPBUG(msg) \ - do { \ - fprintf(stderr, "APPLICATION BUG: %s:%d:%s: %s\n", \ - __FILE__, __LINE__, __func__, msg); \ - assert(0); \ - } while(0) - -extern int __nl_read_num_str_file(const char *path, - int (*cb)(long, const char *)); - -extern int __trans_list_add(int, const char *, struct nl_list_head *); -extern void __trans_list_clear(struct nl_list_head *); - -extern char *__type2str(int, char *, size_t, const struct trans_tbl *, size_t); -extern int __str2type(const char *, const struct trans_tbl *, size_t); - -extern char *__list_type2str(int, char *, size_t, struct nl_list_head *); -extern int __list_str2type(const char *, struct nl_list_head *); - -extern char *__flags2str(int, char *, size_t, const struct trans_tbl *, size_t); -extern int __str2flags(const char *, const struct trans_tbl *, size_t); - -extern void dump_from_ops(struct nl_object *, struct nl_dump_params *); -extern struct rtnl_link *link_lookup(struct nl_cache *cache, int ifindex); - -#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0])) - -/* This is also defined in stddef.h */ -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - -extern int nl_cache_parse(struct nl_cache_ops *, struct sockaddr_nl *, - struct nlmsghdr *, struct nl_parser_param *); - - -#define GENL_FAMILY(id, name) \ - { \ - { id, NL_ACT_UNSPEC, name }, \ - END_OF_MSGTYPES_LIST, \ - } - -static inline int build_sysconf_path(char **strp, const char *filename) -{ - char *sysconfdir; - - sysconfdir = getenv("NLSYSCONFDIR"); - - if (!sysconfdir) - sysconfdir = SYSCONFDIR; - - return asprintf(strp, "%s/%s", sysconfdir, filename); -} - -#ifndef DISABLE_PTHREADS -#define NL_LOCK(NAME) pthread_mutex_t (NAME) = PTHREAD_MUTEX_INITIALIZER -#define NL_RW_LOCK(NAME) pthread_rwlock_t (NAME) = PTHREAD_RWLOCK_INITIALIZER - -static inline void nl_lock(pthread_mutex_t *lock) -{ - pthread_mutex_lock(lock); -} - -static inline void nl_unlock(pthread_mutex_t *lock) -{ - pthread_mutex_unlock(lock); -} - -static inline void nl_read_lock(pthread_rwlock_t *lock) -{ - pthread_rwlock_rdlock(lock); -} - -static inline void nl_read_unlock(pthread_rwlock_t *lock) -{ - pthread_rwlock_unlock(lock); -} - -static inline void nl_write_lock(pthread_rwlock_t *lock) -{ - pthread_rwlock_wrlock(lock); -} - -static inline void nl_write_unlock(pthread_rwlock_t *lock) -{ - pthread_rwlock_unlock(lock); -} - -#else -#define NL_LOCK(NAME) int __unused_lock_ ##NAME __attribute__((unused)) -#define NL_RW_LOCK(NAME) int __unused_lock_ ##NAME __attribute__((unused)) - -#define nl_lock(LOCK) do { } while(0) -#define nl_unlock(LOCK) do { } while(0) -#define nl_read_lock(LOCK) do { } while(0) -#define nl_read_unlock(LOCK) do { } while(0) -#define nl_write_lock(LOCK) do { } while(0) -#define nl_write_unlock(LOCK) do { } while(0) -#endif - -static inline int rtnl_tc_calc_txtime64(int bufsize, uint64_t rate) -{ - return ((double) bufsize / (double) rate) * 1000000.0; -} - -static inline int rtnl_tc_calc_bufsize64(int txtime, uint64_t rate) -{ - return ((double) txtime * (double) rate) / 1000000.0; -} - -#endif diff --git a/include/nl-aux-core/nl-core.h b/include/nl-aux-core/nl-core.h index 1a02aaa9e..c336e34d1 100644 --- a/include/nl-aux-core/nl-core.h +++ b/include/nl-aux-core/nl-core.h @@ -5,6 +5,22 @@ #include "base/nl-base-utils.h" +#ifdef NL_DEBUG +#define NL_DBG(LVL, FMT, ARG...) \ + do { \ + if (LVL <= nl_debug) { \ + int _errsv = errno; \ + fprintf(stderr, "DBG<" #LVL ">%20s:%-4u %s: " FMT, \ + __FILE__, __LINE__, __func__, ##ARG); \ + errno = _errsv; \ + } \ + } while (0) +#else /* NL_DEBUG */ +#define NL_DBG(LVL, FMT, ARG...) \ + do { \ + } while (0) +#endif /* NL_DEBUG */ + struct nl_addr; void nl_addr_put(struct nl_addr *); #define _nl_auto_nl_addr _nl_auto(_nl_auto_nl_addr_fcn) diff --git a/include/nl-shared-core/cache-api.h b/include/nl-shared-core/cache-api.h index 38662b715..6491651f4 100644 --- a/include/nl-shared-core/cache-api.h +++ b/include/nl-shared-core/cache-api.h @@ -258,6 +258,29 @@ struct nl_cache_ops /** @} */ +struct nl_cache { + struct nl_list_head c_items; + int c_nitems; + int c_iarg1; + int c_iarg2; + int c_refcnt; + unsigned int c_flags; + struct nl_hash_table *hashtable; + struct nl_cache_ops *c_ops; +}; + +static inline const char *nl_cache_name(struct nl_cache *cache) +{ + return cache->c_ops ? cache->c_ops->co_name : "unknown"; +} + +struct nl_cache_assoc { + struct nl_cache *ca_cache; + change_func_t ca_change; + change_func_v2_t ca_change_v2; + void *ca_change_data; +}; + #ifdef __cplusplus } #endif diff --git a/include/nl-shared-core/nl-core.h b/include/nl-shared-core/nl-core.h index d4866b261..d7bec85c7 100644 --- a/include/nl-shared-core/nl-core.h +++ b/include/nl-shared-core/nl-core.h @@ -32,29 +32,6 @@ static inline int wait_for_ack(struct nl_sock *sk) return nl_wait_for_ack(sk); } -struct nl_cache { - struct nl_list_head c_items; - int c_nitems; - int c_iarg1; - int c_iarg2; - int c_refcnt; - unsigned int c_flags; - struct nl_hash_table *hashtable; - struct nl_cache_ops *c_ops; -}; - -static inline const char *nl_cache_name(struct nl_cache *cache) -{ - return cache->c_ops ? cache->c_ops->co_name : "unknown"; -} - -struct nl_cache_assoc { - struct nl_cache *ca_cache; - change_func_t ca_change; - change_func_v2_t ca_change_v2; - void *ca_change_data; -}; - #define LOOSE_COMPARISON 1 #define ID_COMPARISON 2 @@ -87,4 +64,23 @@ struct nl_msg { int nm_refcnt; }; +/*****************************************************************************/ + +extern const char *nl_strerror_l(int err); + +extern int __nl_read_num_str_file(const char *path, + int (*cb)(long, const char *)); + +extern int __trans_list_add(int, const char *, struct nl_list_head *); +extern void __trans_list_clear(struct nl_list_head *); + +extern char *__type2str(int, char *, size_t, const struct trans_tbl *, size_t); +extern int __str2type(const char *, const struct trans_tbl *, size_t); + +extern char *__list_type2str(int, char *, size_t, struct nl_list_head *); +extern int __list_str2type(const char *, struct nl_list_head *); + +extern char *__flags2str(int, char *, size_t, const struct trans_tbl *, size_t); +extern int __str2flags(const char *, const struct trans_tbl *, size_t); + #endif /* __NL_SHARED_CORE_NL_CORE_H__ */ diff --git a/lib/addr.c b/lib/addr.c index 3a15d0efd..673c2df0f 100644 --- a/lib/addr.c +++ b/lib/addr.c @@ -28,8 +28,7 @@ #include #include #include - -#include +#include #include "mpls.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/attr.c b/lib/attr.c index f0a125607..584992119 100644 --- a/lib/attr.c +++ b/lib/attr.c @@ -13,9 +13,8 @@ #include #include -#include - #include "nl-shared-core/nl-core.h" +#include "nl-aux-core/nl-core.h" /** * @ingroup msg diff --git a/lib/cache.c b/lib/cache.c index 1f3011eb0..89642980a 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -51,10 +51,11 @@ #include #include -#include - +#include "nl-core.h" #include "nl-shared-core/nl-core.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" +#include "nl-aux-core/nl-core.h" /** * @name Access Functions diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c index 73db014d2..81bdad19d 100644 --- a/lib/cache_mngr.c +++ b/lib/cache_mngr.c @@ -32,9 +32,10 @@ #include #include -#include - +#include "nl-core.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" +#include "nl-aux-core/nl-core.h" /** @cond SKIP */ struct nl_cache_mngr diff --git a/lib/cache_mngt.c b/lib/cache_mngt.c index c362dcaf9..758cb7bc1 100644 --- a/lib/cache_mngt.c +++ b/lib/cache_mngt.c @@ -25,10 +25,10 @@ #include #include -#include - #include "nl-shared-core/nl-core.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" +#include "nl-aux-core/nl-core.h" static struct nl_cache_ops *cache_ops; static NL_RW_LOCK(cache_ops_lock); diff --git a/lib/data.c b/lib/data.c index 6f9f25ae0..34fca8602 100644 --- a/lib/data.c +++ b/lib/data.c @@ -26,10 +26,10 @@ #include #include +#include +#include #include -#include - #include "nl-shared-core/nl-core.h" /** diff --git a/lib/error.c b/lib/error.c index d1a448ae5..9b6d80673 100644 --- a/lib/error.c +++ b/lib/error.c @@ -7,8 +7,6 @@ #include -#include - static const char *errmsg[NLE_MAX+1] = { [NLE_SUCCESS] = "Success", [NLE_FAILURE] = "Unspecific failure", diff --git a/lib/fib_lookup/lookup.c b/lib/fib_lookup/lookup.c index 1aaeee3ea..12f12936f 100644 --- a/lib/fib_lookup/lookup.c +++ b/lib/fib_lookup/lookup.c @@ -21,9 +21,9 @@ #include #include -#include - #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" +#include "nl-shared-core/nl-core.h" /** @cond SKIP */ struct flnl_result diff --git a/lib/fib_lookup/request.c b/lib/fib_lookup/request.c index ee4baef8d..67a7b7ccf 100644 --- a/lib/fib_lookup/request.c +++ b/lib/fib_lookup/request.c @@ -18,8 +18,6 @@ #include #include -#include - #include "nl-shared-core/nl-core.h" #include "nl-shared-core/object-api.h" diff --git a/lib/genl/ctrl.c b/lib/genl/ctrl.c index 689da7323..dd5f1097e 100644 --- a/lib/genl/ctrl.c +++ b/lib/genl/ctrl.c @@ -522,6 +522,12 @@ static struct genl_ops genl_ops = { extern struct nl_object_ops genl_family_ops; +#define GENL_FAMILY(id, name) \ + { \ + { id, NL_ACT_UNSPEC, name }, \ + END_OF_MSGTYPES_LIST, \ + } + static struct nl_cache_ops genl_ctrl_ops = { .co_name = "genl/family", .co_hdrsize = GENL_HDRSIZE(0), diff --git a/lib/genl/family.c b/lib/genl/family.c index cb0ec6dc4..53c9cbd77 100644 --- a/lib/genl/family.c +++ b/lib/genl/family.c @@ -21,6 +21,7 @@ #include "nl-genl.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/nl-core.h" /** @cond SKIP */ struct genl_family_op diff --git a/lib/genl/genl.c b/lib/genl/genl.c index 769c1e32c..2e52aae11 100644 --- a/lib/genl/genl.c +++ b/lib/genl/genl.c @@ -16,6 +16,7 @@ #include #include "nl-genl.h" +#include "nl-aux-core/nl-core.h" /** * @name Generic Netlink Socket diff --git a/lib/genl/nl-genl.h b/lib/genl/nl-genl.h index 194466d3c..0d702b09f 100644 --- a/lib/genl/nl-genl.h +++ b/lib/genl/nl-genl.h @@ -8,9 +8,8 @@ #include -#include - #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" #define GENL_HDRSIZE(hdrlen) (GENL_HDRLEN + (hdrlen)) diff --git a/lib/handlers.c b/lib/handlers.c index d921b3f33..5d1789ccf 100644 --- a/lib/handlers.c +++ b/lib/handlers.c @@ -26,9 +26,8 @@ #include #include -#include - #include "nl-core.h" +#include "nl-shared-core/nl-core.h" static void print_header_content(FILE *ofd, struct nlmsghdr *n) { diff --git a/lib/hashtable.c b/lib/hashtable.c index f6d49be85..17df838c3 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -11,7 +11,7 @@ #include #include -#include +#include "nl-aux-core/nl-core.h" /** * @ingroup core_types diff --git a/lib/idiag/idiag.c b/lib/idiag/idiag.c index 69a650e54..baca1c276 100644 --- a/lib/idiag/idiag.c +++ b/lib/idiag/idiag.c @@ -17,7 +17,7 @@ #include #include -#include +#include "nl-shared-core/nl-core.h" /** * @name Socket Creation diff --git a/lib/idiag/idiag_meminfo_obj.c b/lib/idiag/idiag_meminfo_obj.c index 795f3bef6..ebb9767dc 100644 --- a/lib/idiag/idiag_meminfo_obj.c +++ b/lib/idiag/idiag_meminfo_obj.c @@ -7,8 +7,6 @@ #include -#include - #include "nl-idiag.h" /** diff --git a/lib/idiag/idiag_msg_obj.c b/lib/idiag/idiag_msg_obj.c index f05e87fbf..338aa9286 100644 --- a/lib/idiag/idiag_msg_obj.c +++ b/lib/idiag/idiag_msg_obj.c @@ -13,10 +13,10 @@ #include #include -#include - #include "nl-idiag.h" #include "nl-shared-core/nl-core.h" +#include "nl-aux-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ struct idiagnl_msg { diff --git a/lib/idiag/idiag_req_obj.c b/lib/idiag/idiag_req_obj.c index 6d0c0c20a..282ca3505 100644 --- a/lib/idiag/idiag_req_obj.c +++ b/lib/idiag/idiag_req_obj.c @@ -9,8 +9,9 @@ #include #include - -#include +#include +#include +#include #include "nl-shared-core/object-api.h" diff --git a/lib/idiag/idiag_vegasinfo_obj.c b/lib/idiag/idiag_vegasinfo_obj.c index 0104eb5dd..f9e9408e4 100644 --- a/lib/idiag/idiag_vegasinfo_obj.c +++ b/lib/idiag/idiag_vegasinfo_obj.c @@ -7,8 +7,6 @@ #include -#include - #include "nl-idiag.h" /** diff --git a/lib/msg.c b/lib/msg.c index 677a22678..78a31646d 100644 --- a/lib/msg.c +++ b/lib/msg.c @@ -22,6 +22,8 @@ #include "nl-default.h" +#include + #include #include @@ -29,9 +31,10 @@ #include #include -#include - +#include "nl-core.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" +#include "nl-aux-core/nl-core.h" static size_t default_msg_size; diff --git a/lib/netfilter/ct.c b/lib/netfilter/ct.c index 3b54b3d72..8473d69a8 100644 --- a/lib/netfilter/ct.c +++ b/lib/netfilter/ct.c @@ -24,10 +24,9 @@ #include #include -#include - #include "nl-netfilter.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" static struct nl_cache_ops nfnl_ct_ops; diff --git a/lib/netfilter/ct_obj.c b/lib/netfilter/ct_obj.c index 59ade2cd3..f4537039a 100644 --- a/lib/netfilter/ct_obj.c +++ b/lib/netfilter/ct_obj.c @@ -16,8 +16,6 @@ #include #include -#include - #include "nl-shared-core/object-api.h" #include "nl-netfilter.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/netfilter/exp.c b/lib/netfilter/exp.c index b69ae5b9f..43335f787 100644 --- a/lib/netfilter/exp.c +++ b/lib/netfilter/exp.c @@ -25,10 +25,9 @@ #include #include -#include - #include "nl-netfilter.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" static struct nl_cache_ops nfnl_exp_ops; diff --git a/lib/netfilter/exp_obj.c b/lib/netfilter/exp_obj.c index c24eacb44..7c1750c49 100644 --- a/lib/netfilter/exp_obj.c +++ b/lib/netfilter/exp_obj.c @@ -18,8 +18,6 @@ #include #include -#include - #include "nl-shared-core/object-api.h" #include "nl-netfilter.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/netfilter/log.c b/lib/netfilter/log.c index c67de1697..5556df806 100644 --- a/lib/netfilter/log.c +++ b/lib/netfilter/log.c @@ -21,9 +21,8 @@ #include #include -#include - #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** * @name Log Commands diff --git a/lib/netfilter/log_msg.c b/lib/netfilter/log_msg.c index 558a08118..3e3ac604f 100644 --- a/lib/netfilter/log_msg.c +++ b/lib/netfilter/log_msg.c @@ -23,9 +23,8 @@ #include #include -#include - #include "nl-netfilter.h" +#include "nl-shared-core/cache-api.h" static struct nla_policy log_msg_policy[NFULA_MAX+1] = { [NFULA_PACKET_HDR] = { diff --git a/lib/netfilter/log_msg_obj.c b/lib/netfilter/log_msg_obj.c index a7b2c2e39..b3c140a32 100644 --- a/lib/netfilter/log_msg_obj.c +++ b/lib/netfilter/log_msg_obj.c @@ -11,8 +11,7 @@ #include #include #include - -#include +#include #include "nl-shared-core/object-api.h" #include "nl-netfilter.h" diff --git a/lib/netfilter/log_obj.c b/lib/netfilter/log_obj.c index cc1406927..f14ca121b 100644 --- a/lib/netfilter/log_obj.c +++ b/lib/netfilter/log_obj.c @@ -11,9 +11,9 @@ #include #include -#include - #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" +#include "nl-shared-core/nl-core.h" /** @cond SKIP */ struct nfnl_log { diff --git a/lib/netfilter/netfilter.c b/lib/netfilter/netfilter.c index 908c7003d..f008d9d0a 100644 --- a/lib/netfilter/netfilter.c +++ b/lib/netfilter/netfilter.c @@ -9,7 +9,7 @@ #include -#include +#include "nl-shared-core/nl-core.h" static const struct trans_tbl nfnl_verdicts[] = { __ADD(NF_DROP, NF_DROP), diff --git a/lib/netfilter/nfnl.c b/lib/netfilter/nfnl.c index 631132942..c70827b82 100644 --- a/lib/netfilter/nfnl.c +++ b/lib/netfilter/nfnl.c @@ -61,8 +61,10 @@ #include #include +#include +#include -#include +#include "nl-aux-core/nl-core.h" /** * @name Socket Creating diff --git a/lib/netfilter/queue.c b/lib/netfilter/queue.c index 1ef7f3a97..6e926a4a8 100644 --- a/lib/netfilter/queue.c +++ b/lib/netfilter/queue.c @@ -20,9 +20,8 @@ #include #include -#include - #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" struct nl_sock *nfnl_queue_socket_alloc(void) { diff --git a/lib/netfilter/queue_msg.c b/lib/netfilter/queue_msg.c index 03d42fb82..5f5d3facc 100644 --- a/lib/netfilter/queue_msg.c +++ b/lib/netfilter/queue_msg.c @@ -21,10 +21,9 @@ #include #include -#include - #include "nl-netfilter.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" static struct nl_cache_ops nfnl_queue_msg_ops; diff --git a/lib/netfilter/queue_msg_obj.c b/lib/netfilter/queue_msg_obj.c index ea4e3c0df..98d1c5185 100644 --- a/lib/netfilter/queue_msg_obj.c +++ b/lib/netfilter/queue_msg_obj.c @@ -10,10 +10,10 @@ #include #include #include - -#include +#include #include "nl-netfilter.h" +#include "nl-shared-core/nl-core.h" /** @cond SKIP */ #define QUEUE_MSG_ATTR_GROUP (1UL << 0) diff --git a/lib/netfilter/queue_obj.c b/lib/netfilter/queue_obj.c index 585269259..50e67689a 100644 --- a/lib/netfilter/queue_obj.c +++ b/lib/netfilter/queue_obj.c @@ -15,9 +15,8 @@ #include #include -#include - #include "nl-shared-core/object-api.h" +#include "nl-shared-core/nl-core.h" /** @cond SKIP */ struct nfnl_queue { diff --git a/lib/nl-core.h b/lib/nl-core.h index 182e213b7..42d76299e 100644 --- a/lib/nl-core.h +++ b/lib/nl-core.h @@ -6,8 +6,6 @@ #ifndef __LIB_NL_CORE_H__ #define __LIB_NL_CORE_H__ -#include - struct nl_cb { nl_recvmsg_msg_cb_t cb_set[NL_CB_TYPE_MAX+1]; @@ -54,4 +52,9 @@ uint32_t _nl_socket_set_local_port_no_release(struct nl_sock *sk, int generate_o 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); +extern int nl_cache_parse(struct nl_cache_ops *, struct sockaddr_nl *, + struct nlmsghdr *, struct nl_parser_param *); + +extern void dump_from_ops(struct nl_object *, struct nl_dump_params *); + #endif /* __LIB_NL_CORE_H__ */ diff --git a/lib/nl.c b/lib/nl.c index 2fdaab587..7afa96142 100644 --- a/lib/nl.c +++ b/lib/nl.c @@ -29,10 +29,10 @@ #include #include -#include - #include "nl-core.h" #include "nl-shared-core/nl-core.h" +#include "nl-aux-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** * @defgroup core_types Data Types diff --git a/lib/object.c b/lib/object.c index e7607523f..cdb99eef9 100644 --- a/lib/object.c +++ b/lib/object.c @@ -28,10 +28,11 @@ #include #include -#include - +#include "nl-core.h" #include "nl-shared-core/nl-core.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" +#include "nl-aux-core/nl-core.h" static inline struct nl_object_ops *obj_ops(struct nl_object *obj) { diff --git a/lib/route/act.c b/lib/route/act.c index 8e0960993..b8aa55df1 100644 --- a/lib/route/act.c +++ b/lib/route/act.c @@ -16,11 +16,10 @@ #include #include -#include - #include "nl-route.h" #include "tc-api.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" static struct nl_object_ops act_obj_ops; static struct nl_cache_ops rtnl_act_ops; diff --git a/lib/route/act/gact.c b/lib/route/act/gact.c index 6ce25a737..2e04c5a35 100644 --- a/lib/route/act/gact.c +++ b/lib/route/act/gact.c @@ -17,8 +17,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_gact { diff --git a/lib/route/act/mirred.c b/lib/route/act/mirred.c index a857fbe33..72ead6b0c 100644 --- a/lib/route/act/mirred.c +++ b/lib/route/act/mirred.c @@ -17,8 +17,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_mirred { diff --git a/lib/route/act/nat.c b/lib/route/act/nat.c index 137bcff1b..ffc9d2be8 100644 --- a/lib/route/act/nat.c +++ b/lib/route/act/nat.c @@ -18,8 +18,6 @@ #include #include -#include - #include "tc-api.h" static struct nla_policy nat_policy[TCA_NAT_MAX + 1] = { diff --git a/lib/route/act/skbedit.c b/lib/route/act/skbedit.c index 588f053e8..32a3506ff 100644 --- a/lib/route/act/skbedit.c +++ b/lib/route/act/skbedit.c @@ -17,8 +17,6 @@ #include #include -#include - #include "nl-route.h" #include "tc-api.h" diff --git a/lib/route/act/vlan.c b/lib/route/act/vlan.c index f86a35db6..71f16e52b 100644 --- a/lib/route/act/vlan.c +++ b/lib/route/act/vlan.c @@ -19,8 +19,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_vlan diff --git a/lib/route/addr.c b/lib/route/addr.c index 190e5fa94..cb2c7818a 100644 --- a/lib/route/addr.c +++ b/lib/route/addr.c @@ -109,10 +109,9 @@ #include #include -#include - #include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ struct rtnl_addr_cacheinfo { diff --git a/lib/route/class.c b/lib/route/class.c index 34f027691..29ba80946 100644 --- a/lib/route/class.c +++ b/lib/route/class.c @@ -17,8 +17,6 @@ #include #include -#include - #include "nl-route.h" #include "tc-api.h" diff --git a/lib/route/classid.c b/lib/route/classid.c index 2740b0401..f5a75f07f 100644 --- a/lib/route/classid.c +++ b/lib/route/classid.c @@ -11,11 +11,15 @@ #include "nl-default.h" +#include +#include + #include #include #include -#include +#include "nl-route.h" +#include "nl-aux-core/nl-core.h" struct classid_map { diff --git a/lib/route/cls.c b/lib/route/cls.c index f44a55d7d..8f970b120 100644 --- a/lib/route/cls.c +++ b/lib/route/cls.c @@ -11,13 +11,13 @@ #include "nl-default.h" +#include + #include #include #include #include -#include - #include "nl-route.h" #include "tc-api.h" diff --git a/lib/route/cls/basic.c b/lib/route/cls/basic.c index b1e392619..ed83ca1c1 100644 --- a/lib/route/cls/basic.c +++ b/lib/route/cls/basic.c @@ -24,8 +24,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_basic diff --git a/lib/route/cls/cgroup.c b/lib/route/cls/cgroup.c index cd8948318..3534281a2 100644 --- a/lib/route/cls/cgroup.c +++ b/lib/route/cls/cgroup.c @@ -19,8 +19,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/cls/ematch.c b/lib/route/cls/ematch.c index 252762389..5a5a2104b 100644 --- a/lib/route/cls/ematch.c +++ b/lib/route/cls/ematch.c @@ -19,9 +19,8 @@ #include #include -#include - #include "nl-route.h" +#include "nl-aux-core/nl-core.h" #include "ematch_syntax.h" #include "ematch_grammar.h" diff --git a/lib/route/cls/ematch/cmp.c b/lib/route/cls/ematch/cmp.c index d0eb38c39..9feb2e586 100644 --- a/lib/route/cls/ematch/cmp.c +++ b/lib/route/cls/ematch/cmp.c @@ -18,8 +18,6 @@ #include #include -#include - void rtnl_ematch_cmp_set(struct rtnl_ematch *e, struct tcf_em_cmp *cfg) { memcpy(rtnl_ematch_data(e), cfg, sizeof(*cfg)); diff --git a/lib/route/cls/ematch/container.c b/lib/route/cls/ematch/container.c index 71aba58db..ea2d16667 100644 --- a/lib/route/cls/ematch/container.c +++ b/lib/route/cls/ematch/container.c @@ -8,8 +8,6 @@ #include #include -#include - #include "nl-route.h" static int container_parse(struct rtnl_ematch *e, void *data, size_t len __attribute__((unused))) diff --git a/lib/route/cls/ematch/meta.c b/lib/route/cls/ematch/meta.c index 2cfc3e810..ea4d5dcb3 100644 --- a/lib/route/cls/ematch/meta.c +++ b/lib/route/cls/ematch/meta.c @@ -18,7 +18,7 @@ #include #include -#include +#include "nl-shared-core/nl-core.h" struct rtnl_meta_value { diff --git a/lib/route/cls/ematch/nbyte.c b/lib/route/cls/ematch/nbyte.c index d7c6b0610..d0ab84bac 100644 --- a/lib/route/cls/ematch/nbyte.c +++ b/lib/route/cls/ematch/nbyte.c @@ -18,8 +18,6 @@ #include #include -#include - struct nbyte_data { struct tcf_em_nbyte cfg; diff --git a/lib/route/cls/ematch/text.c b/lib/route/cls/ematch/text.c index a1fcc1b2c..d7a233f8d 100644 --- a/lib/route/cls/ematch/text.c +++ b/lib/route/cls/ematch/text.c @@ -18,8 +18,6 @@ #include #include -#include - struct text_data { struct tcf_em_text cfg; diff --git a/lib/route/cls/ematch_grammar.l b/lib/route/cls/ematch_grammar.l index 6b2b8b0d3..1035079ce 100644 --- a/lib/route/cls/ematch_grammar.l +++ b/lib/route/cls/ematch_grammar.l @@ -4,11 +4,14 @@ */ %{ - #include + #include + #include #include #include - #include + + #include "nl-route.h" + #include "ematch_syntax.h" int ematch_get_column(yyscan_t); diff --git a/lib/route/cls/ematch_syntax.y b/lib/route/cls/ematch_syntax.y index 7328d6313..0031aeea9 100644 --- a/lib/route/cls/ematch_syntax.y +++ b/lib/route/cls/ematch_syntax.y @@ -4,7 +4,9 @@ */ %{ -#include +#include +#include + #include #include #include @@ -13,15 +15,13 @@ #include #include #include -#include -#include + +#include "nl-route.h" #define META_ALLOC rtnl_meta_value_alloc_id #define META_ID(name) TCF_META_ID_##name #define META_INT TCF_META_TYPE_INT #define META_VAR TCF_META_TYPE_VAR - -#include "nl-route.h" %} %code requires { diff --git a/lib/route/cls/flower.c b/lib/route/cls/flower.c index ceec90a63..e0a98e977 100644 --- a/lib/route/cls/flower.c +++ b/lib/route/cls/flower.c @@ -5,6 +5,8 @@ #include "nl-default.h" +#include + #include #include #include @@ -12,8 +14,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/cls/fw.c b/lib/route/cls/fw.c index 2b91ab92f..01be33fd8 100644 --- a/lib/route/cls/fw.c +++ b/lib/route/cls/fw.c @@ -18,8 +18,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/cls/mall.c b/lib/route/cls/mall.c index 69d700c15..04ec58a24 100644 --- a/lib/route/cls/mall.c +++ b/lib/route/cls/mall.c @@ -19,8 +19,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_mall { diff --git a/lib/route/cls/police.c b/lib/route/cls/police.c index d184c1654..ef6924fee 100644 --- a/lib/route/cls/police.c +++ b/lib/route/cls/police.c @@ -10,7 +10,7 @@ #include #include -#include +#include "nl-shared-core/nl-core.h" /** * @name Policer Type diff --git a/lib/route/cls/u32.c b/lib/route/cls/u32.c index 50934f021..ab8b97745 100644 --- a/lib/route/cls/u32.c +++ b/lib/route/cls/u32.c @@ -21,8 +21,6 @@ #include #include -#include - #include "tc-api.h" #include "nl-aux-route/nl-route.h" diff --git a/lib/route/link.c b/lib/route/link.c index 9e27b5269..b8239dd98 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -14,6 +14,8 @@ #include "nl-default.h" +#include + #include #include #include @@ -23,10 +25,9 @@ #include #include -#include - #include "nl-aux-route/nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" #include "nl-route.h" #include "link-sriov.h" #include "link/link-api.h" diff --git a/lib/route/link/api.c b/lib/route/link/api.c index 3dc0182d3..abc9e6a75 100644 --- a/lib/route/link/api.c +++ b/lib/route/link/api.c @@ -39,8 +39,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/bonding.c b/lib/route/link/bonding.c index c470f0670..640a62cac 100644 --- a/lib/route/link/bonding.c +++ b/lib/route/link/bonding.c @@ -19,8 +19,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/bridge.c b/lib/route/link/bridge.c index da0b2214e..a17d7cc6f 100644 --- a/lib/route/link/bridge.c +++ b/lib/route/link/bridge.c @@ -20,8 +20,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/route/link/bridge_info.c b/lib/route/link/bridge_info.c index 2823a7048..61b885f0f 100644 --- a/lib/route/link/bridge_info.c +++ b/lib/route/link/bridge_info.c @@ -15,8 +15,6 @@ #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/can.c b/lib/route/link/can.c index c2bdb5c73..290d42c73 100644 --- a/lib/route/link/can.c +++ b/lib/route/link/can.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/dummy.c b/lib/route/link/dummy.c index 514a0cf62..83d6ba79f 100644 --- a/lib/route/link/dummy.c +++ b/lib/route/link/dummy.c @@ -17,8 +17,6 @@ #include -#include - #include "link-api.h" static struct rtnl_link_info_ops dummy_info_ops = { diff --git a/lib/route/link/geneve.c b/lib/route/link/geneve.c index 1e23ea24e..61dd1f1fe 100644 --- a/lib/route/link/geneve.c +++ b/lib/route/link/geneve.c @@ -23,8 +23,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ifb.c b/lib/route/link/ifb.c index 9c0f5c895..d5fc6855f 100644 --- a/lib/route/link/ifb.c +++ b/lib/route/link/ifb.c @@ -17,8 +17,6 @@ #include -#include - #include "link-api.h" static struct rtnl_link_info_ops ifb_info_ops = { diff --git a/lib/route/link/inet.c b/lib/route/link/inet.c index a5ed46fdd..7ed705e21 100644 --- a/lib/route/link/inet.c +++ b/lib/route/link/inet.c @@ -53,13 +53,13 @@ #include "nl-default.h" +#include + #include #include #include #include -#include - #include "link-api.h" /** @cond SKIP */ diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c index 7a89f687f..b03e47d03 100644 --- a/lib/route/link/inet6.c +++ b/lib/route/link/inet6.c @@ -5,13 +5,14 @@ #include "nl-default.h" +#include +#include + #include #include #include #include -#include - #include "nl-route.h" #include "link-api.h" #include "nl-priv-static-route/nl-priv-static-route.h" diff --git a/lib/route/link/ip6gre.c b/lib/route/link/ip6gre.c index d518785c5..51d4609cd 100644 --- a/lib/route/link/ip6gre.c +++ b/lib/route/link/ip6gre.c @@ -24,8 +24,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ip6tnl.c b/lib/route/link/ip6tnl.c index 0c5a4f600..bba79ea0e 100644 --- a/lib/route/link/ip6tnl.c +++ b/lib/route/link/ip6tnl.c @@ -29,8 +29,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ip6vti.c b/lib/route/link/ip6vti.c index 617f8a4de..b6c7a1b2f 100644 --- a/lib/route/link/ip6vti.c +++ b/lib/route/link/ip6vti.c @@ -24,8 +24,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ipgre.c b/lib/route/link/ipgre.c index 79eb8ff1e..bd3cc40f5 100644 --- a/lib/route/link/ipgre.c +++ b/lib/route/link/ipgre.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ipip.c b/lib/route/link/ipip.c index 8783667ad..74db8901b 100644 --- a/lib/route/link/ipip.c +++ b/lib/route/link/ipip.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ipvlan.c b/lib/route/link/ipvlan.c index 5f85b442e..807942bb6 100644 --- a/lib/route/link/ipvlan.c +++ b/lib/route/link/ipvlan.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ipvti.c b/lib/route/link/ipvti.c index cb8586cee..fd578959f 100644 --- a/lib/route/link/ipvti.c +++ b/lib/route/link/ipvti.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/link-api.h b/lib/route/link/link-api.h index e87537a2f..b25d6c53f 100644 --- a/lib/route/link/link-api.h +++ b/lib/route/link/link-api.h @@ -7,6 +7,7 @@ #define NETLINK_LINK_API_H_ #include +#include #include "nl-shared-core/nl-core.h" @@ -193,4 +194,6 @@ extern int rtnl_link_info_data_compare(struct rtnl_link *a, } #endif +extern struct rtnl_link *link_lookup(struct nl_cache *cache, int ifindex); + #endif diff --git a/lib/route/link/macsec.c b/lib/route/link/macsec.c index 8118da50c..1fb8762b9 100644 --- a/lib/route/link/macsec.c +++ b/lib/route/link/macsec.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/route/link/macvlan.c b/lib/route/link/macvlan.c index d6580f404..be9a2e2b7 100644 --- a/lib/route/link/macvlan.c +++ b/lib/route/link/macvlan.c @@ -20,6 +20,7 @@ #include "nl-default.h" #include +#include #include #include @@ -29,8 +30,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/ppp.c b/lib/route/link/ppp.c index 11cd1ee47..34ca5f66b 100644 --- a/lib/route/link/ppp.c +++ b/lib/route/link/ppp.c @@ -19,8 +19,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/sit.c b/lib/route/link/sit.c index 031a72746..69dd3163d 100644 --- a/lib/route/link/sit.c +++ b/lib/route/link/sit.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/sriov.c b/lib/route/link/sriov.c index 4c4c85ac3..d47d1ddfc 100644 --- a/lib/route/link/sriov.c +++ b/lib/route/link/sriov.c @@ -28,8 +28,6 @@ #include #include -#include - #include "nl-route.h" #include "link-sriov.h" #include "link-api.h" diff --git a/lib/route/link/team.c b/lib/route/link/team.c index d3a04e6b1..0f1161be9 100644 --- a/lib/route/link/team.c +++ b/lib/route/link/team.c @@ -19,8 +19,6 @@ #include #include -#include - #include "link-api.h" /** diff --git a/lib/route/link/veth.c b/lib/route/link/veth.c index 871c9b6a4..be4b795cd 100644 --- a/lib/route/link/veth.c +++ b/lib/route/link/veth.c @@ -28,8 +28,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/vlan.c b/lib/route/link/vlan.c index 2ad4b8e15..60e4358fd 100644 --- a/lib/route/link/vlan.c +++ b/lib/route/link/vlan.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/vrf.c b/lib/route/link/vrf.c index 4583efebd..810ba90ce 100644 --- a/lib/route/link/vrf.c +++ b/lib/route/link/vrf.c @@ -30,8 +30,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/vxlan.c b/lib/route/link/vxlan.c index 332d4d4e8..4606dd5f5 100644 --- a/lib/route/link/vxlan.c +++ b/lib/route/link/vxlan.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/link/xfrmi.c b/lib/route/link/xfrmi.c index 37e7f705a..09ceb809f 100644 --- a/lib/route/link/xfrmi.c +++ b/lib/route/link/xfrmi.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nl-route.h" #include "link-api.h" diff --git a/lib/route/mdb.c b/lib/route/mdb.c index bdfd513ca..925303ebe 100644 --- a/lib/route/mdb.c +++ b/lib/route/mdb.c @@ -13,10 +13,10 @@ #include #include -#include - +#include "nl-route.h" #include "nl-aux-route/nl-route.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ #define MDB_ATTR_IFINDEX 0x000001 diff --git a/lib/route/neigh.c b/lib/route/neigh.c index cc8186984..f746a2517 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -153,10 +153,9 @@ #include #include -#include - #include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ struct rtnl_ncacheinfo { diff --git a/lib/route/neightbl.c b/lib/route/neightbl.c index 344c8e6be..59eefd14d 100644 --- a/lib/route/neightbl.c +++ b/lib/route/neightbl.c @@ -18,10 +18,9 @@ #include #include -#include - #include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" struct rtnl_neightbl_parms { /** diff --git a/lib/route/netconf.c b/lib/route/netconf.c index be69236f2..614d3576f 100644 --- a/lib/route/netconf.c +++ b/lib/route/netconf.c @@ -21,9 +21,9 @@ #include #include -#include - +#include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" #include "nl-shared-core/object-api.h" /** @cond SKIP */ diff --git a/lib/route/nexthop.c b/lib/route/nexthop.c index 37fc06005..0cbc3cf9b 100644 --- a/lib/route/nexthop.c +++ b/lib/route/nexthop.c @@ -16,10 +16,9 @@ #include #include -#include - #include "nexthop-encap.h" #include "nl-route.h" +#include "nl-shared-core/nl-core.h" /** @cond SKIP */ #define NH_ATTR_FLAGS 0x000001 diff --git a/lib/route/nexthop_encap.c b/lib/route/nexthop_encap.c index 20c645b29..226b901a6 100644 --- a/lib/route/nexthop_encap.c +++ b/lib/route/nexthop_encap.c @@ -4,8 +4,6 @@ #include -#include - #include "nl-route.h" #include "nexthop-encap.h" diff --git a/lib/route/nh.c b/lib/route/nh.c index 101180c7c..83eae9aa2 100644 --- a/lib/route/nh.c +++ b/lib/route/nh.c @@ -11,11 +11,10 @@ #include #include -#include - #include "nl-aux-route/nl-route.h" #include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ struct rtnl_nh { diff --git a/lib/route/nh_encap_mpls.c b/lib/route/nh_encap_mpls.c index 6cf6dc550..a7802917c 100644 --- a/lib/route/nh_encap_mpls.c +++ b/lib/route/nh_encap_mpls.c @@ -7,8 +7,6 @@ #include -#include - #include "nl-route.h" #include "nexthop-encap.h" diff --git a/lib/route/nl-route.h b/lib/route/nl-route.h index 1c0c742d6..573d77c87 100644 --- a/lib/route/nl-route.h +++ b/lib/route/nl-route.h @@ -7,8 +7,11 @@ #ifndef __LIB_ROUTE_NL_ROUTE_H__ #define __LIB_ROUTE_NL_ROUTE_H__ +#include + #include "nl-shared-core/object-api.h" #include "nl-priv-dynamic-route/nl-priv-dynamic-route.h" +#include "nl-aux-core/nl-core.h" /*****************************************************************************/ @@ -159,4 +162,30 @@ static inline void rtnl_rcopy_ratespec(struct tc_ratespec *dst, (uint32_t)src->rs_rate64; } +/*****************************************************************************/ + +static inline int build_sysconf_path(char **strp, const char *filename) +{ + char *sysconfdir; + + sysconfdir = getenv("NLSYSCONFDIR"); + + if (!sysconfdir) + sysconfdir = SYSCONFDIR; + + return asprintf(strp, "%s/%s", sysconfdir, filename); +} + +/*****************************************************************************/ + +static inline int rtnl_tc_calc_txtime64(int bufsize, uint64_t rate) +{ + return ((double)bufsize / (double)rate) * 1000000.0; +} + +static inline int rtnl_tc_calc_bufsize64(int txtime, uint64_t rate) +{ + return ((double)txtime * (double)rate) / 1000000.0; +} + #endif /* __LIB_ROUTE_NL_ROUTE_H__ */ diff --git a/lib/route/pktloc.c b/lib/route/pktloc.c index a82dac902..7f320d9bb 100644 --- a/lib/route/pktloc.c +++ b/lib/route/pktloc.c @@ -27,11 +27,13 @@ #include "nl-default.h" +#include + #include #include #include -#include +#include "nl-route.h" #include "pktloc_syntax.h" #include "pktloc_grammar.h" diff --git a/lib/route/pktloc_grammar.l b/lib/route/pktloc_grammar.l index c5757aec6..2db229d12 100644 --- a/lib/route/pktloc_grammar.l +++ b/lib/route/pktloc_grammar.l @@ -1,9 +1,10 @@ %{ - #include + #include + #include #include #include - #include + #include "pktloc_syntax.h" int pktloc_get_column(yyscan_t); diff --git a/lib/route/pktloc_syntax.y b/lib/route/pktloc_syntax.y index dac149dc8..661463a4a 100644 --- a/lib/route/pktloc_syntax.y +++ b/lib/route/pktloc_syntax.y @@ -1,8 +1,9 @@ %{ -#include #include #include #include + +#include "nl-route.h" %} %locations diff --git a/lib/route/qdisc.c b/lib/route/qdisc.c index 8a5db4ffb..67ea358de 100644 --- a/lib/route/qdisc.c +++ b/lib/route/qdisc.c @@ -18,8 +18,6 @@ #include #include -#include - #include "tc-api.h" static struct nl_cache_ops rtnl_qdisc_ops; diff --git a/lib/route/qdisc/blackhole.c b/lib/route/qdisc/blackhole.c index 523ace916..8d8f4babc 100644 --- a/lib/route/qdisc/blackhole.c +++ b/lib/route/qdisc/blackhole.c @@ -13,8 +13,6 @@ #include -#include - #include "tc-api.h" static struct rtnl_tc_ops blackhole_ops = { diff --git a/lib/route/qdisc/cbq.c b/lib/route/qdisc/cbq.c index 6a88a8bc1..b9a669604 100644 --- a/lib/route/qdisc/cbq.c +++ b/lib/route/qdisc/cbq.c @@ -13,8 +13,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_cbq { diff --git a/lib/route/qdisc/dsmark.c b/lib/route/qdisc/dsmark.c index 994a1e5c1..f5718f9ce 100644 --- a/lib/route/qdisc/dsmark.c +++ b/lib/route/qdisc/dsmark.c @@ -18,8 +18,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/fifo.c b/lib/route/qdisc/fifo.c index 2044e1a48..99768037b 100644 --- a/lib/route/qdisc/fifo.c +++ b/lib/route/qdisc/fifo.c @@ -30,8 +30,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/fq_codel.c b/lib/route/qdisc/fq_codel.c index d2915a3e4..a44ab222d 100644 --- a/lib/route/qdisc/fq_codel.c +++ b/lib/route/qdisc/fq_codel.c @@ -18,8 +18,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/hfsc.c b/lib/route/qdisc/hfsc.c index d6d458328..49c24c7d5 100644 --- a/lib/route/qdisc/hfsc.c +++ b/lib/route/qdisc/hfsc.c @@ -20,8 +20,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/htb.c b/lib/route/qdisc/htb.c index ac8a204a7..28061b906 100644 --- a/lib/route/qdisc/htb.c +++ b/lib/route/qdisc/htb.c @@ -22,8 +22,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/ingress.c b/lib/route/qdisc/ingress.c index 979ce672d..5363c2623 100644 --- a/lib/route/qdisc/ingress.c +++ b/lib/route/qdisc/ingress.c @@ -16,8 +16,6 @@ #include #include -#include - #include "tc-api.h" struct dumb { diff --git a/lib/route/qdisc/mqprio.c b/lib/route/qdisc/mqprio.c index d518f8cba..5e9d08f8a 100644 --- a/lib/route/qdisc/mqprio.c +++ b/lib/route/qdisc/mqprio.c @@ -10,8 +10,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/netem.c b/lib/route/qdisc/netem.c index 8f07452f0..3839ac894 100644 --- a/lib/route/qdisc/netem.c +++ b/lib/route/qdisc/netem.c @@ -19,8 +19,6 @@ #include #include -#include - #include "tc-api.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/route/qdisc/plug.c b/lib/route/qdisc/plug.c index 1ab4bbef4..f01080201 100644 --- a/lib/route/qdisc/plug.c +++ b/lib/route/qdisc/plug.c @@ -60,8 +60,6 @@ #include #include -#include - #include "tc-api.h" struct rtnl_plug { diff --git a/lib/route/qdisc/prio.c b/lib/route/qdisc/prio.c index c2121c97f..e73384539 100644 --- a/lib/route/qdisc/prio.c +++ b/lib/route/qdisc/prio.c @@ -27,8 +27,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/red.c b/lib/route/qdisc/red.c index 29d05bd37..e793b7806 100644 --- a/lib/route/qdisc/red.c +++ b/lib/route/qdisc/red.c @@ -17,8 +17,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/sfq.c b/lib/route/qdisc/sfq.c index d266676dc..437988932 100644 --- a/lib/route/qdisc/sfq.c +++ b/lib/route/qdisc/sfq.c @@ -24,8 +24,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/qdisc/tbf.c b/lib/route/qdisc/tbf.c index e4db33b29..67996eb57 100644 --- a/lib/route/qdisc/tbf.c +++ b/lib/route/qdisc/tbf.c @@ -19,8 +19,6 @@ #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/route/route.c b/lib/route/route.c index 50b863f45..e74c675c1 100644 --- a/lib/route/route.c +++ b/lib/route/route.c @@ -20,9 +20,9 @@ #include #include -#include - +#include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" #include "nl-aux-route/nl-route.h" static struct nl_cache_ops rtnl_route_ops; diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index 3909e4123..cd0d495ff 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -38,8 +38,6 @@ #include #include -#include - #include "nl-route.h" #include "nl-aux-route/nl-route.h" #include "nl-shared-core/nl-core.h" diff --git a/lib/route/route_utils.c b/lib/route/route_utils.c index 5dfa9dd20..413ea2950 100644 --- a/lib/route/route_utils.c +++ b/lib/route/route_utils.c @@ -38,7 +38,7 @@ #include #include -#include +#include "nl-shared-core/nl-core.h" /** * @name Routing Table Identifier Translations diff --git a/lib/route/rtnl.c b/lib/route/rtnl.c index 5b2c7e977..01351b635 100644 --- a/lib/route/rtnl.c +++ b/lib/route/rtnl.c @@ -14,7 +14,7 @@ #include #include -#include +#include "nl-shared-core/nl-core.h" /** * @name Sending diff --git a/lib/route/rule.c b/lib/route/rule.c index fdbb22fab..8f0a42c3c 100644 --- a/lib/route/rule.c +++ b/lib/route/rule.c @@ -21,10 +21,9 @@ #include #include -#include - #include "nl-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ struct rtnl_rule { diff --git a/lib/route/tc-api.h b/lib/route/tc-api.h index c8bb48f73..b797c073a 100644 --- a/lib/route/tc-api.h +++ b/lib/route/tc-api.h @@ -13,6 +13,7 @@ #include "nl-route.h" #include "nl-hidden-route/nl-hidden-route.h" #include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /*****************************************************************************/ diff --git a/lib/route/tc.c b/lib/route/tc.c index 6b0c37275..97487cdf7 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -11,14 +11,16 @@ #include "nl-default.h" +#include +#include +#include + #include #include #include #include #include -#include - #include "tc-api.h" /** @cond SKIP */ diff --git a/lib/socket.c b/lib/socket.c index fc2999130..918ee93f5 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -23,7 +23,8 @@ #include "nl-default.h" -#include "sys/socket.h" +#include +#include #include #include @@ -31,10 +32,13 @@ #include #include -#include - #include "nl-core.h" #include "nl-shared-core/nl-core.h" +#include "nl-aux-core/nl-core.h" + +#ifndef SOL_NETLINK +#define SOL_NETLINK 270 +#endif static int default_cb = NL_CB_DEFAULT; diff --git a/lib/utils.c b/lib/utils.c index 73e2e0555..17be64703 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -24,13 +24,15 @@ #include #include +#include #include #include -#include - +#include "nl-core.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/nl-core.h" +#include "nl-aux-core/nl-core.h" /** * Global variable indicating the desired level of debugging output. @@ -121,6 +123,12 @@ int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *)) return 0; } +struct trans_list { + int i; + char *a; + struct nl_list_head list; +}; + const char *nl_strerror_l(int err) { const char *buf; diff --git a/lib/xfrm/ae.c b/lib/xfrm/ae.c index 84c523fa5..49198c8da 100644 --- a/lib/xfrm/ae.c +++ b/lib/xfrm/ae.c @@ -129,10 +129,10 @@ #include -#include - #include "nl-xfrm.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ diff --git a/lib/xfrm/lifetime.c b/lib/xfrm/lifetime.c index f955babae..17c988358 100644 --- a/lib/xfrm/lifetime.c +++ b/lib/xfrm/lifetime.c @@ -51,8 +51,6 @@ #include -#include - #include "nl-xfrm.h" static void ltime_cfg_destroy(struct xfrmnl_ltime_cfg* ltime) diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c index 4c7f64505..355e98931 100644 --- a/lib/xfrm/sa.c +++ b/lib/xfrm/sa.c @@ -50,10 +50,10 @@ #include #include -#include - #include "nl-xfrm.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" /** @cond SKIP */ diff --git a/lib/xfrm/selector.c b/lib/xfrm/selector.c index 18ec498bc..4f14b7b0f 100644 --- a/lib/xfrm/selector.c +++ b/lib/xfrm/selector.c @@ -51,8 +51,6 @@ #include -#include - /* Selector, used as selector both on policy rules (SPD) and SAs. */ struct xfrmnl_sel { uint32_t refcnt; diff --git a/lib/xfrm/sp.c b/lib/xfrm/sp.c index 8267144d4..9d9d69866 100644 --- a/lib/xfrm/sp.c +++ b/lib/xfrm/sp.c @@ -49,10 +49,10 @@ #include #include -#include - #include "nl-xfrm.h" #include "nl-shared-core/object-api.h" +#include "nl-shared-core/nl-core.h" +#include "nl-shared-core/cache-api.h" struct xfrmnl_userpolicy_type { uint8_t type; diff --git a/lib/xfrm/template.c b/lib/xfrm/template.c index 1cb47398a..205f0174c 100644 --- a/lib/xfrm/template.c +++ b/lib/xfrm/template.c @@ -51,9 +51,8 @@ #include -#include - #include "nl-xfrm.h" +#include "nl-shared-core/nl-core.h" void xfrmnl_user_tmpl_free(struct xfrmnl_user_tmpl* utmpl) { diff --git a/src/nl-list-caches.c b/src/nl-list-caches.c index 814cb2c73..a39a52c21 100644 --- a/src/nl-list-caches.c +++ b/src/nl-list-caches.c @@ -7,9 +7,8 @@ #include -#include - #include "nl-shared-core/object-api.h" +#include "nl-shared-core/cache-api.h" static void print_usage(void) { diff --git a/tests/test-create-ip6tnl.c b/tests/test-create-ip6tnl.c index ca2efb9e6..b0c028199 100644 --- a/tests/test-create-ip6tnl.c +++ b/tests/test-create-ip6tnl.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-create-ipgre.c b/tests/test-create-ipgre.c index 23a43292c..31d0eec27 100644 --- a/tests/test-create-ipgre.c +++ b/tests/test-create-ipgre.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-create-ipgretap.c b/tests/test-create-ipgretap.c index 40f15c5e4..8dceaf104 100644 --- a/tests/test-create-ipgretap.c +++ b/tests/test-create-ipgretap.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-create-ipip.c b/tests/test-create-ipip.c index 2f8e0095f..2ea3bf0ce 100644 --- a/tests/test-create-ipip.c +++ b/tests/test-create-ipip.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-create-ipvti.c b/tests/test-create-ipvti.c index ce676ecc1..33eb646ed 100644 --- a/tests/test-create-ipvti.c +++ b/tests/test-create-ipvti.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-create-sit.c b/tests/test-create-sit.c index 8adf83fcd..5c7aaeb81 100644 --- a/tests/test-create-sit.c +++ b/tests/test-create-sit.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-create-xfrmi.c b/tests/test-create-xfrmi.c index 8845b6e03..8fd7c3abf 100644 --- a/tests/test-create-xfrmi.c +++ b/tests/test-create-xfrmi.c @@ -4,8 +4,6 @@ #include -#include - int main(int argc, char *argv[]) { struct nl_cache *link_cache; diff --git a/tests/test-genl.c b/tests/test-genl.c index 5db23f008..6d15a2f79 100644 --- a/tests/test-genl.c +++ b/tests/test-genl.c @@ -66,8 +66,6 @@ static struct genl_cmd cmds[] = { }, }; -#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0])) - static struct genl_ops ops = { .o_name = TASKSTATS_GENL_NAME, .o_cmds = cmds, diff --git a/tools/clang-format.sh b/tools/clang-format.sh index 049459ce2..0f5650683 100755 --- a/tools/clang-format.sh +++ b/tools/clang-format.sh @@ -14,7 +14,6 @@ EXCLUDE_PATHS_TOPLEVEL=( # The following files are currently not formatted with clang. # Exclude them too. EXCLUDE_PATHS_TOPLEVEL+=( - "include/netlink-private/netlink.h" "include/netlink/addr.h" "include/netlink/attr.h" "include/netlink/cache-api.h"