import xdp-tools-1.1.1-2.el8

This commit is contained in:
CentOS Sources 2021-03-30 15:50:37 -04:00 committed by Stepan Oksanichenko
parent 044254abc3
commit 3a718ff5e0
5 changed files with 112 additions and 15 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/xdp-tools-1.0.0~beta1.tar.gz
SOURCES/xdp-tools-1.1.1.tar.gz

View File

@ -1 +1 @@
1775f82c29fe772c309cc3279ae60d6b6c18d96f SOURCES/xdp-tools-1.0.0~beta1.tar.gz
cce9f7c3a5275a78056a88cf940413cce1e4776b SOURCES/xdp-tools-1.1.1.tar.gz

View File

@ -0,0 +1,42 @@
commit 98a7fdb7c820a8474c9a6d836f4551eac050bd54
Author: Toke Høiland-Jørgensen <toke@redhat.com>
Date: Wed Feb 10 16:28:57 2021 +0100
libxdp/README: Update documentation with support for incremental attach
Seems I forgot to update the libxdp documentation when adding support for
incrementally attaching multiple programs. Fix that oversight and note the
limitations in terms of kernel versions and dispatcher compatibility.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
diff --git a/lib/libxdp/README.org b/lib/libxdp/README.org
index 5a930813c7d9..045348bb1d9a 100644
--- a/lib/libxdp/README.org
+++ b/lib/libxdp/README.org
@@ -76,13 +76,18 @@ metadata* section below). Because the loading process involves modifying the
attach type of the program, the attach functions only work with =struct
xdp_program= objects that have not yet been loaded into the kernel.
-Due to limitations in the kernel support, it is currently not possible to attach
-another program to an already-attached list of programs. As such, the only way
-to actually run multiple programs on a single interface is to attach them all at
-the same time with =xdp_program__attach_multi()=. It is expected that this
-restriction will be lifted in an upcoming kernel version, after which
-=xdp_program__attach()= will simply add the program being loaded into the
-existing chain of programs running on the interface.
+When using the attach functions to attach to an interface that already has an
+XDP program loaded, libxdp will attempt to add the program to the list of loaded
+programs. However, this may fail, either due to missing kernel support, or
+because the already-attached program was not loaded using a dispatcher
+compatible with libxdp. If the kernel support for incremental attach (merged in
+kernel 5.10) is missing, the only way to actually run multiple programs on a
+single interface is to attach them all at the same time with
+=xdp_program__attach_multi()=. If the existing program is not an XDP dispatcher,
+that program will have to be detached from the interface before libxdp can
+attach a new one. This can be done by calling =xdp_program__detach()= with a
+reference to the loaded program; but note that this will of course break any
+application relying on that other XDP program to be present.
* Program metadata

View File

@ -0,0 +1,30 @@
commit 5fb355a7c9a1fdd5842c4b9dbd5e48ba6b767921
Author: Toke Høiland-Jørgensen <toke@redhat.com>
Date: Wed Feb 10 16:59:08 2021 +0100
xdp-filter: Check whether we have already been loaded
Now that we can attach multiple programs to an interface, xdp-filter will
happily load itself multiple times on the same interface. Fix that by
checking if it's already loaded before attempting a new load.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
diff --git a/xdp-filter/xdp-filter.c b/xdp-filter/xdp-filter.c
index 08cfd722e169..895dbd5750b2 100644
--- a/xdp-filter/xdp-filter.c
+++ b/xdp-filter/xdp-filter.c
@@ -268,6 +268,13 @@ int do_load(const void *cfg, const char *pin_root_path)
}
features |= opt->policy_mode;
+ err = get_pinned_program(&opt->iface, pin_root_path, NULL, &p);
+ if (!err) {
+ pr_warn("xdp-filter is already loaded on %s\n", opt->iface.ifname);
+ xdp_program__close(p);
+ return EXIT_FAILURE;
+ }
+
print_flags(featbuf, sizeof(featbuf), print_features, features);
pr_debug("Looking for eBPF program with features %s\n", featbuf);

View File

@ -1,12 +1,14 @@
Name: xdp-tools
Version: 1.0.0~beta1
Release: 0.1%{?dist}
Version: 1.1.1
Release: 2%{?dist}
Summary: Utilities and example programs for use with XDP
%global _soversion 1.0.0
%global _soversion 1.1.0
License: GPLv2
URL: https://github.com/xdp-project/%{name}
Source0: https://github.com/xdp-project/%{name}/releases/download/v%{version}/xdp-tools-%{version}.tar.gz
Patch0: xdp-tools-1.1.1-fix-libxdp-man-page.patch
Patch1: xdp-tools-1.1.1-xdp-filter-load-check.patch
BuildRequires: libbpf-devel
BuildRequires: elfutils-libelf-devel
@ -21,6 +23,9 @@ BuildRequires: m4
BuildRequires: emacs-nox
BuildRequires: wireshark-cli
# Always keep xdp-tools and libxdp packages in sync
Requires: libxdp = %{version}-%{release}
# find-debuginfo produces empty debugsourcefiles.list
# disable the debug package to avoid rpmbuild error'ing out because of this
%global debug_package %{nil}
@ -35,6 +40,7 @@ Utilities and example programs for use with XDP
%package -n libxdp
Summary: XDP helper library
Requires: kernel-headers
Requires: libbpf >= 0.2.0-1
%package -n libxdp-devel
Summary: Development files for libxdp
@ -65,13 +71,14 @@ The libxdp-static package contains the static library version of libxdp.
export CFLAGS='%{build_cflags}'
export LDFLAGS='%{build_ldflags}'
export LIBDIR='%{_libdir}'
export PRODUCTION=1
export DYNAMIC_LIBXDP=1
export CLANG=%{_bindir}/clang
export LLC=%{_bindir}/llc
export PRODUCTION=1
export DYNAMIC_LIBXDP=1
export FORCE_SYSTEM_LIBBPF=1
export FORCE_EMACS=1
./configure
sed -i '2i #define _GNU_SOURCE' lib/util/params.c
make %{?_smp_mflags}
make %{?_smp_mflags} V=1
%install
export DESTDIR='%{buildroot}'
@ -80,11 +87,8 @@ export LIBDIR='%{_libdir}'
export MANDIR='%{_mandir}'
export DATADIR='%{_datadir}'
export HDRDIR='%{_includedir}/xdp'
make install
# Don't expose libxdp itself in -devel package just yet
rm -f %{buildroot}%{_includedir}/xdp/libxdp.h
rm -f %{buildroot}%{_libdir}/libxdp.so
make install V=1
cd $DESTDIR/$LIBDIR && ln -vs libxdp.so.%{_soversion} libxdp.so.1.0.0
%files
%{_sbindir}/xdp-filter
@ -99,16 +103,37 @@ rm -f %{buildroot}%{_libdir}/libxdp.so
%files -n libxdp
%{_libdir}/libxdp.so.1
%{_libdir}/libxdp.so.%{_soversion}
%{_libdir}/libxdp.so.1.0.0
%{_libdir}/bpf/xdp-dispatcher.o
%{_libdir}/pkgconfig/libxdp.pc
%{_mandir}/man3/*
%files -n libxdp-static
%{_libdir}/libxdp.a
%files -n libxdp-devel
%{_includedir}/xdp/*.h
%{_libdir}/libxdp.so
%{_libdir}/pkgconfig/libxdp.pc
%changelog
* Wed Feb 3 2021 Toke Høiland-Jørgensen <toke@redhat.com> 1.1.1-1
- Upstream version bump
* Mon Jan 4 2021 Toke Høiland-Jørgensen <toke@redhat.com> 1.1.0-1
- Upstream version bump
* Thu Aug 20 2020 Toke Høiland-Jørgensen <toke@redhat.com> 1.0.1-1
- Upstream version bump
* Tue Aug 18 2020 Toke Høiland-Jørgensen <toke@redhat.com> 1.0.0-1
- Upstream version bump
* Wed Jul 15 2020 Eelco Chaudron <echaudro@redhat.com> 1.0.0~beta3-0.1
- Upstream version bump
* Fri Jul 10 2020 Toke Høiland-Jørgensen <toke@redhat.com> 1.0.0~beta2-0.1
- Upstream version bump
* Mon Jun 15 2020 Toke Høiland-Jørgensen <toke@redhat.com> 1.0.0~beta1-0.1
- Upstream version bump