Re: [PATCH 4/4] lwip: treat zero/invalid IPv4 addresses as unset in init_ifs

Samuel Thibault <[email protected]> Sun, 28 Jun 2026 00:28:57 +0200
Newsgroups gmane.os.hurd.bugs
Organization I am not organized
Message-ID <akBOqfMsXeFBkpfZ@end>
Applied, thanks!


Joan Lledó, le sam. 27 juin 2026 12:08:01 +0200, a ecrit:
> From: Joan Lledó <[email protected]>
> 
>     When the caller passes INADDR_ANY or INADDR_NONE as the address, reset
>     netmask, peer and gateway to INADDR_NONE too, so the configuration passes
>     ipv4config_is_valid() validation instead of being silently dropped.
> ---
>  lwip/lwip-util.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lwip/lwip-util.c b/lwip/lwip-util.c
> index 988e3675..f6f0a631 100644
> --- a/lwip/lwip-util.c
> +++ b/lwip/lwip-util.c
> @@ -169,6 +169,18 @@ init_ifs (void *arg)
>        if (!in->dev_name[0])
>  	continue;
>  
> +      /*
> +       * The caller is trying to set an invalid address,
> +       * set all fields to empty so it passes the validation
> +       */
> +      if (in->address.addr == INADDR_ANY || in->address.addr == INADDR_NONE)
> +	{
> +	  in->address.addr = INADDR_NONE;
> +	  in->netmask.addr = INADDR_NONE;
> +	  in->peer.addr = INADDR_NONE;
> +	  in->gateway.addr = INADDR_NONE;
> +	}
> +
>        if (!ipv4config_is_valid (in->address.addr, in->netmask.addr,
>  				in->gateway.addr, INADDR_NONE))
>  	continue;
> -- 
> 2.50.1
> 
> 

-- 
Samuel
* y se leve dans 2h10