public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>,
	Stefano Brivio <sbrivio@redhat.com>,
	passt-dev@passt.top
Subject: Re: [PATCH v3 01/14] inany: Extend inany_ntop() to treat NULL as a fully unspecified address
Date: Thu, 8 Jan 2026 14:16:59 +0100	[thread overview]
Message-ID: <8dd38f2a-e4ab-47ad-b3c7-1fcb560f57fb@redhat.com> (raw)
In-Reply-To: <20260108022948.2657573-2-david@gibson.dropbear.id.au>

On 1/8/26 03:29, David Gibson wrote:
> In a number of places we're using a convention that a NULL inany represents
> a dual-stack unspecified address, that is one which includes both 0.0.0.0
> and ::.  Extend inany_ntop() to handle that convention, representing it
> as "*".
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>   inany.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/inany.c b/inany.c
> index 7680439d..87a4d8b6 100644
> --- a/inany.c
> +++ b/inany.c
> @@ -22,7 +22,7 @@ const union inany_addr inany_loopback4 = INANY_INIT4(IN4ADDR_LOOPBACK_INIT);
>   const union inany_addr inany_any4 = INANY_INIT4(IN4ADDR_ANY_INIT);
>   
>   /** inany_ntop - Convert an IPv[46] address to text format
> - * @src:	IPv[46] address
> + * @src:	IPv[46] address (NULL for unspecified)
>    * @dst:	output buffer, minimum INANY_ADDRSTRLEN bytes
>    * @size:	size of buffer at @dst
>    *
> @@ -30,9 +30,12 @@ const union inany_addr inany_any4 = INANY_INIT4(IN4ADDR_ANY_INIT);
>    */
>   const char *inany_ntop(const union inany_addr *src, char *dst, socklen_t size)
>   {
> -	const struct in_addr *v4 = inany_v4(src);
> +	const struct in_addr *v4;
> +
> +	if (!src)
> +		return strncpy(dst, "*", size);
>   
> -	if (v4)
> +	if ((v4 = inany_v4(src)))
>   		return inet_ntop(AF_INET, v4, dst, size);
>   
>   	return inet_ntop(AF_INET6, &src->a6, dst, size);

Reviewed-by: Laurent Vivier <lvivier@redhat.com>


  reply	other threads:[~2026-01-08 13:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08  2:29 [PATCH v3 00/14] Introduce forwarding table David Gibson
2026-01-08  2:29 ` [PATCH v3 01/14] inany: Extend inany_ntop() to treat NULL as a fully unspecified address David Gibson
2026-01-08 13:16   ` Laurent Vivier [this message]
2026-01-08  2:29 ` [PATCH v3 02/14] conf, fwd: Keep a table of our port forwarding configuration David Gibson
2026-01-08  2:29 ` [PATCH v3 03/14] conf: Accurately record ifname and address for outbound forwards David Gibson
2026-01-08  2:29 ` [PATCH v3 04/14] conf, fwd: Record "auto" port forwards in forwarding table David Gibson
2026-01-08  2:29 ` [PATCH v3 05/14] fwd: Make space to store listening sockets in forward table David Gibson
2026-01-08  2:29 ` [PATCH v3 06/14] ip: Add ipproto_name() function David Gibson
2026-01-08 13:22   ` Laurent Vivier
2026-01-08 23:12     ` David Gibson
2026-01-08  2:29 ` [PATCH v3 07/14] fwd, tcp, udp: Set up listening sockets based on forward table David Gibson
2026-01-08  2:29 ` [PATCH v3 08/14] tcp, udp: Remove old auto-forwarding socket arrays David Gibson
2026-01-08  2:29 ` [PATCH v3 09/14] conf, fwd: Check forwarding table for conflicting rules David Gibson
2026-01-08  2:29 ` [PATCH v3 10/14] fwd: Generate auto-forward exclusions from socket fd tables David Gibson
2026-01-08  2:29 ` [PATCH v3 11/14] flow, fwd: Consult rules table when forwarding a new flow from socket David Gibson
2026-01-08  2:29 ` [PATCH v3 12/14] fwd: Remap ports based directly on forwarding rule David Gibson
2026-01-08  2:29 ` [PATCH v3 13/14] fwd, tcp, udp: Add forwarding rule to listening socket epoll references David Gibson
2026-01-08  2:29 ` [PATCH v3 14/14] flow, fwd: Optimise forwarding rule lookup using epoll ref when possible David Gibson

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=8dd38f2a-e4ab-47ad-b3c7-1fcb560f57fb@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).