aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2013-08-09 08:27:14 +0200
committerSimon Horman <horms@verge.net.au>2013-08-09 17:28:35 +0900
commitca23ad37d5c7b1b393afa0f72461d81ee884e059 (patch)
tree07fe445b4b0d0a2b6009c6025350442d5a59db82
parent1ea1f41f40ad183176dba0ace8b873443d6aa82d (diff)
downloadipvsadm-ca23ad37d5c7b1b393afa0f72461d81ee884e059.tar.gz
ipvsadm: fix compiling tool on distros with only libnl-1
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1. Using pkg-config to detect what versions of libnl is available. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--libipvs/Makefile5
-rw-r--r--libipvs/libipvs.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/libipvs/Makefile b/libipvs/Makefile
index a527a7f..eafc3e5 100644
--- a/libipvs/Makefile
+++ b/libipvs/Makefile
@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \
echo "-I../../."; fi;)
DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \
echo "-DHAVE_NET_IP_VS_H"; fi;)
+DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \
+ if pkg-config --exists libnl-3.0; then :; \
+ elif pkg-config --exists libnl-2.0; then :; \
+ elif pkg-config --exists libnl-1; \
+ then echo "-DFALLBACK_LIBNL1"; fi; fi)
.PHONY = all clean install dist distclean rpm rpms
STATIC_LIB = libipvs.a
diff --git a/libipvs/libipvs.c b/libipvs/libipvs.c
index c3c3b0a..2b066d2 100644
--- a/libipvs/libipvs.c
+++ b/libipvs/libipvs.c
@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;
struct ip_vs_getinfo ipvs_info;
#ifdef LIBIPVS_USE_NL
+#ifdef FALLBACK_LIBNL1
+#define nl_sock nl_handle
+#define nl_socket_alloc nl_handle_alloc
+#define nl_socket_free nl_handle_destroy
+#endif
static struct nl_sock *sock = NULL;
static int family, try_nl = 1;
#endif