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: <CANn89iLQ2tDcWq-aLe-FhQU2cX8txF5L9SewiB1ssJh+7ds46Q@mail.gmail.com>
Date: Tue, 27 Jan 2026 08:37:21 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Dmitry Skorodumov <skorodumov.dmitry@...wei.com>
Cc: Kuniyuki Iwashima <kuniyu@...gle.com>, Dmitry Skorodumov <dskr99@...il.com>, netdev@...r.kernel.org, 
	Jakub Kicinski <kuba@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Xiao Liang <shaw.leon@...il.com>, 
	linux-kernel@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v2 net-next 2/3] ipvlan: Common code from v6/v4 validator_event

On Tue, Jan 27, 2026 at 6:56 AM Dmitry Skorodumov
<skorodumov.dmitry@...wei.com> wrote:
>
> On 1/26/2026 9:01 PM, Kuniyuki Iwashima wrote:
> > On Fri, Jan 23, 2026 at 9:04 AM Dmitry Skorodumov <dskr99@...il.com> wrote:
>
> >> +static int ipvlan_addr_validator_event_cb(struct notifier_block *nblock,
> >> +                                         unsigned long event, void *ptr)
> >> +{
> >> +       struct in6_validator_info *i6vi;
> >> +       struct net_device *dev;
> >> +
> >> +       if (nblock == &ipvlan_addr4_vtor_notifier_block) {
> >
> > If you check this against the v6 one instead, the if block
> > and the i6vi definition can be guarded with
> > #if IS_ENABLED(CONFIG_IPV6)
>
> Hm... Few months ago, I had a conversation here that convinced me: avoid
> #ifdef whenever possible. They overburden code and reduce readability.
>
> It even might be a good idea to replace wherever possible preprocessor
> checks with runtime checks. Use
> if (IS_ENABLED(CONFIG_IPV6)) { ... }
>
> instead of #if IS_ENABLED(CONFIG_IPV6) ... #endif
>
> --
>
> I'm ok with both approaches (though i tend to like runtime checks) - but
> unsure what is a common practice in bpf-net

What you call runtime checks is in reality the same : C compiler is
able to optimize constant boolean expressions

if (0) {
  code_0;
}

if (0 &&  anything) {
  code_0_1;
}

-> Compiler will completely remove all of this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ