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: <CAHS8izMjCX=PkU0bE6s46uXxrnHjP71G6LN0v6oQumNa2Mouzg@mail.gmail.com>
Date: Mon, 19 May 2025 10:31:30 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Stanislav Fomichev <stfomichev@...il.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, 
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Simon Horman <horms@...nel.org>, Jesper Dangaard Brouer <hawk@...nel.org>, 
	Ilias Apalodimas <ilias.apalodimas@...aro.org>, Neal Cardwell <ncardwell@...gle.com>, 
	Kuniyuki Iwashima <kuniyu@...zon.com>, David Ahern <dsahern@...nel.org>, 
	Andrew Lunn <andrew+netdev@...n.ch>, Shuah Khan <shuah@...nel.org>, sdf@...ichev.me, 
	ap420073@...il.com, praan@...gle.com, shivajikant@...gle.com
Subject: Re: [PATCH net-next v1 5/9] net: devmem: ksft: add ipv4 support

On Mon, May 19, 2025 at 8:32 AM Stanislav Fomichev <stfomichev@...il.com> wrote:
>
> On 05/19, Mina Almasry wrote:
> > ncdevmem supports both ipv4 and ipv6, but the ksft is currently
> > ipv6-only. Propagate the ipv4 support to the ksft, so that folks that
> > are limited to these networks can also test.
> >
> > Signed-off-by: Mina Almasry <almasrymina@...gle.com>
> >
> > ---
> >  .../selftests/drivers/net/hw/devmem.py        | 33 ++++++++++++-------
> >  1 file changed, 22 insertions(+), 11 deletions(-)
> >
> > diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
> > index f5d7809400ea..850381e14d9e 100755
> > --- a/tools/testing/selftests/drivers/net/hw/devmem.py
> > +++ b/tools/testing/selftests/drivers/net/hw/devmem.py
> > @@ -18,30 +18,36 @@ def require_devmem(cfg):
> >          raise KsftSkipEx("Test requires devmem support")
> >
> >
> > -def check_rx(cfg) -> None:
> > -    cfg.require_ipver("6")
> > +def check_rx(cfg, ipver) -> None:
> >      require_devmem(cfg)
> >
> > +    addr = cfg.addr_v[ipver]
> > +    if ipver == "6":
> > +        addr = "[" + addr + "]"
>
> I think you can add [] unconditionally, no need to special case v6.
>

I'll double check, but IIRC the [] were v6-only.

> > +
> > +    socat = f"socat -u - TCP{ipver}:{addr}:{port}"
> > +
> >      port = rand_port()
> >      listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}"
> >
> > -    with bkg(listen_cmd) as socat:
> > +    with bkg(listen_cmd) as ncdevmem:
> >          wait_port_listen(port)
> > -        cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP6:[{cfg.addr_v['6']}]:{port}", host=cfg.remote, shell=True)
> > +        cmd(f"echo -e \"hello\\nworld\"| {socat}", host=cfg.remote, shell=True)
> >
> > -    ksft_eq(socat.stdout.strip(), "hello\nworld")
> > +    ksft_eq(ncdevmem.stdout.strip(), "hello\nworld")
> >
> >
> > -def check_tx(cfg) -> None:
> > -    cfg.require_ipver("6")
> > +def check_tx(cfg, ipver) -> None:
> >      require_devmem(cfg)
> >
> >      port = rand_port()
> > -    listen_cmd = f"socat -U - TCP6-LISTEN:{port}"
> > +    listen_cmd = f"socat -U - TCP{ipver}-LISTEN:{port}"
> >
> > -    with bkg(listen_cmd, exit_wait=True) as socat:
> > +    addr = cfg.addr_v[ipver]
> > +
> > +    with bkg(listen_cmd) as socat:
> >          wait_port_listen(port)
> > -        cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}", host=cfg.remote, shell=True)
> > +        cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {addr} -p {port}", host=cfg.remote, shell=True)
> >
> >      ksft_eq(socat.stdout.strip(), "hello\nworld")
> >
> > @@ -51,8 +57,13 @@ def main() -> None:
> >          cfg.bin_local = path.abspath(path.dirname(__file__) + "/ncdevmem")
> >          cfg.bin_remote = cfg.remote.deploy(cfg.bin_local)
> >
> > +        if "4" in cfg.addr_v:
> > +            ipver = "4"
> > +        else:
> > +            ipver = "6"
>
> If we have both, we prefer v4, can we do the opposite?

Sure, but why? Just curious.

-- 
Thanks,
Mina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ