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=MAdsbn3g; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 12A825A061B for ; Tue, 02 Dec 2025 05:02:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1764648138; bh=rm6e1rK/qCzzYiVbjt+kEdDAYOK93AsGuEi5NGlYXg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MAdsbn3gnCE0BDy2xgQWIZglmGSGkyd09JK/tR93AA9D1t18zCnSebi2BiMrKnCsO TUCx2z7ClTXK8feN6eGk7OhCksffzbqRvKuNset74SpoCo/dwkr7R4rg3OyXw0jEMG wIxpO7hL5VMLeb7dSQhcik71iS6Fx93jw6uUagFWPQ2mjaPBjd/MvSxAwvMaLl1VG7 xRy/SxU30Tj4EValEuxhQ6Ffq6M4XsVrQ899qRY4q6X4n88JJ6lxaWeTAUzSWR/NdC JlZ+HgJHwdw6PQNTBX9Cf09ROQYD4lVjy8OhBopRcbyPIo6HD59qQn9IEZUUWfQIh0 dm0TLHBrY+mGg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dL6Y61jp6z4wQg; Tue, 02 Dec 2025 15:02:18 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v5 13/15] util: Rename sock_l4_dualstack() to sock_l4_dualstack_any() Date: Tue, 2 Dec 2025 15:02:13 +1100 Message-ID: <20251202040215.2351792-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202040215.2351792-1-david@gibson.dropbear.id.au> References: <20251202040215.2351792-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: PUBLJZGE35YVUB7ANOU2VFOZFCKKKT5E X-Message-ID-Hash: PUBLJZGE35YVUB7ANOU2VFOZFCKKKT5E 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: Stefano correctly noted that the fact a socket is dual-stack doesn't necessarily imply that it is bound to a wildcard address. While that's the only case we use for dual-stack sockets, there may be others. Therefore rename this function to make it clearer that it always uses a wildcard bind. Suggested-by: Stefano Brivio Signed-off-by: David Gibson --- pif.c | 2 +- util.c | 6 +++--- util.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pif.c b/pif.c index db447b4f..3d7a90e5 100644 --- a/pif.c +++ b/pif.c @@ -82,7 +82,7 @@ int pif_sock_l4(const struct ctx *c, enum epoll_type type, uint8_t pif, ASSERT(pif_is_socket(pif)); if (!addr) { - ref.fd = sock_l4_dualstack(c, type, port, ifname); + ref.fd = sock_l4_dualstack_any(c, type, port, ifname); } else { union sockaddr_inany sa; diff --git a/util.c b/util.c index 853c35a3..fb1945c1 100644 --- a/util.c +++ b/util.c @@ -198,7 +198,7 @@ int sock_l4(const struct ctx *c, enum epoll_type type, } /** - * sock_l4_dualstack() - Create a dual stack socket bound with wildcard address + * sock_l4_dualstack_any() - Create dualstack socket bound to :: and 0.0.0.0 * @c: Execution context * @type: epoll type * @port Port to bind to (:: and 0.0.0.0) @@ -208,8 +208,8 @@ int sock_l4(const struct ctx *c, enum epoll_type type, * * A dual stack socket is effectively bound to both :: and 0.0.0.0. */ -int sock_l4_dualstack(const struct ctx *c, enum epoll_type type, - in_port_t port, const char *ifname) +int sock_l4_dualstack_any(const struct ctx *c, enum epoll_type type, + in_port_t port, const char *ifname) { union sockaddr_inany sa = { .sa6.sin6_family = AF_INET6, diff --git a/util.h b/util.h index ebc14138..21acc05f 100644 --- a/util.h +++ b/util.h @@ -210,8 +210,8 @@ union sockaddr_inany; int sock_l4(const struct ctx *c, enum epoll_type type, const union sockaddr_inany *sa, const char *ifname); -int sock_l4_dualstack(const struct ctx *c, enum epoll_type type, - in_port_t port, const char *ifname); +int sock_l4_dualstack_any(const struct ctx *c, enum epoll_type type, + in_port_t port, const char *ifname); int sock_unix(char *sock_path); void sock_probe_features(struct ctx *c); long timespec_diff_ms(const struct timespec *a, const struct timespec *b); -- 2.52.0