[netcf-devel] [PATCH 1/9] use libnl-3 instead of libnl-1

Serge Hallyn serge.hallyn at canonical.com
Tue Mar 20 14:11:40 UTC 2012


RTNL_LINK_NOT_FOUND no longer exists in libnl-3.0.  It used to be
defined to -1, but now an index of 0 means does not exist.

Signed-off-by: Serge Hallyn <serge.hallyn at canonical.com>
---
 configure.ac      |    2 +-
 src/dutil_linux.c |   14 +++++++-------
 src/dutil_linux.h |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

Index: netcf-0.1.9/configure.ac
===================================================================
--- netcf-0.1.9.orig/configure.ac	2011-10-07 13:56:38.000000000 +0000
+++ netcf-0.1.9/configure.ac	2011-10-07 14:27:48.668839133 +0000
@@ -103,7 +103,7 @@
 if test "x$with_driver" != "xmswindows"
 then
     PKG_CHECK_MODULES([LIBAUGEAS], [augeas >= 0.5.0])
-    PKG_CHECK_MODULES([LIBNL], [libnl-1])
+    PKG_CHECK_MODULES([LIBNL], [libnl-3.0])
 fi
 
 NETCF_LIBDEPS=$(echo $LIBAUGEAS_LIBS $LIBEXSLT_LIBS $LIBXSLT_LIBS $LIBXML_LIBS $LIBNL_LIBS)
Index: netcf-0.1.9/src/dutil_linux.c
===================================================================
--- netcf-0.1.9.orig/src/dutil_linux.c	2011-10-07 13:56:38.000000000 +0000
+++ netcf-0.1.9/src/dutil_linux.c	2011-10-07 14:27:48.700839043 +0000
@@ -796,7 +796,7 @@
 
 int netlink_init(struct netcf *ncf) {
 
-    ncf->driver->nl_sock = nl_handle_alloc();
+    ncf->driver->nl_sock = nl_socket_alloc();
     if (ncf->driver->nl_sock == NULL)
         goto error;
     if (nl_connect(ncf->driver->nl_sock, NETLINK_ROUTE) < 0) {
@@ -837,7 +837,7 @@
     }
     if (ncf->driver->nl_sock) {
         nl_close(ncf->driver->nl_sock);
-        nl_handle_destroy(ncf->driver->nl_sock);
+        nl_socket_free(ncf->driver->nl_sock);
         ncf->driver->nl_sock = NULL;
     }
     return 0;
@@ -1000,7 +1000,7 @@
     struct rtnl_link *filter_link = NULL;
 
     /* if interface isn't currently available, nothing to add */
-    if (ifindex == RTNL_LINK_NOT_FOUND)
+    if (ifindex == 0)
         return;
 
     filter_link = rtnl_link_alloc();
@@ -1046,7 +1046,7 @@
         return;
 
     l_link = rtnl_link_get_link(iflink);
-    if (l_link == RTNL_LINK_NOT_FOUND)
+    if (l_link == 0)
         return;
 
     master_link = rtnl_link_get(nl_object_get_cache(obj), l_link);
@@ -1071,7 +1071,7 @@
 
     /* Add in type-specific info of master interface */
     master_ifindex = rtnl_link_name2i(ncf->driver->link_cache, master_name);
-    ERR_THROW((master_ifindex == RTNL_LINK_NOT_FOUND), ncf, ENETLINK,
+    ERR_THROW((master_ifindex == 0), ncf, ENETLINK,
               "couldn't find ifindex for vlan master interface `%s`",
               master_name);
     add_type_specific_info(ncf, master_name, master_ifindex,
@@ -1089,7 +1089,7 @@
     struct rtnl_link *filter_link = NULL;
 
     /* if interface isn't currently available, nothing to add */
-    if (ifindex == RTNL_LINK_NOT_FOUND)
+    if (ifindex == 0)
         return;
 
     filter_link = rtnl_link_alloc();
@@ -1204,7 +1204,7 @@
         = { doc, root, NULL, ifindex, ncf };
 
     /* if interface isn't currently available, nothing to add */
-    if (ifindex == RTNL_LINK_NOT_FOUND)
+    if (ifindex == 0)
         return;
 
     nl_cache_foreach(ncf->driver->link_cache, add_bond_info_cb, &cb_data);
Index: netcf-0.1.9/src/dutil_linux.h
===================================================================
--- netcf-0.1.9.orig/src/dutil_linux.h	2011-10-07 13:56:38.000000000 +0000
+++ netcf-0.1.9/src/dutil_linux.h	2011-10-07 14:20:26.000000000 +0000
@@ -30,7 +30,7 @@
     xsltStylesheetPtr  put;
     xsltStylesheetPtr  get;
     int                ioctl_fd;
-    struct nl_handle  *nl_sock;
+    struct nl_sock     *nl_sock;
     struct nl_cache   *link_cache;
     struct nl_cache   *addr_cache;
     unsigned int       load_augeas : 1;
Index: netcf-0.1.9/configure
===================================================================
--- netcf-0.1.9.orig/configure	2011-10-07 14:28:03.752831651 +0000
+++ netcf-0.1.9/configure	2011-10-07 14:28:27.992840340 +0000
@@ -27946,12 +27946,12 @@
     pkg_cv_LIBNL_CFLAGS="$LIBNL_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-1\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libnl-1") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-3.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_LIBNL_CFLAGS=`$PKG_CONFIG --cflags "libnl-1" 2>/dev/null`
+  pkg_cv_LIBNL_CFLAGS=`$PKG_CONFIG --cflags "libnl-3.0" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -27963,12 +27963,12 @@
     pkg_cv_LIBNL_LIBS="$LIBNL_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-1\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libnl-1") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnl-3.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libnl-3.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_LIBNL_LIBS=`$PKG_CONFIG --libs "libnl-1" 2>/dev/null`
+  pkg_cv_LIBNL_LIBS=`$PKG_CONFIG --libs "libnl-3.0" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -27989,14 +27989,14 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        LIBNL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnl-1" 2>&1`
+	        LIBNL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnl-3.0" 2>&1`
         else
-	        LIBNL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnl-1" 2>&1`
+	        LIBNL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnl-3.0" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$LIBNL_PKG_ERRORS" >&5
 
-	as_fn_error $? "Package requirements (libnl-1) were not met:
+	as_fn_error $? "Package requirements (libnl-3.0) were not met:
 
 $LIBNL_PKG_ERRORS
 


More information about the netcf-devel mailing list