Use libnl 1.1 API.
authorDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Fri, 29 Aug 2008 02:45:44 +0000 (02:45 +0000)
committerDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Fri, 29 Aug 2008 02:45:44 +0000 (02:45 +0000)
configure.ac
src/vip6-autod.c

index 2274448..2dec4a4 100644 (file)
@@ -77,11 +77,6 @@ dnl {check for libnl
 dnl
 
 ensc_have_libnl=yes
-LIBNL_ROOT=`readlink -f ../libnl*/`
-if test -d "$LIBNL_ROOT"; then
-       CFLAGS="$CFLAGS -I ${LIBNL_ROOT}/include"
-       LDFLAGS="$LDFLAGS -L${LIBNL_ROOT}/lib"
-fi
 
 if test x"$ensc_have_libnl" = xyes; then
        AC_CHECK_HEADERS([asm/types.h stdint.h], [ : ],
@@ -110,7 +105,7 @@ if test x"$ensc_have_libnl" = xyes; then
 fi
 
 if test x"$ensc_have_libnl" = xyes; then
-       AC_CHECK_LIB(nl, nlmsg_get_src, [ : ],
+       AC_CHECK_LIB(nl, nl_handle_alloc_cb, [ : ],
                     [ ensc_have_libnl=no ])
 fi
 
index feade59..75055c1 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <asm/types.h>
 #include <netlink/netlink.h>
+#include <netlink/handlers.h>
 #include <netlink/route/addr.h>
 
 #include <vserver.h>
@@ -107,7 +108,7 @@ static int add_address_to_interface(int ifindex, struct in6_addr *address,
        if (rtnl_addr_add(handle, rta, NLM_F_REPLACE) != -1 || errno == EEXIST)
                err = 0;
 
-       rtnl_addr_free(rta);
+       rtnl_addr_put(rta);
        nl_addr_destroy(nl);
        return err;
 }
@@ -139,7 +140,7 @@ static inline int remove_address_from_interface(struct nid_prefix_map *entry)
 
        ret = rtnl_addr_delete(handle, rta, 0);
 
-       rtnl_addr_free(rta);
+       rtnl_addr_put(rta);
        nl_addr_destroy(nl);
 
        return ret;
@@ -595,11 +596,16 @@ int main(int argc, char *argv[])
 
        openlog("vip6-autod", LOG_PERROR, LOG_DAEMON);
 
-       handle = nl_handle_alloc_nondefault(NL_CB_VERBOSE);
-       cbs = nl_handle_get_cb(handle);
+       cbs = nl_cb_alloc(NL_CB_VERBOSE);
+       if (!cbs) {
+               syslog(LOG_CRIT, "nl_cb_alloc: %s", strerror(errno));
+               exit(1);
+       }
        nl_cb_set(cbs, NL_CB_VALID, NL_CB_CUSTOM, handle_valid_msg, &map);
        nl_cb_set(cbs, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, handle_no_op, NULL);
        nl_cb_err(cbs, NL_CB_CUSTOM, handle_error_msg, &map);
+
+       handle = nl_handle_alloc_cb(cbs);
        nl_disable_sequence_check(handle);
 
        nl_join_groups(handle, RTMGRP_IPV6_PREFIX|RTMGRP_IPV6_IFADDR);