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=L9HbljoS; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 0A6465A061A for ; Wed, 29 Oct 2025 07:26:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1761719195; bh=uOWk1+Nh4InguXcx9h2cW5HXG+BZ5OGNpL++6y61kxw=; h=From:To:Cc:Subject:Date:From; b=L9HbljoSsxLg5SMS38TS1XuZ4vnPKnJZYy8RsrqefWt7riOfpwMQRN2QrVpVU/O8w 8w88tUMlrC621PvmHzq9j+cshNt7Hc/8UnC+BgWTvrLL05hwa0ZW/7yHS4JQjr7fwE lprnR+53pzpmDUupnbSgs8iF+nbuPOQCyOH8f+1otUe7KN/viA8JiSnlUL32AxVig3 xVp+TKUKfTgwbTLYCjROGJ1vHfZdRvEJQSDuOdHgPDVfdF9S1S3izQHsoWR9pwQSbx n+h/xWKWh0bFEjLol9gyuyjbVhOaXy2/WtC3+Qv62k7+651sEW81imtwmPf1xYBKFZ zeQK87nECVixg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cxHMH0sW1z4wD7; Wed, 29 Oct 2025 17:26:35 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 0/8] Reduce differences between inbound and outbound socket binding Date: Wed, 29 Oct 2025 17:26:20 +1100 Message-ID: <20251029062628.1647051-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.51.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 6HUV6JYP4KCVNKPNN5WTSUZRRFZ5CXLE X-Message-ID-Hash: 6HUV6JYP4KCVNKPNN5WTSUZRRFZ5CXLE 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 fact that outbound forwarding sockets are bound to the loopback address, whereas inbound forwarding sockets are (by default) bound to the unspecified address leads to some unexpected differences between the paths setting up each of them. An idea for tackling bug 100 suggested a different approach which will also reduce some of those differences and allow more code to be shared between the two paths. I've since discovered that this approach may not help for bug 100, but it might still be worthwhile for the clean up. Patches 1..6/8 are cleanups which shouldn't change behaviour, and I think are ready to merge. 7/8 is (arguably) a behavioural change, but I've made my case for it in the patch comment. 8/8 needs some further consideration, since I've discovered it does not fix bug 100 as is, I'm including it for advance review, though. v3: - A number of additional fixes covering the handling of IPV6_V6ONLY sockopt - Assorted trivial changes v2: - Some rearrangements and rewordings for clarity David Gibson (8): inany: Let length of sockaddr_inany be implicit from the family util, flow, pif: Simplify sock_l4_sa() interface tcp: Merge tcp_ns_sock_init[46]() into tcp_sock_init_one() udp: Unify some more inbound/outbound parts of udp_sock_init() udp: Move udp_sock_init() special case to its caller util: Fix setting of IPV6_V6ONLY socket option tcp, udp: Remove fallback if creating dual stack socket fails [RFC, DO NOT APPLY] tcp, udp: Bind outbound listening sockets by interface instead of address conf.c | 4 +- flow.c | 19 +++--- icmp.c | 3 +- inany.h | 18 ++++++ pif.c | 26 ++------ pif.h | 2 +- tcp.c | 164 +++++++++++++++++++-------------------------------- tcp.h | 5 +- tcp_splice.c | 5 +- udp.c | 102 +++++++++++++++----------------- udp.h | 5 +- util.c | 55 +++++++++++++---- util.h | 9 ++- 13 files changed, 201 insertions(+), 216 deletions(-) -- 2.51.0