All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v2 1/2] selftests: net: veth: check UDP GRO forwarding on forwarded traffic
Date: Tue, 27 Oct 2026 18:27:50 +0100	[thread overview]
Message-ID: <20261027-b4-prep-khorenko-vstor-151678-veth-udp-gro-fwd-v2-1-33d8d5c1f257@virtuozzo.com> (raw)
In-Reply-To: <20261027-b4-prep-khorenko-vstor-151678-veth-udp-gro-fwd-v2-0-33d8d5c1f257@virtuozzo.com>

From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

The rx-udp-gro-forwarding checks fail with "got 10 packets, expected 1"
on a host with a UDP tunnel or UDP_GRO socket open, a vxlan say, and
pass on a host without one.

Since commit f2e9de210d50 ("udp: gro behind static key") GRO looks the
receiving socket up only while such a socket exists, in any netns. Since
commit 36707061d6ba ("udp: allow forwarding of plain (non-fraglisted)
UDP GRO packets") the feature aggregates only datagrams GRO finds no
socket for. The checks send to a socket in the receiving namespace, so
they pass only while GRO does not look it up.

This tree made them pass by changing the kernel instead, in
commit 8ce3afeec4ca ("udp: let rx-udp-gro-forwarding aggregate under
encapsulation"), which upstream did not take.

Let the destination forward the datagrams to a receiver in a namespace
behind it: no socket is found there, whatever the host runs, and the
checks count what the destination receives as before.

Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Link: https://lore.kernel.org/netdev/CAF=yD-LZSec9g_0bBgrcQvq2OO1BrxMSRHH=uU7eamCmWcTO_A@mail.gmail.com/
https://virtuozzo.atlassian.net/browse/VSTOR-151678
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 tools/testing/selftests/net/veth.sh | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
index 6bb7dfaa30b6a..87d11f854221f 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -9,10 +9,13 @@ readonly DST=1
 readonly DST_NAT=100
 readonly NS_SRC=$BASE$SRC
 readonly NS_DST=$BASE$DST
+readonly RCV=3
+readonly NS_RCV=$BASE$RCV
 
 # "baremetal" network used for raw UDP traffic
 readonly BM_NET_V4=192.168.1.
 readonly BM_NET_V6=2001:db8::
+readonly RCV_NET_V4=192.168.2.
 
 readonly CPUS=`nproc`
 ret=0
@@ -24,7 +27,7 @@ cleanup() {
 	[ -n "${jobs}" ] && kill -1 ${jobs} 2>/dev/null
 	rm -f $STATS
 
-	for ns in $NS_SRC $NS_DST; do
+	for ns in $NS_SRC $NS_DST $NS_RCV; do
 		ip netns del $ns 2>/dev/null
 	done
 }
@@ -46,6 +49,17 @@ create_ns() {
 		ip -n $BASE$ns addr add dev veth$ns $BM_NET_V4$ns/24
 		ip -n $BASE$ns addr add dev veth$ns $BM_NET_V6$ns/64 nodad
 	done
+
+	# Forwarded, the datagrams find no local socket, whatever the host runs
+	ip netns add $NS_RCV
+	ip -n $NS_RCV link set dev lo up
+	ip -n $NS_DST link add name fwd$DST type veth peer name fwd$RCV netns $NS_RCV
+	ip -n $NS_DST link set dev fwd$DST up
+	ip -n $NS_RCV link set dev fwd$RCV up
+	ip -n $NS_DST addr add dev fwd$DST $RCV_NET_V4$DST/24
+	ip -n $NS_RCV addr add dev fwd$RCV $RCV_NET_V4$RCV/24
+	ip netns exec $NS_DST sysctl -wq net.ipv4.ip_forward=1
+	ip -n $NS_RCV route add default via $RCV_NET_V4$DST
 }
 
 __chk_flag() {
@@ -101,15 +115,17 @@ chk_gro() {
 	local msg="$1"
 	local expected=$2
 
-	ip netns exec $BASE$SRC ping -qc 1 $BM_NET_V4$DST >/dev/null
+	# Taking veth$SRC down drops the route, so set it for every check
+	ip -n $NS_SRC route replace ${RCV_NET_V4}0/24 via $BM_NET_V4$DST
+	ip netns exec $BASE$SRC ping -qc 1 $RCV_NET_V4$RCV >/dev/null
 	NSTAT_HISTORY=$STATS ip netns exec $NS_DST nstat -n
 
 	printf "%-60s" "$msg"
-	ip netns exec $BASE$DST ./udpgso_bench_rx -C 1000 -R 10 &
+	ip netns exec $NS_RCV ./udpgso_bench_rx -C 1000 -R 10 &
 	local spid=$!
 	sleep 0.1
 
-	ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 13000 -S 1300 -M 1 -D $BM_NET_V4$DST
+	ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 13000 -S 1300 -M 1 -D $RCV_NET_V4$RCV
 	local retc=$?
 	wait $spid
 	local rets=$?

-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-10-27 17:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 17:27 [Devel] [PATCH hci-8.1 v2 0/2] selftests: net: veth: run under separate netns Konstantin Khorenko
2026-10-27 17:27 ` Konstantin Khorenko [this message]
2026-10-27 17:27 ` [Devel] [PATCH hci-8.1 v2 2/2] Revert "udp: let rx-udp-gro-forwarding aggregate under encapsulation" Konstantin Khorenko
2026-10-27 17:57 ` [Devel] [PATCH hci-8.1 v2 0/2] selftests: net: veth: run under separate netns Eva Kurchatova (Virtuozzo)
2026-10-29 15:16 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261027-b4-prep-khorenko-vstor-151678-veth-udp-gro-fwd-v2-1-33d8d5c1f257@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=eva.kurchatova@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.