Re: [PATCH 02/25] m4: virt-libnl: drop libnl-1.0 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 21, 2019 at 10:00:27AM +0200, Pavel Hrdina wrote:
All supported OSes have libnl-3.0 and netcf uses it so there is no need
to keep libnl-1.0 compatibility code.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
m4/virt-libnl.m4      | 56 +++++++++----------------------------------
src/util/virnetlink.c | 13 +++-------
src/util/virnetlink.h |  8 -------
3 files changed, 14 insertions(+), 63 deletions(-)

diff --git a/m4/virt-libnl.m4 b/m4/virt-libnl.m4
index c106d545ec..b3e0dc9b2c 100644
--- a/m4/virt-libnl.m4
+++ b/m4/virt-libnl.m4
@@ -18,56 +18,22 @@ dnl <http://www.gnu.org/licenses/>.
dnl

AC_DEFUN([LIBVIRT_CHECK_LIBNL], [
-  AC_REQUIRE([LIBVIRT_CHECK_NETCF])

Even though the removed code below does mention netcf, it looks for its
existence in system library directories and does not depend on libvirt's
checks. So it can be removed even before this patch.

  AC_REQUIRE([LIBVIRT_CHECK_MACVTAP])

-  LIBNL_REQUIRED="1.1"
  with_libnl=no

  if test "$with_linux" = "yes"; then
-    # When linking with netcf, we must ensure that we pick the same version
-    # of libnl that netcf picked.  Prefer libnl-3 unless we can prove
-    # netcf linked against libnl-1, or unless the user set LIBNL_CFLAGS.
-    # (Setting LIBNL_CFLAGS is already used by PKG_CHECK_MODULES to
-    # override any probing, so if it set, you know which libnl is in use.)
-    libnl_ldd=
-    for dir in /usr/lib64 /usr/lib /usr/lib/*-linux-gnu*; do
-      if test -f $dir/libnetcf.so; then
-        libnl_ldd=`(ldd $dir/libnetcf.so) 2>&1`
-        break
-      fi
-    done
-    case $libnl_ldd:${LIBNL_CFLAGS+set} in
-      *libnl-3.so.*:) LIBNL_REQUIRED=3.0 ;;
-    esac
-    case $libnl_ldd:${LIBNL_CFLAGS+set} in
-      *libnl.so.1*:) ;;
-      *)
-        PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [
-          with_libnl=yes
-          AC_DEFINE([HAVE_LIBNL3], [1], [Use libnl-3.0])
-          AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available])
-          PKG_CHECK_MODULES([LIBNL_ROUTE3], [libnl-route-3.0])
-          LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE3_CFLAGS"
-          LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE3_LIBS"
-        ], [:]) ;;
-    esac
-    if test "$with_libnl" = no; then
-      PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
-        with_libnl=yes
-        AC_DEFINE_UNQUOTED([HAVE_LIBNL], [1],
-          [whether the netlink library is available])
-        AC_DEFINE_UNQUOTED([HAVE_LIBNL1], [1],
-          [whether the netlink v1 library is available])
-      ], [
-        if test "$with_macvtap" = "yes"; then
-          if test "$LIBNL_REQUIRED" = "3.0";then
-            AC_MSG_ERROR([libnl3-devel >= $LIBNL_REQUIRED is required for macvtap support])
-          else
-            AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
-          fi
-        fi
-      ])
+    PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [
+      with_libnl=yes
+      AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available])
+      PKG_CHECK_MODULES([LIBNL_ROUTE], [libnl-route-3.0])
+      LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE_CFLAGS"
+      LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE_LIBS"
+    ], [:])
+  fi
+  if test "$with_libnl" = no; then
+    if test "$with_macvtap" = "yes"; then
+        AC_MSG_ERROR([libnl3-devel >= $LIBNL_REQUIRED is required for macvtap support])

You removed the code that set the value of LIBNL_REQUIRED.
Hopefully all the distributions are sane enough to not provide
a libnl3-devel package with a lower version than 3.0, so  we don't
need that second reference to the version.

    fi
  fi
  AM_CONDITIONAL([HAVE_LIBNL], [test "$with_libnl" = "yes"])
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index ab41b57672..0d91503714 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -52,17 +52,10 @@ struct virNetlinkEventHandle {
    int deleted;
};

-# ifdef HAVE_LIBNL1
-#  define virNetlinkAlloc nl_handle_alloc
-#  define virNetlinkSetBufferSize nl_set_buffer_size
-#  define virNetlinkFree nl_handle_destroy
-typedef struct nl_handle virNetlinkHandle;
-# else
-#  define virNetlinkAlloc nl_socket_alloc
-#  define virNetlinkSetBufferSize nl_socket_set_buffer_size
-#  define virNetlinkFree nl_socket_free
+# define virNetlinkAlloc nl_socket_alloc
+# define virNetlinkSetBufferSize nl_socket_set_buffer_size
+# define virNetlinkFree nl_socket_free
typedef struct nl_sock virNetlinkHandle;
-# endif

These macros are just a compatibility glue and are only used in this
file, they can be removed completely.


G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkHandle, virNetlinkFree);

diff --git a/src/util/virnetlink.h b/src/util/virnetlink.h
index 030547e573..e888857601 100644
--- a/src/util/virnetlink.h
+++ b/src/util/virnetlink.h
@@ -24,15 +24,7 @@

#if defined(__linux__) && defined(HAVE_LIBNL)

-/* Work around a bug where older libnl-1 headers expected older gcc
- * semantics of 'extern inline' that conflict with C99 semantics.  */
-# ifdef HAVE_LIBNL1
-#  define inline
-# endif
# include <netlink/msg.h>
-# ifdef HAVE_LIBNL1
-#  undef inline
-# endif

typedef struct nl_msg virNetlinkMsg;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkMsg, nlmsg_free);

With the LIBNL_REQUIRED stuff fixed:
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux