From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202510 header.b=xRaK0k2O; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 2BD825A095E for ; Thu, 13 Nov 2025 02:34:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1762997654; bh=NzGdSvyBAdXZFy4shig0kY1+BKqVMEmQvyMjt4ZQl3M=; h=From:To:Cc:Subject:Date:From; b=xRaK0k2ObKIx3S4nQ29uB70kb4amWrQZtoRBvmIRgB97OCqyaPaafY4eNNBwlwoNh bmVJ7jEu2T8SDClFuR/XVSLeRppP7doOm0dEPgMVLHJxrf3SAbS2RhPaoJYcSgYqro rGRW2/6ywYwBqovt3IxSPgabfoyri2H2wo1Vuq47mueqJgUQaJfboHbfy5r+fTUtO8 7C5OFC9eDyUgsNaFVM/WaVQsJ6QcnYDnDEEO19oalx0O1IOvI95eAqa7y5vwNsBK3/ g/TvV3MEfI5YOxledP83kOiRH89XYHpgUJlTU19Y/Bx0ydtWiVnKjQ7Y5PsSyMB7+p gE7ItwI4j/gkQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4d6N9259LLz4wBJ; Thu, 13 Nov 2025 12:34:14 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH] udp: Use IP_FREEBIND for flow sockets as well as listening sockets Date: Thu, 13 Nov 2025 12:34:13 +1100 Message-ID: <20251113013413.331446-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.51.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: PA63TUDV6HKOTIXPROZYRVZJZQ5Q6R3I X-Message-ID-Hash: PA63TUDV6HKOTIXPROZYRVZJZQ5Q6R3I X-MailFrom: dgibson@gandalf.ozlabs.org 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: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The --freebind option allows pasta to listen on addresses that aren't registered on the host, which has a number of use cases. However, we omitted this option for UDP "flow sockets" which are created once a flow is started, connect()ed specifically to the peer. Flow sockets are also bound, and if the peer has contacted a freebind address, we need IP_FREEBIND to do so. Link: https://bugs.passt.top/show_bug.cgi?id=174 Signed-off-by: David Gibson --- util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) I'm still waiting on confirmation from the reporter that this actually fixes bug 174. However, I'm pretty sure this is _a_ correct fix, whether or not it's a complete fix for the issue seen by the reporter. diff --git a/util.c b/util.c index 44c21a3e..ab23463b 100644 --- a/util.c +++ b/util.c @@ -67,9 +67,8 @@ int sock_l4_sa(const struct ctx *c, enum epoll_type type, freebind = c->freebind; break; case EPOLL_TYPE_UDP_LISTEN: - freebind = c->freebind; - /* fallthrough */ case EPOLL_TYPE_UDP: + freebind = c->freebind; proto = IPPROTO_UDP; socktype = SOCK_DGRAM | SOCK_NONBLOCK; break; -- 2.51.1