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

Pavel Hrdina phrdina at redhat.com
Mon Oct 21 11:25:58 UTC 2019


On Mon, Oct 21, 2019 at 11:47:51AM +0200, Ján Tomko wrote:
> 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 at redhat.com>
> > ---
> > 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.

I'll post a followup patch to remove it 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 at redhat.com>

Thanks, fixed now.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191021/6c0e7e7f/attachment-0001.sig>


More information about the libvir-list mailing list