From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 114205A0269 for ; Thu, 19 Nov 2026 06:36:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795066571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mRFrGmrKfKPi0jYeaN0OCryacq9tCUNTj/xyACR2f6E=; b=X115HGlEV0YE/h15bEcqwerMSCigNYNxIVSYhfHvBvAbROzJr5yf5cer0xZaq+a9kte7By hYruVZU46bfjQ61pMd3PKYmPX4Nj3LZjtc8Ls1MSAFYD6g20yZrkWvomAvB1RHiCAb6X01 Ou8bG9UOMWLnE7hfIt+tzbd3i0dZYBA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-207-G8cKCoR9MUqRSwtbsfU4vg-1; Thu, 19 Nov 2026 00:36:07 -0500 X-MC-Unique: G8cKCoR9MUqRSwtbsfU4vg-1 X-Mimecast-MFC-AGG-ID: G8cKCoR9MUqRSwtbsfU4vg_1795066566 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4ba01393800so11443815e9.1 for ; Wed, 18 Nov 2026 21:36:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795066566; x=1795671366; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=mRFrGmr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tT1RoiYXxG58P8wAUP62 HT00wUxhtF X-Received: by 2002:a05:600c:8b8a:b0:4bb:6687:5394 with SMTP id 5b1f17b1804b1-4bb7da13abemr99887735e9.9.1795066566033; Wed, 18 Nov 2026 21:36:06 -0800 (PST) X-Received: by 2002:a05:600c:8b8a:b0:4bb:6687:5394 with SMTP id 5b1f17b1804b1-4bb7da13abemr99887085e9.9.1795066565310; Wed, 18 Nov 2026 21:36:05 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853a12acsm10138155e9.8.2026.11.18.21.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 21:36:04 -0800 (PST) From: Stefano Brivio To: Tobias Wiesing Subject: Re: pasta: UDP flow sockets use the default receive buffer, dropping datagrams of a WireGuard client Message-ID: <20261119063602.7095a07c@elisabeth> In-Reply-To: References: Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Thu, 19 Nov 2026 06:36:03 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: DeBsMjYSATgtaDlRcaMgJgUu39OoB43_7EFi9r72fCc_1795066566 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 2QO5AZQOHNYF67FFSF3XTAKJH6HBGBSD X-Message-ID-Hash: 2QO5AZQOHNYF67FFSF3XTAKJH6HBGBSD X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-user@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: "For passt users: support, questions and answers" Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Tobias, On Wed, 18 Nov 2026 20:04:15 +0100 Tobias Wiesing wrote: > Setup: passt 2026_10_02.cba3570, Podman 6.1.4, kernel 7.3.4 (openSUSE > MicroOS), rootless; a WireGuard client (gluetun, kernel WireGuard) in a > container on a Podman bridge network, so its UDP leaves through pasta. > Host: net.core.rmem_default = 212992, rmem_max = 4194304. > > Observed: downloads through the tunnel reach 4-8 MB/s on a line that > serves ~30 MB/s without it. During a 15 s download the host counts > 300-15000 UdpRcvbufErrors (nstat). Counting the tunnel's datagrams at the > host NIC, pasta's tap in the rootless netns, the container's eth0 and > the WireGuard interface shows no loss after pasta once the buffer is > large enough. > > With net.core.rmem_default = 4194304 (nothing else changed, container > restarted so pasta opens new sockets): 0 UdpRcvbufErrors, 24-27 MB/s. > The same tunnel under rootful Docker on another host reaches line rate > with the kernel defaults, as no socket is involved there. > > Source: udp.c / udp_flow.c / sock_l4() set no SO_RCVBUF on UDP sockets; > SO_RCVBUF/SO_SNDBUF are set only on the tap fd (tap.c), after > sock_probe_features(). Unlike TCP there is no autotuning for UDP, so the > socket keeps rmem_default. > > Question: could pasta set SO_RCVBUF on its UDP sockets (e.g. up to > rmem_max when sock_probe_features() allows large buffers, as for the tap > fd), or offer an option for it? Raising rmem_default host-wide works but > affects every socket on the host. Thanks for the report and for the suggestion. I think it needs a bit of research. For context, for TCP, we used to set large values, and then we could finally drop those settings (and let auto-tuning do its course) after a number of optimisations and fixes: https://passt.top/passt/commit/?id=71249ef3f9bcf1dbb2d6c13cdbc41ba88c794f06 and the topic is tracked at https://bugs.passt.top/show_bug.cgi?id=138 in general. For UDP, we never really looked into it. I had no idea it mattered until your report, actually. For maximum throughput, of course, we could simply try to set SO_RCVBUF to rmem_max on all sockets, and the buffer allocation in the kernel should only happen as that memory is actually used, so we don't _necessarily_ waste memory by doing that, but I suppose there might be a risk (especially in case the whole buffer is used at some point, and then buffer usage decreases). I see three possibilities, broadly speaking: 1. implement some kind of auto-tuning ourselves. For example udp_sock_recv() (or callers) could check how many bytes are dequeued at once, and periodically adjust the buffer size for a specific socket with some hysteresis (say, expand if we use more than 50 % of the buffer, shrink if we use less than 20 %) 2. add a command line option, or two (what about SO_SNDBUF?), that would apply to all the UDP sockets we use. Safe, but not really convenient as most users wouldn't know about it, and by default we might impose a performance penalty on them 3. just go with the maximum size, maybe it's fine and we don't actually waste any memory (but it needs to be checked) One further thought before trying to evaluate one of these, though: this is UDP, where latency might matter more than throughput, especially if you carry TCP on top of it, and just making buffers larger might by itself contribute to bufferbloat. Could your issue with Wireguard come from the fact that we dequeue "too many" frames at once? What happens if you decrease UDP_MAX_FRAMES in udp.c to, say, 8? Should we try to (dynamically?) tune that value instead? All in all, I think any of those alternatives would be viable, so feel free to send changes, but they need to be supported by some evidence and testing. -- Stefano