Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libbpf for openSUSE:Factory checked in at 2022-08-05 19:50:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libbpf (Old) and /work/SRC/openSUSE:Factory/.libbpf.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libbpf" Fri Aug 5 19:50:17 2022 rev:11 rq:992723 version:0.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libbpf/libbpf.changes 2022-05-20 17:50:26.471210604 +0200 +++ /work/SRC/openSUSE:Factory/.libbpf.new.1521/libbpf.changes 2022-08-05 19:50:46.521420698 +0200 @@ -1,0 +2,6 @@ +Wed Aug 3 13:55:13 UTC 2022 - Callum Farmer <gm...@opensuse.org> + +- Update to release 0.8.1: + * make shared xsk creation network namespace aware + +------------------------------------------------------------------- Old: ---- libbpf-0.8.0.tar.gz New: ---- libbpf-0.8.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libbpf.spec ++++++ --- /var/tmp/diff_new_pack.1KvZrI/_old 2022-08-05 19:50:47.549423352 +0200 +++ /var/tmp/diff_new_pack.1KvZrI/_new 2022-08-05 19:50:47.557423372 +0200 @@ -19,7 +19,7 @@ %define sover_major 0 %define libname libbpf%{sover_major} Name: libbpf -Version: 0.8.0 +Version: 0.8.1 Release: 0 Summary: C library for managing eBPF programs and maps License: LGPL-2.1-only ++++++ libbpf-0.8.0.tar.gz -> libbpf-0.8.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libbpf-0.8.0/src/Makefile new/libbpf-0.8.1/src/Makefile --- old/libbpf-0.8.0/src/Makefile 2022-05-16 22:46:05.000000000 +0200 +++ new/libbpf-0.8.1/src/Makefile 2022-07-14 23:49:55.000000000 +0200 @@ -10,7 +10,7 @@ LIBBPF_MAJOR_VERSION := 0 LIBBPF_MINOR_VERSION := 8 -LIBBPF_PATCH_VERSION := 0 +LIBBPF_PATCH_VERSION := 1 LIBBPF_VERSION := $(LIBBPF_MAJOR_VERSION).$(LIBBPF_MINOR_VERSION).$(LIBBPF_PATCH_VERSION) LIBBPF_MAJMIN_VERSION := $(LIBBPF_MAJOR_VERSION).$(LIBBPF_MINOR_VERSION).0 LIBBPF_MAP_VERSION := $(shell grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | sort -rV | head -n1 | cut -d'_' -f2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libbpf-0.8.0/src/xsk.c new/libbpf-0.8.1/src/xsk.c --- old/libbpf-0.8.0/src/xsk.c 2022-05-16 22:46:05.000000000 +0200 +++ new/libbpf-0.8.1/src/xsk.c 2022-07-14 23:49:55.000000000 +0200 @@ -52,6 +52,12 @@ #define PF_XDP AF_XDP #endif +#ifndef SO_NETNS_COOKIE + #define SO_NETNS_COOKIE 71 +#endif + +#define INIT_NS 1 + enum xsk_prog { XSK_PROG_FALLBACK, XSK_PROG_REDIRECT_FLAGS, @@ -76,6 +82,7 @@ struct xsk_umem *umem; int refcount; int ifindex; + __u64 netns_cookie; struct list_head list; int prog_fd; int link_fd; @@ -876,8 +883,7 @@ return err; } -static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, int ifindex, - __u32 queue_id) +static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, __u64 netns_cookie, int ifindex, __u32 queue_id) { struct xsk_ctx *ctx; @@ -885,7 +891,7 @@ return NULL; list_for_each_entry(ctx, &umem->ctx_list, list) { - if (ctx->ifindex == ifindex && ctx->queue_id == queue_id) { + if (ctx->netns_cookie == netns_cookie && ctx->ifindex == ifindex && ctx->queue_id == queue_id) { ctx->refcount++; return ctx; } @@ -921,7 +927,7 @@ } static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, - struct xsk_umem *umem, int ifindex, + struct xsk_umem *umem, __u64 netns_cookie, int ifindex, const char *ifname, __u32 queue_id, struct xsk_ring_prod *fill, struct xsk_ring_cons *comp) @@ -945,6 +951,7 @@ memcpy(comp, umem->comp_save, sizeof(*comp)); } + ctx->netns_cookie = netns_cookie; ctx->ifindex = ifindex; ctx->refcount = 1; ctx->umem = umem; @@ -1007,6 +1014,8 @@ struct xsk_socket *xsk; struct xsk_ctx *ctx; int err, ifindex; + __u64 netns_cookie; + socklen_t optlen; if (!umem || !xsk_ptr || !(rx || tx)) return -EFAULT; @@ -1040,14 +1049,24 @@ tx_setup_done = umem->tx_ring_setup_done; } - ctx = xsk_get_ctx(umem, ifindex, queue_id); + optlen = sizeof(netns_cookie); + err = getsockopt(xsk->fd, SOL_SOCKET, SO_NETNS_COOKIE, &netns_cookie, &optlen); + if (err) { + if (errno != ENOPROTOOPT) { + err = -errno; + goto out_socket; + } + netns_cookie = INIT_NS; + } + + ctx = xsk_get_ctx(umem, netns_cookie, ifindex, queue_id); if (!ctx) { if (!fill || !comp) { err = -EFAULT; goto out_socket; } - ctx = xsk_create_ctx(xsk, umem, ifindex, ifname, queue_id, + ctx = xsk_create_ctx(xsk, umem, netns_cookie, ifindex, ifname, queue_id, fill, comp); if (!ctx) { err = -ENOMEM;