DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: Xiao Liang <shaw.leon@gmail.com>
Cc: Konstantin Ananyev <konstantin.ananyev@huawei.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation
Date: Fri, 7 Jul 2023 14:26:53 +0100	[thread overview]
Message-ID: <d762d681-ee52-a890-3e5c-e6dd2c5e3223@intel.com> (raw)
In-Reply-To: <CABAhCORqwXL6pb+4cihwVVWUWYdAnJ4nub8mg0DFrBmXPHCHkg@mail.gmail.com>


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.


  parent reply	other threads:[~2023-07-07 13:27 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 [this message]
2023-07-10  9:24               ` Konstantin Ananyev
2023-07-10  9:38                 ` Radu Nicolau
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=d762d681-ee52-a890-3e5c-e6dd2c5e3223@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).