lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6629b55be33b5_1bd6b029419@willemb.c.googlers.com.notmuch>
Date: Wed, 24 Apr 2024 21:43:55 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, 
 davem@...emloft.net
Cc: netdev@...r.kernel.org, 
 edumazet@...gle.com, 
 pabeni@...hat.com, 
 linux-kselftest@...r.kernel.org, 
 willemdebruijn.kernel@...il.com, 
 Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next 4/4] selftests: drv-net: validate the environment

Jakub Kicinski wrote:
> Throw a slightly more helpful exception when env variables
> are partially populated. Prior to this change we'd get
> a dictionary key exception somewhere later on.
> 
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>  .../selftests/drivers/net/lib/py/env.py       | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py
> index a6a5a5f9c6db..fda4967503de 100644
> --- a/tools/testing/selftests/drivers/net/lib/py/env.py
> +++ b/tools/testing/selftests/drivers/net/lib/py/env.py
> @@ -88,6 +88,7 @@ from .remote import Remote
>          self._ns_peer = None
>  
>          if "NETIF" in self.env:
> +            self._check_env()
>              self.dev = ip("link show dev " + self.env['NETIF'], json=True)[0]
>  
>              self.v4 = self.env.get("LOCAL_V4")
> @@ -143,6 +144,25 @@ from .remote import Remote
>          ip(f"-6 addr add dev {self._ns_peer.nsims[0].ifname} {self.nsim_v6_pfx}2/64 nodad", ns=self._netns)
>          ip(f"   link set dev {self._ns_peer.nsims[0].ifname} up", ns=self._netns)
>  
> +    def _check_env(self):
> +        vars_needed = [
> +            ["LOCAL_V4", "LOCAL_V6"],
> +            ["REMOTE_V4", "REMOTE_V6"],
> +            ["REMOTE_TYPE"],
> +            ["REMOTE_ARGS"]
> +        ]
> +        missing = []
> +
> +        for choice in vars_needed:
> +            for entry in choice:
> +                if entry in self.env:
> +                    break
> +            else:
> +                missing.append(choice)
> +        if missing:
> +            raise Exception("Invalid environment, missing configuration:", missing,
> +                            "Please see tools/testing/selftests/drivers/net/README.rst")
> +

I suppose this could still reach the exception if a file contains
LOCAL_V4 and REMOTE_V6 or vice versa.

But this is best effort anyway.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ