DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Xiao Liang <shaw.leon@gmail.com>
Cc: Konstantin Ananyev <konstantin.ananyev@huawei.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation
Date: Mon, 10 Jul 2023 10:38:29 +0100	[thread overview]
Message-ID: <9a65d0e8-a827-8329-4d49-2ef7c7984356@intel.com> (raw)
In-Reply-To: <b81adf1f-3868-5214-c457-769a7477d1b1@yandex.ru>


On 10-Jul-23 10:24 AM, Konstantin Ananyev wrote:
> 07/07/2023 14:26, Radu Nicolau пишет:
>>
>> On 07-Jul-23 1:51 PM, Xiao Liang wrote:
>>>> sa->hdr_len and prm->tun.hdr_len don't include L2 length so both 
>>>> should
>>>> start in the diagram at the end of the ETH header.
>>>>
>>>> So the right way to compute datagram length is
>>>>
>>>> dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len +
>>>> sizeof(struct rte_udp_hdr)
>>>>
>>> |<-           mb->pkt_len - sqh_len ->|
>>> |<- sa->hdr_l3_off ->|<- sa->hdr_len ->|
>>>                                    |<- udph->dgram_len ->|
>>>
>>> +--------------------+------------+-----+-----+---------+-----+
>>> |         ETH        |     IP     | UDP | ESP | payload | sqh |
>>> +--------------------+------------+-----+-----+---------+-----+
>>>
>>> |<- sa->hdr_l3_off ->|<- l3_len ->|
>>>                       |<- sa->hdr_len  ->|
>>>
>>> If hdr_len doesn't include L2 length, I would agree that
>>>
>>>      dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len +
>>> sizeof(struct rte_udp_hdr)
>>>
>>> But then what's the point of
>>>      sa->hdr_len - sa->hdr_l3_off
>>> in lib/ipsec/sa.c?
>>
>> I will defer to Konstantin for a definite answer, that is if 
>> sa->hdr_len is supposed to include l2 length / offset or not. If it 
>> does, then the change that triggered this discussion is correct and 
>> we don't need to account for hdr_l3_off there.
>>
>
>
> Ok, have to revive my memories here.
> So, actually hdr_len stands for all tunell headers users want to add.
> It consits of optional l2_len (could be zero) plus outer ip len, plus
> in that case udp hdr len.
> hdr_l3_off is an offset withih hdr_len where outer ip header starts.
> So yep, initial patch looks ok to me, I just acked it.
> Sorry for being a bit sloppy at reviewing it.


This fix should also be CC'ed to stable@dpdk.org

Acked-by: Radu Nicolau <radu.nicolau@intel.com>



  reply	other threads:[~2023-07-10  9:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  8:46 Xiao Liang
2023-07-05 13:49 ` [EXT] " Akhil Goyal
2023-07-06  9:08   ` Konstantin Ananyev
2023-07-06 10:20     ` Radu Nicolau
2023-07-07  2:06       ` Xiao Liang
2023-07-07  3:12       ` Xiao Liang
2023-07-07  8:59         ` Radu Nicolau
2023-07-07 12:51           ` Xiao Liang
2023-07-07 13:17             ` Xiao Liang
2023-07-07 13:26             ` Radu Nicolau
2023-07-10  9:24               ` Konstantin Ananyev
2023-07-10  9:38                 ` Radu Nicolau [this message]
2023-07-10  9:20 ` Konstantin Ananyev
2023-07-11  2:13 ` [PATCH v2] ipsec: fix NAT-T header " Xiao Liang
2023-07-11  2:18 ` Xiao Liang
2023-07-11  8:48   ` [EXT] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a65d0e8-a827-8329-4d49-2ef7c7984356@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=konstantin.ananyev@huawei.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=shaw.leon@gmail.com \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).