From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 5454F80474 for ; Tue, 27 Oct 2026 18:16:45 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69RIFVO1032277; Tue, 27 Oct 2026 21:15:32 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69RIFVO1032277 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="fFZ+aEZr" Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69RIFOPV032249 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 27 Oct 2026 21:15:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69RIFOPV032249 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4a1fdde384cso741385e9.3 for ; Tue, 27 Oct 2026 11:15:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvByK91/8CkeWpEngUvjBAsEIKpJcB0/RTLxbmPXEoeHTYZjOlLgqznsK/EaNyc2dyrJHCp3lkw==@openvz.org X-Gm-Message-State: AFq9FYKxW0d5aESsTiqErFyiuGep8Kgwm6EhBeDLHwdypr2uL58yp+65 VaiQb89+W4qh4C8IQ3kdWp2kFybQ2nONrJx8fuTuNzNAf6G5i/1CGmnT5hS5YTPApgJ+6H045t7 qB6cCVB9NBnAWqvoVShmtze+CfcKD0dAMZX55fhP7oITEkc7A7vPcew== X-Gm-Gg: AYBFou1LpblEnpC8BK/slxcubYtsX9Ywe6vjMBRi1WYXHhwfLFYeiODGpBNfKXX4PtN isrKTDuBST2T/qGyC12ids4bTPAnDGOpyOJC2a6Ts/Q7hisaySr18HBor06y/2iBB0sW+bj9ySA lFhFVVCumS6vQKgJKQCWUerU0oBgrSMOAvsi41bPk+C0fPAL7t6L/RqiJkifGNsCIlUWxhboWwy 3Ce3nVJa5+oxBNRHfiQzHaP3DbMgeSLZZcrVSXGAPQNfCtsKEfv1TQJHqgynwT0YUdBqlS1EUfb lrkWS0x8um+MBDrTbdMbjXvuNGSwSduLT2Bn+WALQbKd+CXoGZ/JCWVotIFppHzkfvCB+gMB6oP 53yKMMOMgb9imrW+G X-Received: by 2002:a05:600c:46cd:b0:4a1:e0db:8cf8 with SMTP id 5b1f17b1804b1-4a35ac388b5mr210785175e9.3.1793124923894; Tue, 27 Oct 2026 11:15:23 -0700 (PDT) X-Received: by 2002:a05:600c:46cd:b0:4a1:e0db:8cf8 with SMTP id 5b1f17b1804b1-4a35ac388b5mr210784345e9.3.1793124923191; Tue, 27 Oct 2026 11:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793124923; cv=none; d=google.com; s=arc-20260327; b=Sdpr2WBMbkkElHUUv2IpESb18dYNfOthvGVPLUHLKpn8Fd37cYz7Bj2p5BgsbrTRfL XVJiBc0/jd+Kz1OpoiQPNeJDYhE0b7cUJwuKGDq8WVNu/kOA/bnalvG/eVtaao1cGOl5 JGmnnaAKC9hWHPW8SEZjSgwVc6ddeX1pdmaLkO9tIvznJho/DRRCTZ8aozkEc5CbWwAW w5DAVVogHWpvPOhdRUMhhyWkDZFL+B6m274xLJ8tWHjDwaCoqoFW+lb06ld5zcO+xuQO LMvJh8KLkhNFf9OKf0pAUFY0XnBnjRB9MTJRrQOr3KzyiWuQ59ttdLykfnjZV0ifTf94 EOCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=QLoAL6c/DaBwJ4LASXvCsWlBI+Zfy1oRs8UYW4wD1WA=; fh=Ac4B+E9J0iKprNz57k5baX4D1nACtq3mk5EYYPOTKpA=; b=NbmBjGUGWquykvg2EN6meA7Hh2Ln1BxWS57htqQreA7o31MHPJtISPgNygedn0JSPH XKWKRhdnMGee8oj6bw91+uyxqKKsAR7HAOjGHUsAAMYN7Y79hbPFJboeHxTRCnEXdk3Y w5Cx0A52PjniQ2Ywiq6UAsF15fWasjz8e0QQrhcoBt797yWtU0bF/OLrHCtS+E+Kye81 RBXnHfBrHscsmmqoUC9yiHGJDjO/AnXKKqKx+ecDgNd0taDbB9iiU6q4PputcTTAg+x4 bM8xjX+OLxbA60sjrhA5g4o8EXFR9XCOtM2iRxc8x2lWm1h44gVrR9c1p4x1/1C7cgd1 uZUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=fFZ+aEZr; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48e3ed2da60si20926476f8f.479.2026.10.27.11.15.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 11:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=fFZ+aEZr; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=QLoAL6c/DaBwJ4LASXvCsWlBI+Zfy1oRs8UYW4wD1WA=; b=fFZ+aEZrj/23FxhYpJI 7SLF2KmAYo0w07w2qfzatHkgCjHwejQrZgQtyMHcru97GJd72eYYeSkF0uCahL75EB4fS372opxXP r28VYy51dXwDDUk+zi89IqZU1kzhPyHOPqNKgn+/Hq+QCblrlb7HCdAA57tU3c/pfKICKk9OBVx+v t8BLNyoKIqNMbXzuRHr4M4w4nyy3i3GhWqRLINZz5EYxygQCDLzuwwONynpZH4vUmlpJbgPZDp7Je jv8D6eYJwwPtCVs4F9dRiKVqWP1gpHtr/SU2A6s28E3upBZ0ZYncbOnuiHnECQuDhbEUa122ipkot TLzqqQyq/E0bOrA==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xLldx-001dYc-33; Tue, 27 Oct 2026 19:15:12 +0100 From: Konstantin Khorenko Date: Tue, 27 Oct 2026 19:15:21 +0100 MIME-Version: 1.0 Message-Id: <20261027-b4-prep-khorenko-vstor-150731-xsk-veth-netns-v4-3-c74cad570c70@virtuozzo.com> References: <20261027-b4-prep-khorenko-vstor-150731-xsk-veth-netns-v4-0-c74cad570c70@virtuozzo.com> In-Reply-To: <20261027-b4-prep-khorenko-vstor-150731-xsk-veth-netns-v4-0-c74cad570c70@virtuozzo.com> To: Konstantin Khorenko , devel@openvz.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3095; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=TgrBCxGhYZN7sXqvLZJLjQ+l7XC+Z4FFJxdJh/I+Uw0=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq4Oo5qJA76xufHDoOMIBZZgwvYTI/kMUKn9Z18 eHB97u2FYSJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCauDqOQAKCRBRlgpH+WFc Kp+pD/9kD/hridKNbD0A1e4WB/d7K9va8z4O5F5YP6kwhnKlPSud9m56nOOGAcxIYOZQTCur8SL JHKBNBVi/iH4US9FkZptSnmIkVIj1erO1Slpb++2ERT15FdNtwnQwoQdUtyWIvScMNy2IvU0K9+ aTmrW6sZwa8257uGitQWpgfmEds4Ax6T0HBmyOuPp9HwpRZfrS8utP36LPgT3UWiBJ8h1w0cfqK lN4GX32TXUVaituXdEmcdQ18dmLh13mwbezay925zRU46LHKSch8su9KEy5ncNjrvCryUQw07Nf 6+hBPrBtfweW/HviSand8s27Dv0FHSVbPnuNwx+e8UoixcI1PuVFyqSkDcwdj/MqyIumemj15Kj nA7spW/y3EWAlzEGoLtdqRdFtZWx8+D6668v+S/hdzcZpzfUkH+7lTkusBBlMQIVFoEs6GHE+PN zNA1nA1ZiBtckLsoITxCbDm3Mdc+UzNveJEmUYDJzASH00JZ0kKuSZM/zW842zJW6L4TJ6/XrBi 2oHCMu/grZ3yn6E/Wozc6PrqFW/3noDmHjr8ZOa60ay/d3/fXXwxS2elnO12Hsc0zdpNpjMOr4o Fo5sUe9xNlyL6bsAlcVig1bzvr2fUsI4YY42seMdjzvc5Vl4r6vgSF/90hsWKzjutVQaqlEcfGV owGvX7bH7DOyEYQ== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Subject: [Devel] [PATCH hci-8.1 v4 3/3] selftests/bpf: run the xsk veth tests in a network namespace of their own X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Eva Kurchatova test_xsk.sh makes its veth pair in the namespace it runs in, and the host treats it as any new interface: address configuration, neighbour discovery and the like happen on that pair. The AF_XDP sockets under test receive the host's packets among their own. The tests count and inspect what they receive, so they fail on a configured host and pass on a bare one. Re-run the veth part in an unnamed network namespace with a sysfs of its own, which the busy poll setup writes to. The namespace goes away with its last process however the run ends, and takes the pair with it. With -d the pair has to outlive the run, so the namespace gets a name, and the script prints how to enter and delete it. If no network namespace can be created, the tests are skipped, as without veth or ip. A failure after that, mounting sysfs in the namespace included, fails the run. https://virtuozzo.atlassian.net/browse/VSTOR-150731 Feature: fix selftests Signed-off-by: Eva Kurchatova Signed-off-by: Konstantin Khorenko --- tools/testing/selftests/bpf/test_xsk.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh index 65aafe0003db0..1554d1ec02b12 100755 --- a/tools/testing/selftests/bpf/test_xsk.sh +++ b/tools/testing/selftests/bpf/test_xsk.sh @@ -68,7 +68,8 @@ # Run with verbose output: # sudo ./test_xsk.sh -v # -# Set up veth interfaces and leave them up so xskxceiver can be launched in a debugger: +# Set up veth interfaces in a network namespace and leave them up so +# xskxceiver can be launched in a debugger there: # sudo ./test_xsk.sh -d # # Run test suite for physical device in loopback mode @@ -162,8 +163,33 @@ if [ ! -z $ETH ]; then VETH1=${ETH} else validate_root_exec - validate_veth_support ${VETH0} validate_ip_utility + # The host configures and talks on any new interface in its namespace + if [ -z "$XSK_NETNS" ]; then + if ! unshare --net true; then + echo "skip all tests: cannot create a network namespace" >&2 + test_exit $ksft_skip + fi + if [[ $debug -ne 1 ]]; then + # Unnamed, it goes with its last process; its own sysfs shows its interfaces + XSK_NETNS=1 exec unshare --net --mount sh -c \ + 'mount -t sysfs sysfs /sys && exec bash "$0" "$@"' \ + "$0" "$@" + fi + # The pair of a run by hand outlives it, in a namespace with a name + XSK_NETNS=xsk${VETH0_POSTFIX} + ip netns add ${XSK_NETNS} || exit 1 + trap "ip netns del ${XSK_NETNS}" EXIT + # This run's veth names were never created; the pair is in the namespace + trap "exit 1" INT + XSK_NETNS=${XSK_NETNS} ip netns exec ${XSK_NETNS} bash "$0" "$@" || exit + trap - EXIT + echo "The pair is up in network namespace ${XSK_NETNS}," \ + "use ip netns exec ${XSK_NETNS};" \ + "ip netns del ${XSK_NETNS} removes it" + exit 0 + fi + validate_veth_support ${VETH0} setup_vethPairs retval=$? -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel