Subject: Re: [PATCH] iproute_lwtunnel: Add check for result of get_u32 function

From: Stephen Hemminger <[email-masked]>
Date: Sun, 7 Jul 2024 14:22:44 -0700

On Sun,  7 Jul 2024 18:49:28 +0300
Maks Mishin <[email-masked]> wrote:

> Signed-off-by: Maks Mishin <[email-masked]>
> ---
>  ip/iproute_lwtunnel.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
> index b4df4348..2946fa4d 100644
> --- a/ip/iproute_lwtunnel.c
> +++ b/ip/iproute_lwtunnel.c
> @@ -1484,7 +1484,8 @@ static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
>  				NEXT_ARG();
>  				if (hmac_ok++)
>  					duparg2("hmac", *argv);
> -				get_u32(&hmac, *argv, 0);
> +				if (get_u32(&hmac, *argv, 0) || hmac == 0)
> +					invarg("\"hmac\" value is invalid\n", *argv);
>  			} else {
>  				continue;
>  			}

Fixes: 8db158b9caac ("iproute: add support for SRv6 local segment processing")

The message is not that great. Becomes:
	Error: argument "XXX" is wrong: "hmac" value is invalid.

But the rest of the tunnel parsing is equally as cryptic on error messages.