From bac3a4496fc19805f65b81d37a2acef32619b753 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 20 Oct 2011 23:49:39 -0700 Subject: [PATCH] netlink: Add compat functions for libnl-1 usage --- src/netlink.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/netlink.c b/src/netlink.c index 0c81ba9..3c26687 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -36,6 +36,38 @@ #include "near.h" +#ifdef NEED_LIBNL_COMPAT +#define nl_sock nl_handle + +static inline struct nl_handle *nl_socket_alloc(void) +{ + return nl_handle_alloc(); +} + +static inline void nl_socket_free(struct nl_sock *h) +{ + nl_handle_destroy(h); +} + +static inline int __genl_ctrl_alloc_cache(struct nl_sock *h, struct nl_cache **cache) +{ + struct nl_cache *tmp = genl_ctrl_alloc_cache(h); + if (!tmp) + return -ENOMEM; + *cache = tmp; + return 0; +} +#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache + +#define NLE_MISSING_ATTR 14 + +static inline void __nl_perror(int error, const char *s) +{ + nl_perror(s); +} +#define nl_perror __nl_perror +#endif + struct nlnfc_state { struct nl_sock *nl_sock; struct nl_cache *nl_cache; -- 2.7.4