core: add libnl-3 API compatibility

This commit is contained in:
Alfredo Matos
2011-07-29 14:47:37 +01:00
committed by Dan Williams
parent a6c6556831
commit daeb181fa2
2 changed files with 16 additions and 0 deletions

View File

@@ -331,6 +331,15 @@ if (test "${have_libnl2}" = "yes"); then
have_libnl="yes" have_libnl="yes"
fi fi
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [have_libnl2=yes], [have_libnl2=no])
if (test "${have_libnl2}" = "yes"); then
AC_DEFINE(HAVE_LIBNL3, 1, [Define if you require specific libnl-3 support])
LIBNL_CFLAGS="$LIBNL3_CFLAGS"
LIBNL_LIBS="$LIBNL3_LIBS"
libnl_version="3"
have_libnl="yes"
fi
if (test "${have_libnl}" = "no"); then if (test "${have_libnl}" = "no"); then
AC_MSG_ERROR([libnl development header are required]) AC_MSG_ERROR([libnl development header are required])
fi fi

View File

@@ -51,6 +51,13 @@ int rtnl_route_get_dst_len(struct rtnl_route *);
struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *); struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *);
#endif #endif
/* libnl-2 API compatibility for libnl-3 */
#ifdef HAVE_LIBNL3
static inline int __rtnl_link_alloc_cache(struct nl_sock *h, struct nl_cache **cache) {
return rtnl_link_alloc_cache (h, AF_UNSPEC, cache);
}
#define rtnl_link_alloc_cache __rtnl_link_alloc_cache
#endif
/* libnl-1.0 compat functions */ /* libnl-1.0 compat functions */
#ifdef HAVE_LIBNL1 #ifdef HAVE_LIBNL1