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] [day] [month] [year] [list]
Message-ID: <CAG=2xmOv+u=GDUt-TsJbZzOcExLWmPpSueP3CEvn3YXX5u22Rg@mail.gmail.com>
Date: Fri, 24 Oct 2025 10:24:15 -0500
From: Adrián Moreno <amorenoz@...hat.com>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Toke Høiland-Jørgensen <toke@...hat.com>, 
	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Kuniyuki Iwashima <kuniyu@...gle.com>, Stanislav Fomichev <sdf@...ichev.me>, Xiao Liang <shaw.leon@...il.com>, 
	Cong Wang <cong.wang@...edance.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in IFLA_STATS

On Fri, Oct 24, 2025 at 04:59:26PM +0200, Nicolas Dichtel wrote:
>
>
> Le 24/10/2025 à 16:35, Eric Dumazet a écrit :
> > On Fri, Oct 24, 2025 at 7:20 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
> >>
> >> Adrian Moreno <amorenoz@...hat.com> writes:
> >>
> >>> Gathering interface statistics can be a relatively expensive operation
> >>> on certain systems as it requires iterating over all the cpus.
> >>>
> >>> RTEXT_FILTER_SKIP_STATS was first introduced [1] to skip AF_INET6
> >>> statistics from interface dumps and it was then extended [2] to
> >>> also exclude IFLA_VF_INFO.
> >>>
> >>> The semantics of the flag does not seem to be limited to AF_INET
> >>> or VF statistics and having a way to query the interface status
> >>> (e.g: carrier, address) without retrieving its statistics seems
> >>> reasonable. So this patch extends the use RTEXT_FILTER_SKIP_STATS
> >>> to also affect IFLA_STATS.
> >>>
> >>> [1] https://lore.kernel.org/all/20150911204848.GC9687@oracle.com/
> >>> [2] https://lore.kernel.org/all/20230611105108.122586-1-gal@nvidia.com/
> >>>
> >>> Signed-off-by: Adrian Moreno <amorenoz@...hat.com>
> >>> ---
> >>>  net/core/rtnetlink.c | 3 ++-
> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> >>> index 8040ff7c356e..88d52157ef1c 100644
> >>> --- a/net/core/rtnetlink.c
> >>> +++ b/net/core/rtnetlink.c
> >>> @@ -2123,7 +2123,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
> >>>       if (rtnl_phys_switch_id_fill(skb, dev))
> >>>               goto nla_put_failure;
> >>>
> >>> -     if (rtnl_fill_stats(skb, dev))
> >>> +     if (~ext_filter_mask & RTEXT_FILTER_SKIP_STATS &&
> >>> +         rtnl_fill_stats(skb, dev))
> >>
> >> Nit: I find this:
> >>
> >>         if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS) &&
> >>             rtnl_fill_stats(skb, dev))
> >>
> >> more readable. It's a logical operation, so the bitwise negation is less
> >> clear IMO.
> >>
> >
> > Same for me. I guess it is copy/pasted from line 1162 (in rtnl_vfinfo_size())
> I agree. I didn't point it out because there are several occurrences in this
> file (line 1599 / rtnl_fill_vfinfo()).
>

I glanced through this file and assumed it was the agreed style but
looking at other flags, RTEXT_FILTER_SKIP_STATS seems to be the
exception.

I'll change it, and also send another patch changing the style of the
other ocurrances.

Thanks.
Adrián


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ