[lvs-users] compiling ipvsadm-1.26 against libnl-3.1 fails

Simon Horman horms at verge.net.au
Tue Sep 13 03:40:59 BST 2011


On Mon, Sep 12, 2011 at 05:00:05PM -0700, Andrew Winkler wrote:
> libnl seems to have been refactored into a cli, a route, an nf library.
> Adding the additional header files, and linking against the additional
> libraries, lets ipvsadm compile, but then ipvsadm -L crashes with a
> SIGSEGV.  What version of libnl should I be compiling against? Thanks!

Hi Andrew,

It looks like the nice people over at Ubuntu have a patch to make
ipvsadm work with libnl3 (and only libnl3).

Could you see if this helps?

abridged version of: http://m1.archiveorange.com/m/att/zZR4S/ArchiveOrange_stPfC9nsqzykuy8P232pc4RAQZsa.patch

diff -pruN 1:1.25.clean-1ubuntu1/libipvs/libipvs.c 1:1.25.clean-1ubuntu2/libipvs/libipvs.c
--- 1:1.25.clean-1ubuntu1/libipvs/libipvs.c	2011-08-10 19:45:44.000000000 +0000
+++ 1:1.25.clean-1ubuntu2/libipvs/libipvs.c	2011-08-10 19:45:43.000000000 +0000
@@ -32,7 +32,7 @@ static void* ipvs_func = NULL;
 struct ip_vs_getinfo ipvs_info;
 
 #ifdef LIBIPVS_USE_NL
-struct nl_handle *sock = NULL;
+struct nl_sock *sock = NULL;
 int family, try_nl = 1;
 #endif
 
@@ -64,7 +64,7 @@ int ipvs_nl_send_message(struct nl_msg *
 {
 	int err = EINVAL;
 
-	sock = nl_handle_alloc();
+	sock = nl_socket_alloc();
 	if (!sock) {
 		nlmsg_free(msg);
 		return -1;
@@ -79,7 +79,7 @@ int ipvs_nl_send_message(struct nl_msg *
 
 	/* To test connections and set the family */
 	if (msg == NULL) {
-		nl_handle_destroy(sock);
+		nl_socket_free(sock);
 		sock = NULL;
 		return 0;
 	}
@@ -95,12 +95,12 @@ int ipvs_nl_send_message(struct nl_msg *
 
 	nlmsg_free(msg);
 
-	nl_handle_destroy(sock);
+	nl_socket_free(sock);
 
 	return 0;
 
 fail_genl:
-	nl_handle_destroy(sock);
+	nl_socket_free(sock);
 	sock = NULL;
 	nlmsg_free(msg);
 	errno = err;
diff -pruN 1:1.25.clean-1ubuntu1/Makefile 1:1.25.clean-1ubuntu2/Makefile
--- 1:1.25.clean-1ubuntu1/Makefile	2008-09-23 16:14:46.000000000 +0000
+++ 1:1.25.clean-1ubuntu2/Makefile	2011-08-10 19:45:43.000000000 +0000
@@ -79,7 +79,7 @@ endif
 OBJS		= ipvsadm.o config_stream.o dynamic_array.o
 LIBS		= $(POPT_LIB)
 ifneq (0,$(HAVE_NL))
-LIBS		+= -lnl
+LIBS		+= $(shell pkg-config --libs libnl-3.0)
 endif
 DEFINES		= -DVERSION=\"$(VERSION)\" -DSCHEDULERS=\"$(SCHEDULERS)\" \
 		  $(POPT_DEFINE)




More information about the lvs-users mailing list