[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLxm+=_rm-GcJ2LenRTDThx2gkrqEJ-bEWqOGSxFVUw9Q@mail.gmail.com>
Date: Tue, 26 Nov 2024 18:26:37 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: David Ahern <dsahern@...nel.org>
Cc: Dong Chenchen <dongchenchen2@...wei.com>, davem@...emloft.net, pabeni@...hat.com,
horms@...nel.org, herbert@...dor.apana.org.au, steffen.klassert@...unet.com,
netdev@...r.kernel.org, yuehaibing@...wei.com, zhangchangzhong@...wei.com
Subject: Re: [PATCH net v2] net: Fix icmp host relookup triggering ip_rt_bug
\\
On Tue, Nov 26, 2024 at 5:23 PM David Ahern <dsahern@...nel.org> wrote:
>
> On 11/25/24 7:59 PM, Dong Chenchen wrote:
> > diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> > index 4f088fa1c2f2..0d51f8434187 100644
> > --- a/net/ipv4/icmp.c
> > +++ b/net/ipv4/icmp.c
> > @@ -515,7 +515,10 @@ static struct rtable *icmp_route_lookup(struct net *net, struct flowi4 *fl4,
> > flowi4_to_flowi(fl4), NULL, 0);
> > rt = dst_rtable(dst);
> > if (!IS_ERR(dst)) {
> > - if (rt != rt2)
> > + unsigned int addr_type = inet_addr_type_dev_table(net,
> > + route_lookup_dev, fl4->daddr);
> > +
>
> unsigned int addr_type;
>
> addr_type = inet_addr_type_dev_table(net, route_lookup_dev,
> fl4->daddr);
>
> allows the lines to meet column limits and alignment requirements.
>
> > + if (rt != rt2 || c == RTN_LOCAL)
> > return rt;
> > } else if (PTR_ERR(dst) == -EPERM) {
> > rt = NULL;
>
Also, we can avoid the expensive call to inet_addr_type_dev_table()
and addr_type variable with :
if (rt != rt2)
return rt;
if (inet_addr_type_dev_table(net, route_lookup_dev,
fl4->daddr) == RTN_LOCAL)
return rt;
Powered by blists - more mailing lists