public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] conf: Add missing return in conf_nat(), fix --map-guest-addr none
@ 2025-04-08  6:03 Stefano Brivio
  2025-04-08  6:39 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2025-04-08  6:03 UTC (permalink / raw)
  To: passt-dev; +Cc: David Gibson

As reported by somebody on IRC:

  $ pasta --map-guest-addr none
  Invalid address to remap to host: none

that's because once we parsed "none", we try to parse it as an address
as well. But we already handled it, so stop once we're done.

Fixes: e813a4df7da2 ("conf: Allow address remapped to host to be configured")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/conf.c b/conf.c
index b54c55d..168646f 100644
--- a/conf.c
+++ b/conf.c
@@ -1272,6 +1272,8 @@ static void conf_nat(const char *arg, struct in_addr *addr4,
 		*addr6 = in6addr_any;
 		if (no_map_gw)
 			*no_map_gw = 1;
+
+		return;
 	}
 
 	if (inet_pton(AF_INET6, arg, addr6)	&&
-- 
@@ -1272,6 +1272,8 @@ static void conf_nat(const char *arg, struct in_addr *addr4,
 		*addr6 = in6addr_any;
 		if (no_map_gw)
 			*no_map_gw = 1;
+
+		return;
 	}
 
 	if (inet_pton(AF_INET6, arg, addr6)	&&
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] conf: Add missing return in conf_nat(), fix --map-guest-addr none
  2025-04-08  6:03 [PATCH] conf: Add missing return in conf_nat(), fix --map-guest-addr none Stefano Brivio
@ 2025-04-08  6:39 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2025-04-08  6:39 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]

On Tue, Apr 08, 2025 at 08:03:07AM +0200, Stefano Brivio wrote:
> As reported by somebody on IRC:
> 
>   $ pasta --map-guest-addr none
>   Invalid address to remap to host: none
> 
> that's because once we parsed "none", we try to parse it as an address
> as well. But we already handled it, so stop once we're done.
> 
> Fixes: e813a4df7da2 ("conf: Allow address remapped to host to be configured")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  conf.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/conf.c b/conf.c
> index b54c55d..168646f 100644
> --- a/conf.c
> +++ b/conf.c
> @@ -1272,6 +1272,8 @@ static void conf_nat(const char *arg, struct in_addr *addr4,
>  		*addr6 = in6addr_any;
>  		if (no_map_gw)
>  			*no_map_gw = 1;
> +
> +		return;
>  	}
>  
>  	if (inet_pton(AF_INET6, arg, addr6)	&&

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-08  6:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-08  6:03 [PATCH] conf: Add missing return in conf_nat(), fix --map-guest-addr none Stefano Brivio
2025-04-08  6:39 ` David Gibson

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).