import xdp-tools-1.1.1-2.el8

This commit is contained in:
CentOS Sources 2021-02-12 08:22:39 +00:00 committed by Andrew Lukoshko
parent e7de7bdfd8
commit 0e9bccaf98
5 changed files with 84 additions and 8 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/xdp-tools-1.1.0.tar.gz
SOURCES/xdp-tools-1.1.1.tar.gz

View File

@ -1 +1 @@
b4b805e6b9dc96ef685f063e4ab4e2309a26ee47 SOURCES/xdp-tools-1.1.0.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.1.0
Release: 1%{?dist}
Version: 1.1.1
Release: 2%{?dist}
Summary: Utilities and example programs for use with XDP
%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,10 +23,6 @@ BuildRequires: m4
BuildRequires: emacs-nox
BuildRequires: wireshark-cli
# Missing kernel features means we can't support these archs, so exclude them
# entirely
ExcludeArch: aarch64 s390x ppc64le
# Always keep xdp-tools and libxdp packages in sync
Requires: libxdp = %{version}-%{release}
@ -42,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
@ -89,6 +88,7 @@ export MANDIR='%{_mandir}'
export DATADIR='%{_datadir}'
export HDRDIR='%{_includedir}/xdp'
make install V=1
cd $DESTDIR/$LIBDIR && ln -vs libxdp.so.%{_soversion} libxdp.so.1.0.0
%files
%{_sbindir}/xdp-filter
@ -103,6 +103,7 @@ make install V=1
%files -n libxdp
%{_libdir}/libxdp.so.1
%{_libdir}/libxdp.so.%{_soversion}
%{_libdir}/libxdp.so.1.0.0
%{_libdir}/bpf/xdp-dispatcher.o
%{_mandir}/man3/*
@ -115,6 +116,9 @@ make install V=1
%{_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