[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <886e2fe3-1c24-c0d3-8434-964767fd03ad@mojatatu.com>
Date: Sat, 27 May 2023 12:44:11 -0300
From: Pedro Tammela <pctammela@...atatu.com>
To: Josh Hunt <johunt@...mai.com>, Max Tottenham <mtottenh@...mai.com>,
netdev@...r.kernel.org
Cc: Jamal Hadi Salim <jhs@...atatu.com>, Cong Wang
<xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>,
Amir Vadai <amir@...ai.me>, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v2] net/sched: act_pedit: Parse L3 Header for L4 offset
On 26/05/2023 18:54, Josh Hunt wrote:
> On 5/26/23 7:03 AM, Pedro Tammela wrote:
>> On 26/05/2023 10:47, Pedro Tammela wrote:
>>>
>>>> +
>>>> + switch (skb->protocol) {
>>>> + case htons(ETH_P_IP):
>>>> + if (!pskb_may_pull(skb, sizeof(*iph) + noff))
>>>> + goto out;
>>>
>>> I might have missed something but is this really needed?
>>> https://urldefense.com/v3/__https://elixir.bootlin.com/linux/latest/source/net/ipv4/ip_input.c*L456__;Iw!!GjvTz_vk!TyuEOA10ZxgU7TBKFX6HAZ359qEMEuo3H0jNMIF1EP75tQbrs8uiSNQSpaaW4N34AH1sCdf5vHcUrV0qsw$
>>
>> Yes this obviously happens before the mentioned function.
>> Now I'm wondering if it's not better to use skb_header_pointer()
>> instead...
>
> Can you elaborate on why you think it would be better?
>
I don't have a strong argument for one over the other and I believe it's
fine as is.
It just looks like 'skb_header_pointer()' is a more conservative
approach as ithas a smaller margin for errorwhen compared to
'pskb_may_pull()'.
But I shall admit that the errors conditions for 'pskb_may_pull()' are
extreme.
Powered by blists - more mailing lists