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: <87frkhdcyf.fsf@nvidia.com>
Date: Thu, 13 Feb 2025 17:23:07 +0100
From: Petr Machata <petrm@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: Petr Machata <petrm@...dia.com>, <davem@...emloft.net>,
	<netdev@...r.kernel.org>, <edumazet@...gle.com>, <pabeni@...hat.com>,
	<andrew+netdev@...n.ch>, <horms@...nel.org>, <willemb@...gle.com>,
	<shuah@...nel.org>
Subject: Re: [PATCH net-next 1/3] selftests: drv-net: resolve remote
 interface name


Jakub Kicinski <kuba@...nel.org> writes:

> On Thu, 13 Feb 2025 15:31:57 +0100 Petr Machata wrote:
>> > +    def resolve_remote_ifc(self):
>> > +        v4 = v6 = None
>> > +        if self.remote_v4:
>> > +            v4 = ip("addr show to " + self.remote_v4, json=True, host=self.remote)
>> > +        if self.remote_v6:
>> > +            v6 = ip("addr show to " + self.remote_v6, json=True, host=self.remote)
>> > +        if v4 and v6 and v4[0]["ifname"] != v6[0]["ifname"]:
>> > +            raise Exception("Can't resolve remote interface name, v4 and v6 don't match")
>> > +        return v6[0]["ifname"] if v6 else v4[0]["ifname"]  
>> 
>> Is existence of more than one interface with the same IP address a
>> concern? I guess such configuration is broken and wouldn't come up in a
>> selftest, but consider throwing in an "len(v4) == len(v6) == 1" for
>> robustness sake. 
>
> Will do!
>
>> I guess it could in fact replace the "v4 and v6" bit.
>
> Hm, I think that bit has to stay, we only record one interface.
> So if v4 and v6 given to the test are on different interfaces
> there could be some confusion. Not that we currently validate
> the same thing for the local machine..

Yeah, I misread the code actually. The goal is, if we have results for
both IPv4 and IPv6, do some extra validation. So the "v4 and v6" part
has to stay. (Plus I forgot that both start out as None, so you can't
just len() them willy nilly anyway.)

I think it should be this or thereabouts?

        if v4 and v6 and (not(len(v4) == len(v6) == 1) or
                          v4[0]["ifname"] != v6[0]["ifname"]):
            raise Exception("Can't resolve remote interface name, v4 and v6 don't match")

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ