[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2db420da-eb80-483f-a9e5-c65e2ef9141f@huawei.com>
Date: Wed, 27 Nov 2024 09:33:08 +0800
From: "dongchenchen (A)" <dongchenchen2@...wei.com>
To: Eric Dumazet <edumazet@...gle.com>, David Ahern <dsahern@...nel.org>
CC: <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 2024/11/27 1:26, Eric Dumazet wrote:
> \\
>
> 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;
Thanks for your suggestions!
v3 will be sent.
Powered by blists - more mailing lists