summaryrefslogtreecommitdiff
path: root/src/nm-netlink-compat.h
diff options
context:
space:
mode:
authorPavel Šimerda <psimerda@redhat.com>2012-11-22 16:09:35 +0100
committerPavel Šimerda <psimerda@redhat.com>2012-11-22 18:03:16 +0100
commit423d766b03b94be683bf6f46e92fdd6dfcedd121 (patch)
treed3eb8e54475077e61701ba3ffeabea0a8dbe52e5 /src/nm-netlink-compat.h
parent56550a984f9827fce12fb9b641e2e6fced10c4e3 (diff)
downloadNetworkManager-423d766b03b94be683bf6f46e92fdd6dfcedd121.tar.gz
build: implement libnl version selection
Until we remove libnl-1.x and libnl-2.x support, it should be possible to choose the libnl version at build time. This is mostly important for testing legacy libnl support but it also helps distributions that ship other tools built agains them. (https://bugs.gentoo.org/show_bug.cgi?id=441750)
Diffstat (limited to 'src/nm-netlink-compat.h')
-rw-r--r--src/nm-netlink-compat.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nm-netlink-compat.h b/src/nm-netlink-compat.h
index eb0926ad07..80df096730 100644
--- a/src/nm-netlink-compat.h
+++ b/src/nm-netlink-compat.h
@@ -43,7 +43,7 @@
#include <config.h>
/* libnl-1 API compatibility for libnl-2/3*/
-#ifndef HAVE_LIBNL1
+#if HAVE_LIBNL != 1
struct rtnl_nexthop * nm_netlink_get_nh(struct rtnl_route *);
int rtnl_route_get_oif(struct rtnl_route *);
@@ -54,7 +54,7 @@ struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *);
#endif
/* libnl-2 API compatibility for libnl-3 */
-#ifdef HAVE_LIBNL3
+#if HAVE_LIBNL == 3
static inline int
__rtnl_link_alloc_cache (struct nl_sock *h, struct nl_cache **cache)
{
@@ -65,15 +65,15 @@ __rtnl_link_alloc_cache (struct nl_sock *h, struct nl_cache **cache)
/* libnl-2.0 compat functions */
-#ifdef HAVE_LIBNL2
+#if HAVE_LIBNL == 2
/* functions with similar prototypes */
#define nlmsg_datalen nlmsg_len
-#endif /* HAVE_LIBNL2 */
+#endif
/* libnl-1.0 compat functions */
-#ifdef HAVE_LIBNL1
+#if HAVE_LIBNL == 1
#define nl_sock nl_handle
@@ -204,10 +204,10 @@ __nl_cache_include (struct nl_cache *cache, struct nl_object *obj, change_func_t
#define NLE_PERM 28
#define NLE_PKTLOC_FILE 29
-#endif /* HAVE_LIBNL1 */
+#endif
/* Stuff that only libnl3 has */
-#if defined(HAVE_LIBNL1) || defined(HAVE_LIBNL2)
+#if HAVE_LIBNL == 1 || HAVE_LIBNL == 2
static inline int
rtnl_link_bond_add (struct nl_sock *h, const char *name, void *data)
@@ -276,6 +276,6 @@ rtnl_link_delete(struct nl_sock *sk, const struct rtnl_link *l)
/* Operation only in libnl3 */
return -NLE_OPNOTSUPP;
}
-#endif /* HAVE_LIBNL1 || HAVE_LIBNL2 */
+#endif
#endif /* NM_NETLINK_COMPAT_H */